The SDK is the npm package briefing-plugin-sdk under the MIT license. It contains the plugin API with types, a Vite preset that builds the plugin folder, and test helpers. The source and a ready-to-use plugin template are on GitHub. This guide walks through a small example: a counter on the stage that everybody in the room shares.
Where plugins run
Your own plugins run on your own Briefing server, not on brie.fi/ng. The operator copies them into the instance and switches them on explicitly. How to run Briefing yourself is in the help for operators.
Structure
A plugin is a small Vite project. The quickest start is a copy of the template, which already contains a shared counter, tests and a standalone dev server. Its id is in reverse-DNS format, here com.example.counter. The same id is the id in the manifest, the name of the plugin class and the prefix of all translation keys and shared state.
counter/
package.json
plugin-manifest.json
vite.config.ts
src/
_types.ts id and settings
index-client.ts entry point
counter.vue the document on the stage
locales/en.json texts, one file per language{
"$schema": "https://about.brie.fi/plugin-manifest.schema.json#",
"id": "com.example.counter",
"name": "Counter",
"version": "0.1.0",
"description": "A shared counter for Briefing."
}As dev dependencies you need briefing-plugin-sdk, vite, @vitejs/plugin-vue and vue, for tests also vitest. Vue and Yjs are not bundled, Briefing provides them at runtime.
Entry point
src/index-client.ts default-exports the plugin class. In setup it registers itself where it is needed in the app, here as a document type on the stage (placement: 'presentation'):
import type { AppPlugin, AppPluginContext } from 'briefing-plugin-sdk'
import { defineAsyncComponent } from 'vue'
import { configSchema, pluginName } from './_types'
export default class Plugin implements AppPlugin {
name = pluginName
configSchema = configSchema
async setup(ctx: AppPluginContext): Promise<void> {
void ctx.addLocaleMessages(import.meta.glob('./locales/*.json'))
ctx.addComponent({
placement: 'presentation',
title: `${pluginName}.title`,
component: defineAsyncComponent(() => import('./counter.vue')),
})
}
}“Counter” now shows up in the stage menu. Every open counter is a tile of its own, and the component gets its docId. Other places are toolbar buttons, sidebar tabs, menu entries, keyboard shortcuts and badges on the camera tiles. The type declarations of the SDK document them all.
Shared state
For shared state Briefing provides synchronized objects. You request one by an id, and from then on it is the same for everybody in the room. Changes travel end-to-end encrypted over the direct connections and are merged per field. Whoever joins later receives the current state.
import { documentSyncId, getAppContext } from 'briefing-plugin-sdk'
import { computed } from 'vue'
import { pluginName } from './_types'
const props = defineProps<{ docId?: string }>()
const app = getAppContext()
// One counter per document on the stage
const counter = app.state.sync!.getMO(documentSyncId(pluginName, props.docId), { count: 0 }).value
// In a moderated room only moderators and presenters change documents
const canEdit = computed(() => app.state.moderation?.canEdit ?? true)
function doIncrement() {
if (canEdit.value)
counter.count += app.config[pluginName]?.step ?? 1
}counter is reactive: a watch reacts to changes by the others, an assignment goes out to everybody. For more complex documents getYDoc gives you a Yjs document instead.
A few rules for a stable state:
- Store values that only make sense together as one field. Otherwise concurrent changes can mix two halves.
- The shared state is the source of truth. If the local view diverges, rebuild it from the shared state.
- Validate what comes in. It comes from other participants, ignore invalid entries.
Settings
Settings are described as a schema. They show up in the admin area of the instance at /config and can also be set as environment variables:
import { z } from 'briefing-plugin-sdk'
export const pluginName = 'com.example.counter'
export const configSchema = z.object({
step: z.number().default(1).describe('How much one click adds'),
})
declare global {
interface AppConfig {
[pluginName]: z.infer<typeof configSchema>
}
}Settings of a single device, such as the last tool or a color, go through deviceStorage from the SDK, never localStorage directly. That way they follow the participant’s “Remember on this device” and nothing stays behind on a borrowed computer.
Build
// vite.config.ts
import Vue from '@vitejs/plugin-vue'
import { briefingPlugin } from 'briefing-plugin-sdk/vite'
import { defineConfig } from 'vite'
export default defineConfig({ plugins: [Vue(), briefingPlugin()] })vite build writes the finished plugin folder to dist/: plugin.js, plugin.css, lazy chunks and the checked plugin-manifest.json. The manifest is validated strictly, a typo fails the build.
Try it in Briefing
npm run build -- --watch --sourcemap
docker run -p 8080:8080 \
-v "$PWD/dist:/app/data/plugins/com.example.counter" \
-e APP__THIRD_PARTY_PLUGINS=true -e APP__PLUGINS_ON=com.example.counter \
-e AUTH=dev holtwick/briefing-proOpen http://localhost:8080 and reload after every build. The admin area at /config (token from AUTH) shows why a plugin does not load. On your own server the plugin folder goes to data/plugins/<id>/ in the same way.
Test
import { setupTestPlugin } from 'briefing-plugin-sdk/testing'
import { expect, it } from 'vitest'
import manifest from '../plugin-manifest.json'
import Plugin from './index-client'
it('adds a stage document', async () => {
const { components, config } = await setupTestPlugin(Plugin, { manifest })
expect(components.map(c => c.placement)).toEqual(['presentation'])
expect(config).toEqual({ step: 1 })
})setupTestPlugin runs setup() the way the app does, checks the manifest and records components, menus, shortcuts and translations.
Rules for every plugin
- Imports only from the SDK, Vue and Yjs, plus libraries you bundle yourself. Briefing’s own sources are not an API.
- No code from foreign servers. The security policy forbids
eval,new Functionand inline event handlers. Vue bindings andaddEventListenerwork as usual. - Every foreign host is declared. If a plugin has to reach another server, the operator adds it to
HTTP__CSP_ALLOWED_DOMAINSand to the privacy policy. - Data only over the encrypted channels. Content goes through the shared state or the data channels of the SDK, never to a server.
- Texts are translation keys under the plugin id, at least in English.
- Keyboard shortcuts and notices through the app:
ctx.addShortcutsandctx.notify, no listeners or toasts of your own.
Responsibility
Plugins from third parties run at the operator’s own risk. They have full access to the call. Our principles and the privacy policy cover only Briefing’s own code and plugins. That is why an instance loads third-party plugins only with APP__THIRD_PARTY_PLUGINS=true and names them on the start page.
Further reading
- The repository on GitHub with README, template and changelog.
- The type declarations in
node_modules/briefing-plugin-sdk/dist/*.d.tsare the complete reference, every export has TSDoc. - Building with a coding agent? The package ships an
AGENTS.mdwith rules, a skeleton and the verify loop. - The changes of each version are in
CHANGELOG.mdof the package.