Plugins

Build a plugin

Make a widget any Gleem channel can add: the CLI, the SDK, the manifest, testing on your channel, review and the Store. Private beta.

Private beta. Plugins are open to invited developers while we build out the developer program. Ask for access in the Gleem Discord; we turn plugins on for your account. Things may still change, and we tell you in the Discord when they do.

A plugin is a widget that any Gleem channel can add from the Store: a countdown, a mini game, an alert style. You write it once with web technology; Gleem runs it in OBS on every channel that adds it, draws its settings form, keeps its data, and delivers it the stream's events. Creators see it as a widget; the Store labels it Community · by your name.

This page walks you from an empty folder to a plugin in the Store, with what we learned building our own.

What a plugin is made of

Part What it is Where it runs
Overlay An HTML page, the part viewers see OBS, as a Browser Source
Panel (optional) A small control UI, up to 480 px tall The widget's editor page and the creator's OBS dock
Backend (optional) Your own HTTPS server, sent signed webhooks Your infrastructure
Manifest gleem-plugin.json: what the plugin is, needs and offers Read by Gleem

The overlay and the panel run in a sandboxed iframe with an opaque origin. They may run scripts and nothing else: no forms, popups or navigation, no cookies, and network access only to the origins the manifest declares. Everything else goes through the SDK, @gleem-gg/plugin-sdk, which talks to the Gleem page around the frame.

Get set up

You need a verified Gleem account with plugins turned on (see the note at the top), and Node.js if you want a build step.

Install the gleem CLI and log in. Logging in opens gleem.gg, where you confirm a code:

curl -fsSL https://get.gleem.gg/cli/install.sh | bash
gleem login
gleem whoami

The installer is for macOS and Linux. On Windows, download gleem-x86_64-pc-windows-msvc.exe from https://get.gleem.gg/cli/<version>/, where get.gleem.gg/cli/latest names the newest version. For CI, set GLEEM_TOKEN to a personal access token with the plugins:publish scope instead of logging in.

Your developer slug is the part of every plugin id before the dot: acme in acme.boss-battle. Your first upload creates your developer account under it, and it cannot change once a plugin carries it, so pick it with care: short, lowercase, yours. Studios and teams can have one developer account that several people publish for; ask us.

Start a plugin

gleem plugin init boss-battle
cd boss-battle
gleem plugin dev

init writes a working plugin with no build step: the manifest, overlay/index.html, overlay/main.js and the SDK as overlay/gleem-sdk.js. If you know your developer slug, pass the id yourself with --id acme.boss-battle.

gleem plugin dev opens a local IDE at http://localhost:5310. It runs your overlay and panel in Gleem's own sandbox and host runtime, next to an editor, an event simulator, the settings form Gleem would draw, a storage inspector and a problems list that checks the upload rules on every save. The preview switches between how the plugin runs live, in a developer's test, in the dashboard's preview and in the Store's demo, and between the manifest's size and others.

With a bundler

For TypeScript, a framework or many files, use a bundler and write the package to dist/, with gleem-plugin.json copied in. The CLI uses dist/ whenever it holds a manifest.

npm install @gleem-gg/plugin-sdk

Two things differ from a normal web app, and a bundler's defaults get both wrong:

  • Classic scripts only. The sandbox does not load type="module" scripts. Build to an IIFE (with Vite: build.rollupOptions.output.format = 'iife', one entry per surface).
  • Relative paths only. Every src and href starts with ./, never / or https: (with Vite: base: './').

Run your bundler in watch mode next to gleem plugin dev; the preview reloads on every build.

The manifest

