Back to feed

Extension Creation Etiquette

Cory · 1 week ago · 3 replies · 228

I’m still kind of interested in developing extensions for ForumSpark, but I have a series of questions.

  1. I don’t want to waste time creating extensions that will become default features like I have in the past. Is there a way to deter that?

  2. Is there a way to store data on the client-side end of the spectrum, or only server-side? I have so many codes on Jcink where I use AJAX to store and fetch data, so I didn’t know if this is what I would have to do on ForumSpark too.

  3. Does ForumSpark use any JavaScript frameworks or libraries, or is it all Vanilla?

3 replies
Cedric · 1 week ago

Good to hear you're still interested.

Avoiding work that becomes a default feature:

I can't promise something will never become core. What I can do is stop you building something that's already planned. Before you start an extension, send me a short description of it and I'll tell you honestly whether it's on our roadmap. If it is, I'll say so up front so you don't spend a weekend on it.

Extensions also have the best chance of lasting when they're specific: a particular community's needs, an integration with an outside service (Discord, game servers, Twitch), or a distinctive look or widget. Broad features most forums would want, like a new post type or a moderation tool, are the ones likely to end up built in.

It's also worth mentioning that, with no promises, we're considering opening ForumSpark up to self-hosting with an extension marketplace. There's a lot of groundwork to do first, which we’ve been doing the last few weeks: the ForumSpark framework itself, how extensions install and uninstall, and making sure third-party extensions run isolated so one can't affect the rest of the board or the platform. If it happens, it could widen what extensions are able to do, so building on ForumSpark now wouldn't be wasted effort.

Client-side vs. server-side storage:

You can do both, but it works differently from Jcink.

  • Client-side: Your scripts run in the page, so localStorage and sessionStorage work normally. That's fine for per-browser things like preferences or dismissed notices. It isn't shared between users or devices.

  • Server-side (shared data): We have an App Data API. When a board installs your app, it gets a token that can only read and write your app's own keys on that board. Your service writes values with PUT /api/v1/app-data/{key}, and your templates or widgets display them with {{ app_data.your_slug.key }}. The limits are 50 keys per app per board and 64KB per value.

The main difference from Jcink: the token belongs on your server, not in browser JavaScript. You can't have every visitor's browser write data through AJAX. Shared data comes from a service you run, and the board displays it. Our script scanner also flags fetch() and XMLHttpRequest, so if your script calls out, you'll need to explain why when you submit it for review.

If you have a specific Jcink code in mind, tell me what it stores and I'll tell you the best way to do it here.

JavaScript frameworks:

The forum runs on Livewire and Alpine.js. Alpine is already loaded on every page, so your scripts can use it (for example x-data and $store) without bundling your own copy. Your extension code is plain JavaScript, and we provide a global window.ForumSpark SDK that gives you:

  • page context: the board, forum, topic and current user

  • an event bus (ForumSpark.on, emit, off), with Livewire events bridged into it

  • registerMiniProfileWidget() for adding blocks to user profile cards

  • dark mode helpers

The posting editor is built on TipTap, and real-time features (shoutbox, chat, notifications) use Laravel Echo. You won't need either for most extensions.

The developer docs cover all of this: Getting Started, JavaScript SDK, Script Injection and App Data.

Cory OP · 1 week ago

Firstly, thank you for the extensive response!

Before you start an extension, send me a short description of it and I'll tell you honestly whether it's on our roadmap. If it is, I'll say so up front so you don't spend a weekend on it.

Will do!

It's also worth mentioning that, with no promises, we're considering opening ForumSpark up to self-hosting with an extension marketplace.

Won’t this make it where server-side scripting can be used when creating extensions?

If you have a specific Jcink code in mind, tell me what it stores and I'll tell you the best way to do it here.

Here’s an example of a code I use store and grab data from a forum/topic to display on the user’s main profile: https://scripts.jcodesresources.com/main-profile/feedback-system/script.js

The developer docs cover all of this: Getting Started, JavaScript SDK, Script Injection and App Data.

I’ll have to read this sometime when I have the chance.

Cedric · 1 week ago

Cory said:

Won’t this make it where server-side scripting can be used when creating extensions?

On a self-hosted install, yes: it's your own server, so you can run whatever you like there. Extensions in the marketplace that can be installed on hosted boards are a different story, to be honest. They won't run third-party PHP on our servers. That's the isolation I mentioned: one extension must never be able to reach another board's data or the platform. Hosted extensions are built from templates, settings, scripts and widgets. If you need server-side logic, it runs on your own service and talks to the board through the API and webhooks. So yes, extensions can have a server side, it just lives with you and not inside ForumSpark. But we’re still looking into this to allow 3rd party apps if/when we go the self hosted route.

Cory said:

Here’s an example of a code I use store and grab data from a forum/topic to display on the user’s main profile: https://scripts.jcodesresources.com/main-profile/feedback-system/script.js

a feedback forum with one topic per member, replies written as rating~comment, and a score and table on the profile. You have two ways to do it here.

  1. A straight port (closest to what you have now)

A script extension is loaded on every forum page, including member profiles, so it can work like your Jcink version: read the member ID from the profile URL (/users/{id}-{name}), load that member's feedback topic from the same board, read the replies and build the panel. You don't need a server. Two notes:

- The script scanner flags fetch() and XMLHttpRequest. That doesn't block approval, but you'll need to explain in your submission that the script only reads the board's own feedback forum.

- Like on Jcink, reading the topic's HTML depends on the theme's markup. A board with a very different theme may need the selectors adjusted.

2. The sturdier version (with a small service)

Your service subscribes to the board's replies/create, replies/update and replies/delete webhooks. Each one includes the reply's topic, so you can check through the API whether it's in the feedback forum. Then parse the rating, update that member's totals and store them. You can put small totals in App Data (up to 50 keys and 64KB per value per board). Keep full comment history on your own service. The profile then shows ready-made numbers without reading any page HTML, so the theme doesn't matter. 🙂

Create a free account to join the conversation.
Sign up free
ForumSpark © 2023 - 2026 · ForumSpark.net · Terms