Skip to content

Apps

Build an app whose extensions render inside Sessions — on the staff session page, in the list of facts on the buyer’s session sheet, and in a business’s embedded schedule — drawn by the Sessions design system, fed by a live query, and with no credentials to hold.

Package@sessions/appsRuntimeSandboxed workerAPI version2026-09
Build your first app
Follow the tutorial from an empty folder to the Music app: a playlist picker for staff and a playlist row for buyers — every file shown in full, and what each one is for.

One package

Everything is in @sessions/apps, your one development dependency: the extension API and its types, the sessions-* elements, the Preact and React bindings, and the sessions command that signs you in, types your GraphQL, bundles, pushes and publishes.

For now it is published privately, as git tags of the Sessions repository: install an exact tag such as github:SessionsCode/Sessions#sessions-apps/v0.1.0. Anyone who can clone the repository can install it; upgrading is changing the tag.

Write extensions against the DOM, or as components with @sessions/apps/preact or @sessions/apps/react — add the framework beside it and nothing else.

terminal
# @sessions/apps is published as git tags of the Sessions repository.
# Pin an exact tag; anyone who can clone the repository can install it.
npm install --save-dev github:SessionsCode/Sessions#sessions-apps/v0.1.0 preact
npx sessions login
package.json
{
  "name": "studio-notes",
  "private": true,
  "type": "module",
  "scripts": {
    "types": "sessions types",
    "build": "sessions build",
    "push": "sessions push",
    "publish:app": "sessions publish"
  },
  "devDependencies": {
    "@sessions/apps": "github:SessionsCode/Sessions#sessions-apps/v0.1.0",
    "preact": "^10.29.0"
  }
}

Apps, extensions, targets

An app is a container you own, named by a global handle, with a name, a description and an icon. It groups extensions and is what a business installs.

An extension is one feature of your app — a session note, a playlist picker. It declares the targets it renders into, and ships its own GraphQL documents and translations.

A target is a named place in the Sessions UI, like business.session.details.block. Each target gets its own module — a file whose default export renders it — and, optionally, a live query.

A business installs your app from its Apps settings, and every extension in it starts rendering for that business. Sessions’ own default apps render for every business with no install.

Give every target its own module. Each is bundled on its own, so a buyer-facing target never downloads the code of a staff-only one, and the files stay small and easy to follow.
studio-notes
import {
  extension,
  useApi,
  useQuery,
  useSignal,
  useTranslate,
  Button,
  Stack,
  TextField,
} from '@sessions/apps/preact';

import saveNote from './SaveNoteMutation.graphql';
import type {SessionNoteQueryData} from './SessionNoteQuery.graphql';

export default extension('business.session.details.block', () => <NoteEditor />);

function NoteEditor() {
  const api = useApi<'business.session.details.block'>();
  const {session} = useQuery<SessionNoteQueryData>();
  const translate = useTranslate();
  // Signals: reading `.value` while rendering re-renders on change.
  const draft = useSignal(session?.note?.value ?? '');
  const saving = useSignal(false);

  async function save() {
    saving.value = true;
    // Typed by the .graphql.d.ts: variables are checked, data is typed.
    const result = await api.mutate(saveNote, {
      variables: {owner: {id: api.session.id}, value: draft.value},
    });
    saving.value = false;
    const failed = result.errors != null || !!result.data?.setMetadata.errors.length;
    api.ui.toast(translate(failed ? 'saveFailed' : 'saved'), {
      tone: failed ? 'critical' : undefined,
    });
  }

  return (
    <Stack gap="small">
      <TextField
        label={translate('label', {activity: session?.activity.name ?? ''})}
        value={draft.value}
        multiline
        onInput={(value) => (draft.value = value)}
      />
      <Button emphasis="strong" loading={saving.value} onClick={save}>
        {translate('save')}
      </Button>
    </Stack>
  );
}

A target’s module

A module’s default export is a function of root and api. root is a remote DOM element — append sessions-* elements, or render Preact or React components — and the host draws them as real Sessions components. Wrap it in extension(target, …) to get the target’s exact api type.

On a business target, api.mutate(document, options) runs a mutation as the signed-in staff member, attributed to your extension. api.ui.toast(message) shows a toast in the host’s own style.

Extensions run in a sandboxed Web Worker with a virtual DOM. They never touch the host page and never see a cookie or token — the host makes every request on the extension’s behalf. The worker has no network of its own: fetch, XMLHttpRequest and WebSocket are blocked, and import() reaches only Sessions-hosted extension modules.

Live queries

A live query is a GraphQL query you ship with a target. Sessions stores it with each version, runs it for you — as the viewer, beside the target’s subject — before your module renders, and runs it again whenever the data changes: after every api.mutate, and whenever the page refreshes its own data.

Your module reads the result as api.query, a signal. It never fetches, never holds a token, and never goes stale — a component that reads it renders again when it changes.

Put the query in a .graphql file, name it with query in sessions.extension.json, and sessions types writes its TypeScript types beside it.

extensions/session-note/SessionNoteQuery.graphql
# The live query: Sessions stores it with the extension, runs it for the
# session each target renders beside, and runs it again when the data
# changes. The module reads the result as `api.query`.
query SessionNote {
  session {
    id
    activity {
      name
    }
    note: metadata(name: "app.studio-notes.note") {
      value
    }
  }
}

Your words, in every language

Sessions speaks English, French and Spanish, and your extension can too. Put a translations/<locale>.json file in the extension for each language; the CLI pushes them with every version, and api.localization.translate(key) picks the viewer’s.

The files work like Sessions’ own: nested keys read as dot paths, {{name}} placeholders, and plurals chosen by count. A missing string falls back to the language, then to English, then to its key.

extensions/session-note/translations/en.json
{
  "label": "Note for {{activity}}",
  "save": "Save note",
  "saved": "Note saved",
  "saveFailed": "Couldn’t save the note",
  "fromTheDesk": "From the front desk"
}

Targets

Where an extension can render today. Each target has its own page with the API it gets.

What a business sees

An app belongs to the business that runs it: staff decide what renders on their pages.

Install
An admin installs a private app from Settings, then Apps, by its handle. Default apps are included with Sessions and need no install.
Blocks
A *.block target draws each extension in its own card, headed by your app’s icon, the extension’s name and “From <app>”. A *.row target draws your rows among the page’s own, with no card at all.
Hide
The card’s “…” menu opens the app’s page in settings (/settings/apps/<handle>), and lets an admin hide one extension for the business — from the menu or with a switch on that page. A hidden extension stops rendering on the next load.
Uninstall
An admin can uninstall an installed app from the same menu or page. Every extension in it stops rendering; a default app can be hidden but not uninstalled.
Icon
"icon" in sessions.app.json names a square PNG, JPEG or WebP. sessions push uploads it when it changes, and it heads your cards and your app’s page.

Ship it

The sessions command types your GraphQL, bundles each target into its own module, pushes a draft version with its live queries and translations, and publishes it when you say so. Every push is a new immutable version; publishing decides which one businesses run.

Building with an AI agent?
Point it at the apps guide: everything on these pages — setup, config files, every target and component, live queries, mutations, metadata rules, localization, the CLI and the pitfalls — in one plain-text document, generated from the same references as this site.

Reference

Everything an app can do, in the order you’ll need it.