{
    "$schema": "https://gleem.gg/schemas/gleem-plugin.v1.json",
    "id": "acme.boss-battle",
    "name": "Boss Battle",
    "version": "0.1.0",
    "sdk": "^2.2",
    "category": "games",
    "locales": ["en", "de"],
    "limits": { "maxInstances": 1 },
    "surfaces": {
        "overlay": {
            "entry": "overlay/index.html",
            "size": { "width": 800, "height": 400, "resizable": true }
        },
        "panel": { "entry": "panel/index.html", "height": 220 }
    },
    "events": ["tip", "cheer", "sub", "raid"],
    "commands": [{ "key": "attack", "name": { "setting": "attackCommand" }, "default": "!attack" }],
    "permissions": { "storage": true, "random": true, "signals": true, "chat.read": false, "network": [] },
    "settingsVersion": 1,
    "settings": {
        "type": "object",
        "properties": {
            "attackCommand": { "type": "string", "title": "Attack command", "default": "!attack", "maxLength": 24 },
            "bossHealth": { "type": "integer", "title": "Boss health", "default": 1000, "minimum": 100, "maximum": 100000 },
            "accent": { "type": "string", "format": "color", "title": "Accent", "default": "#8b5cf6" }
        }
    },
    "store": {
        "tagline": "Chat fights a boss together, one tip at a time.",
        "description": "Every tip, cheer and sub hits the boss.\n\nViewers attack with !attack.",
        "poster": "store/poster.webp",
        "preview": "store/preview.webm",
        "screenshots": ["store/1.webp", "store/2.webp"]
    }
}

Keep the $schema line: editors that read JSON Schema (VS Code, JetBrains IDEs, the gleem plugin dev editor) then complete every key and mark mistakes as you type. The schema lives at gleem.gg/schemas/gleem-plugin.v1.json; gleem.gg's own validator stays the judge.

  • category is games, alerts, interaction or utility.
  • limits.maxInstances is how many widgets of the plugin one channel may add.
  • surfaces.overlay.size is the size a new widget starts at; creators resize it in their scenes, so design for other sizes too.
  • events are the stream events the overlay receives: tip, treat, membership.started, cheer, sub, gift, redemption, raid, stream.online, stream.offline. Declare only what you use.
  • commands are chat commands; take the trigger from a setting, as above, so creators can rename it.
  • permissions: storage (keep data per channel), random (dice rolled by Gleem, so viewers can trust them), signals (messages between surfaces), chat.read (for now only Gleem's own plugins), and network, a list of https:// origins the plugin may connect to.
  • backend.webhook and privacyPolicy: a plugin with a backend or network access needs a privacy notice. The Store and the install dialog link it.
  • settings is a JSON Schema that Gleem turns into the settings form, with formats for colours, fonts, images, sounds and dates, sections and conditions. The SDK's README lists them all, with translations for the form's texts and migrations for when the shape of the settings changes.

The overlay

import gleem from '@gleem-gg/plugin-sdk';

const { settings, mode } = await gleem.ready();

render(settings);
gleem.onSettingsChange(render);
gleem.on('tip', ({ data }) => hit(data.gems, data.user?.displayName));
gleem.on('command', ({ key, user }) => key === 'attack' && hit(1, user?.displayName));
gleem.onVisibilityChange((visible) => (visible ? resume() : pause()));

mode says where the overlay runs: live in OBS, dev for your own test build, preview in the dashboard (its writes stay in the preview, so trying settings out never changes the channel) and demo in the Store, on its default settings with made-up events.

What makes an overlay hold up on hundreds of channels:

  • Fill the box you are given. Creators size the source to their scene: 800 × 240 in one, 380 × 84 in the next. Measure the frame and fit text to it rather than using fixed pixel sizes.
  • Keep short text on one line. Fitting text to a tall box tempts the layout into two lines that are only slightly larger; a short message reads better on one. Wrap only when that makes the text clearly bigger.
  • Use gleem.now() for time. It is gleem.gg's clock. The overlay in OBS and the panel on another computer agree on "in five minutes" only if both use it, never Date.now().
  • Start when shown. OBS loads sources in inactive scenes too. gleem.visible and onVisibilityChange tell you when the overlay is actually on screen, so an animation or a timer starts when viewers can see it.
  • Make the defaults look good. A new widget starts on them, and the Store's demo shows them to everyone deciding whether to add your plugin.
  • Load fonts from Bunny Fonts (a stylesheet from fonts.bunny.net): the sandbox allows its stylesheets and the font files they point at, and Gleem's font setting format names fonts that are there. A font from anywhere else goes into your package.

The panel

The panel is the plugin's own control UI: the buttons a creator presses while streaming. It sits on the widget's editor page and in the creator's OBS dock, as an iframe running edge to edge.

import gleem, { applyTheme } from '@gleem-gg/plugin-sdk';
import '@gleem-gg/plugin-sdk/ui.css';

const { theme } = await gleem.ready();

applyTheme(theme);
gleem.onThemeChange(applyTheme);
gleem.autoResize();
  • Bring your own padding. Gleem adds none around the frame, so a panel that pads itself looks right in the editor, the dock and the Store, where the demo draws a border around it.
  • Use autoResize(). It sizes the frame to your content, up to 480 px, and from SDK 2.2.1 it keeps a scrollbar from flashing while the frame catches up with taller content.
  • Use the SDK's ui.css (with class="gleem-ui" on <html>) for buttons, switches and inputs that match the dashboard, and applyTheme for its colours in light and dark mode.
  • Never imitate Gleem. No login forms, no fake dashboard controls. Review turns those down.

Overlay and panel in step, without a server

A panel and its overlays run on different computers. Gleem relays between them, so a plugin that only needs its panel to drive its overlay needs no backend:

// Panel: start the timer. Every surface of this widget hears it, the panel included.
await gleem.widget.storage.set('timer', { status: 'running', endsAt: gleem.now() + 300_000 }, { notify: true });

// Overlay: follow it, and read it once on load in case it changed while the overlay was closed.
gleem.widget.storage.onChange(({ key, value, mine }) => key === 'timer' && apply(value, mine));
apply(await gleem.widget.storage.get('timer'), false);
  • gleem.widget.storage belongs to one widget; gleem.storage to all of the plugin's widgets on the channel. Two widgets of a countdown keep two timers only with the widget scope.
  • Write the whole state in one key and let every surface derive what it shows from it, rather than sending steps.
  • mine is true on the surface that made the write; its echo may arrive before set() resolves, so do not step the display back when it comes.
  • Signals (gleem.widget.signal(type, data)) are for things that happen now ("the timer ended"); storage is for state.
  • Share in the demo too. In the Store's demo, what the panel shares reaches the overlay next to it and what the overlay shares reaches the panel, so visitors see your panel drive the overlay and follow it. The demo has no widget (gleem.widget.id is null, and widget storage is not there), so share through gleem.storage in demo mode, and do not switch sharing off.

A backend (optional)

When a plugin needs a server, for a leaderboard across channels, a database or an API key that must stay secret, declare backend.webhook in the manifest. Gleem then sends your server signed webhooks for each channel that installs the plugin: its lifecycle, the events the manifest declares and the panel's actions, each with an installation you exchange for a token to call the plugin API. Verify every webhook's signature with @gleem-gg/plugin-sdk/server. The SDK's README has the webhook types and the code exchange.

Most plugins do not need one: storage, signals, dice and gleem.now() cover game state, timers and votes.

Your Store listing

The store block of the manifest is your page in the Store:

  • tagline: one line of up to 120 characters.
  • description: plain text of up to 2,000 characters, paragraphs split by a blank line.
  • translations: a tagline and a description for each other language in locales.
  • poster (the card), preview (a short video loop) and up to eight screenshots, as paths inside your package.

Upload checks that every file is there and is what it says by its first bytes: WebP, PNG or JPEG for pictures, WebM or MP4 for the preview.

What works well:

  • 16:9 at 1600 × 900 for the poster and the screenshots, as WebP.
  • A preview of 5 to 10 seconds that loops cleanly, muted, small (a few hundred KB). Show the plugin doing its thing, not a logo.
  • Render the pictures from your real bundle on a neutral background rather than drawing them, so the Store shows exactly what creators get. A small script that loads your built overlay and panel in a headless browser and captures stills and a screencast keeps them current with every release.

The Store also shows facts it takes from the manifest: the version, whether the plugin reads chat, the origins it connects to and whether it has its own server. Its page has a demo running your overlay on its defaults, with a button for each event it listens to.

Test on your channel

gleem plugin validate            # the upload rules, checked locally
gleem plugin validate --remote   # gleem.gg's own validator, a dry run
gleem plugin push --install      # upload a private version and run it on your channel

push uploads the build as a private version: it runs only on your own channel (and on the channels of the people who publish with you). With --install it adds the plugin to your channel, or moves the widgets you have to the new build. Until you submit a version, pushing it again replaces it. Your viewers never see a private version unless you put it in a live scene.

Submit for review

gleem plugin publish --version 0.1.0 --notes "First release."

A person on our team reviews every public version and answers within two weeks. We check that:

  • It runs in demo mode and with each declared event, command, reward and action, with no console errors.
  • Every declared event, command, reward, action and permission is actually used.
  • Chat reading and every network origin have a stated purpose that matches what the plugin does.
  • Its content follows the content rules in every language and asset.
  • It has no tracking, ads or crypto mining, and no code obfuscated beyond reason.
  • It runs with reasonable CPU and memory in a 1080p OBS scene for ten minutes.
  • The Store texts and media match the plugin, and the panel neither imitates Gleem nor asks for a login.
  • For an update, what changed since the last approved version.

Your first public plugin gets a closer look: who you are, what your backend and network access do with a channel's data, and the texts in every language you ship.

When we approve a version, it becomes public and the Store lists your plugin. When we turn one down, you get an email with the reason; fix it and submit a new version. A submitted version is locked, so a fix always gets a new version number.

Updates

Use semantic versions. When a new version is approved:

  • A patch or minor version (1.4.2 → 1.4.3 or 1.5.0) reaches every channel on the same major version by itself.
  • A major version (1.x → 2.0.0) waits for each creator to accept it in the widget's editor, with your release notes and what changes in their settings.
  • A version that asks for more (a new permission or network origin) waits for the creator's consent, whatever its number.
  • Before 1.0, the minor counts as the major: 0.2.0 waits for creators, 0.1.3 does not.

Nothing moves down a release line. When we approve a version, any older version on its line that is still pending, submitted or not, is superseded: it leaves the review queue and never runs. A push below a version already approved on its line is refused, so give a fix the next number up.

When the shape of your settings changes, raise settingsVersion and add migrations, so every widget keeps its creator's choices. Write release notes for creators, not for developers.

Limits

Package 10 MB, packed and unpacked; 500 files
File names letters, digits and . _ @ + -
Code classic scripts only; no eval, new Function or WebAssembly; relative URLs only
Storage 256 KB per channel, 64 KB per value
Shared writes 10 a second and 120 a minute per channel
A surface's signals 5 a second and 60 a minute
Panel height 480 px

Source maps are allowed; reviewers see them, and viewers download them.

Before you submit

  • The overlay fills any box, keeps short text on one line and looks good on its defaults.
  • Time comes from gleem.now(), and animations start when the overlay is shown.
  • The panel pads itself and uses autoResize(); it imitates nothing of Gleem's.
  • The manifest declares only what the plugin uses, and has a privacy notice if it has a backend or network access.
  • The Store listing has a tagline, a description, a poster, a short preview and screenshots rendered from the real bundle, in every language you list.
  • gleem plugin validate --remote passes, and the version runs on your channel in a real scene.

Questions, ideas or something the SDK cannot do yet? Tell us in the Gleem Discord.