Who is viewing

An app has no sign-in page of its own. Whatever is in front of the workspace says who each viewer is, or OpenBelt's own sign-in page does (email sign-in, below), and pages ask the SDK instead of asking for a name:

const me = await db.me() // { email, name } when someone is signed in, null when not
// a signed-in page's writes: doc.author is their email, doc.authorName their name

Test as several people

In a preview environment, check_app's people are made-up teammates: each gets a browser of their own, already signed in as <name>@<app>.test (alice is "Alice"), with the page open before step 1. A step's as says whose browser it runs in (default: the first person). Pages stay open, so an expect as bob sees what alice just did. save keeps a step's result (eval's return value, or the element's text for expect and wait); later steps use it as {{name}} in any of their strings. To test a group gate, give a test person groups: people: [{ "name": "ed", "groups": ["editors"] }, "viv"]; the app's functions see them in caller.groups. They can be in only the groups you're in, unless you own the app and every other app in its preview environment, or are a workspace admin; apps the environment doesn't hold (another app's live query) see no groups.

check_app({
  app: "polls",
  preview: "close-rule",
  people: ["alice", "bob", "carol"],
  steps: [
    { as: "alice", action: "fill", selector: "#question", value: "Lunch?" },
    { as: "alice", action: "click", selector: "text=Create poll" },
    {
      as: "alice",
      action: "eval",
      save: "pollId",
      script: "return document.querySelector('.poll').dataset.id",
    },
    { as: "bob", action: "click", selector: ".poll[data-id='{{pollId}}'] .option" },
    { as: "alice", action: "expect", selector: ".poll .votes", text: "1 vote" },
    { as: "carol", action: "expect", selector: "text=Close poll", count: 0 },
    {
      as: "carol",
      action: "eval",
      script:
        "const { db } = await import('/sdk.js'); await db.collection('polls').update('{{pollId}}', { closed: true }).catch(() => {})",
    },
    { as: "carol", action: "expect", status: 403 },
  ],
})

More on test people

Who says so

OPENBELT_SIGNIN on the platform:

ValueWho is viewingWhere
tailscaleThe Tailscale-User-Login and Tailscale-User-Name headers the front door sets (and replaces): from Tailscale, or from the sign-in proxybun run dev, bun run tailnet, verify, deploy/signin
emailWhoever signed in at /signin with a code sent to their email; and, as under tailscale, whoever the front door namesbun run dev, a public host
offNobodya server with no front door

Under tailscale, only the front door says who is viewing. That's a proxy on the same machine, which reaches OpenBelt over loopback (tailscale serve, scripts/frontdoor.ts, verify), or one elsewhere (another container or machine) that adds X-OpenBelt-Front-Door: <OPENBELT_FRONT_DOOR_SECRET> to every request it forwards. A request from anywhere else names nobody, and a person's pages and data refuse it (403, saying to come through the front door), whatever the workspace's joining. What carries its own credentials still answers it: /mcp and /scim/v2 with a token, /_ops with the admin token, webhooks, OAuth clients' token calls, /_health and /_tls/ask. So the port being reachable doesn't let anyone be someone. Compose binds the port to 127.0.0.1 by default; publishing it on another interface requires an explicit OPENBELT_BIND.

With tailscale, the front door (scripts/frontdoor.ts) sets those headers. On the tailnet it asks Tailscale who each device is. On this machine, bun run dev's owner door, on 127.0.0.1:<port>, names the person running it on every request (their Tailscale login, or <user>@localhost without Tailscale). It answers only names under localhost (acme.localhost, <app>--acme.localhost): a page whose own name points at 127.0.0.1 gets a 421, not them, and so does bare localhost or 127.0.0.1, which a function or connection on another local OpenBelt may fetch. The platform itself, on port + 1000, has no door: nobody is signed in there unless a request from this machine sends the headers itself, as bun run seed and checks do. So under tailscale the platform answers only its own names (under localhost or OPENBELT_HOST, OPENBELT_BASE_HOST, 127.0.0.1, [::1], and tailnet names under ts.net); any other name gets a 421, so a page whose own name points at this machine can't send the headers and be someone.

/_me answers { "email", "name" } or null; /_me?env=<env> is the same, asked from a page in that preview environment. The only cookie is __Host-openbelt_session, which the platform signs with OPENBELT_SESSION_SECRET (the admin token when unset) for one host: check_app's session (a test person or, for its signed-out tab, no one, for 15 minutes; check_app's browser gets one for each app host it opens), or an email sign-in's (below). Any other cookie, or one sealed for another host, is nobody.

Email sign-in

Under OPENBELT_SIGNIN=email, people sign in once on the base host with a 6-digit email code. The heading is "Sign in". Each workspace still checks who may enter, and keeps its own host-only session.

Sign-in on a public host

On a server anyone can reach, people sign in with the company's identity provider before OpenBelt shows them anything. deploy/signin/ puts it in front of compose's OpenBelt, with no OpenBelt code of its own: oauth2-proxy signs people in over OIDC, and Caddy asks it about every request and tells OpenBelt who it is (the same two headers, as the front door).

docker compose -f compose.yaml -f deploy/signin/compose.yaml --profile tls up -d

with, beside compose's own settings, OPENBELT_FRONT_DOOR_SECRET (openssl rand -hex 32), OPENBELT_SSO_ISSUER, OPENBELT_SSO_CLIENT_ID and OPENBELT_SSO_CLIENT_SECRET (an OIDC web app made at the provider, redirecting to https://<OPENBELT_HOST>/oauth2/callback), OPENBELT_SSO_COOKIE_SECRET (openssl rand -hex 16) and optionally OPENBELT_SSO_EMAIL_DOMAIN (who may sign in).

Every app on its own host

Each app is served on a host of its own, <app>--<workspace>.<domain>, so the browser keeps apps apart the way it keeps websites apart: one app's page can't read another's, script it in a frame or a popup, or send a request that OpenBelt takes as the other app's. OpenBelt knows which app a call is from by the host it came to, and refuses a data call (/_db, /_ws, /_log) a page of another origin sent (403 cross_origin; Origin and Sec-Fetch-Site are set by the browser, never the page). Every response of an app's host carries Content-Security-Policy: frame-ancestors 'self' https://<workspace>.<domain>: an app's pages may frame its own pages, the workspace's host may (/a/<app>), and no other app, nor any other web page, can frame them, so nobody can lay an app under a fake button and have a viewer click through to calls made as them. The one exception is an app the workspace's admin names (workspace_embed_set, an app builder showing the app it builds): its origin joins every other app's frame-ancestors. Both are under the workspace's domain, so the viewer is signed in inside the frame in every browser, Safari's included. The frame gives an app no camera, microphone or location: a browser keeps those grants for the address bar's host, which in the frame is the workspace's, so one app's grant would be every app's. Instead the app asks the frame's page with the SDK's device (SDK): only the app's own origin in this frame is heard, the frame's page asks the person for that app (an Allow kept per app on that device), then calls the browser itself and sends back the answer, a camera's tracks included. A page load of the app's host is sent to the frame; check_app's browser stays, and so does a page the app opens itself (a popup, a print view, or a tab it opens with target="_blank"), where device calls the browser directly. An app sets no response headers of its own; a <meta http-equiv="Content-Security-Policy"> in its page still applies, but browsers ignore frame-ancestors there. To show another app, link to it (appUrl("<app>")) or read its data (db.app("<app>")). The workspace's host, <workspace>.<domain>, is OpenBelt's own: Apps, /mcp, /settings, /admin and each app's pages in the frame at /a/<app>/<path>.

Who is viewing works on every host the same way, with nothing handed from host to host:

So there's no OpenBelt sign-in to carry between hosts, and no handoff: if real sign-in (SSO) comes from OpenBelt itself one day, it needs one (a one-time code from the workspace host, bound to the app's host, traded for that host's own __Host- cookie).

Installed workspace

In a browser, choose Add to Home Screen on mobile or Install OpenBelt on desktop at the foot of the person menu. App frames keep installation controls out of the app header. A supported browser opens its native install prompt. On iPhone, a drawing of Safari, labeled OpenBelt, walks you through four steps: the ••• menu, Share, Add to Home Screen, and Add with Open as Web App kept on. An arrow marks what to tap; tap it in the drawing, use Back and Next, or a progress segment to move between steps. The installation happens in your browser's own controls.

Installation is per workspace: named OpenBelt, with the OpenBelt icon and the workspace's Apps page as its launch URL, on its own origin. You can install several workspaces. After you open your first app and return to Apps, it offers a small install invitation on iPhone or when a native prompt is available. Not now remembers your choice for this workspace; the menu action remains available. Other workspaces keep their own invitations. Install controls are hidden in the installed window. The existing workspace switcher stays available; another workspace can open outside the installed window because its origin differs.

Apps keep their separate origins inside the workspace frame. On phones, its header is 48px tall, with a 44px-tall touch target for the OpenBelt icon.

Each app can also be installed on its own from its right side panel under Devices. It lists This browser (This phone on mobile) with Install, and each of your computers running OpenBelt Desktop with Install or Remove (or a Download link for OpenBelt Desktop on macOS when no computer is connected and OpenBelt Desktop isn't running locally). When OpenBelt Desktop is running locally on this computer and not yet linked to this workspace, the Devices panel shows this computer with Install and Settings › Devices offers Connect this Mac: clicking it mints a short-lived one-time connect ticket (POST /_desktop/connect), hands it to the local helper (POST http://127.0.0.1:47821/connect), redeems it (POST /_desktop/redeem) so the desktop host signs into the workspace, saves the workspace, and registers this computer. You can download OpenBelt Desktop (/_desktop/download, which redirects to the latest macOS release from OPENBELT_DESKTOP_DOWNLOAD_BASE, default https://downloads.openbelt.com) and manage all of your computers and their installed apps together at Settings › Devices (/settings/devices). A computer always asks for approval locally with a native permission sheet before installing an app.

Each installed app lives on its own host (<app>--<workspace>.<domain>) with its own manifest (/_pwa/manifest.webmanifest), desktop capability metadata (/_pwa/desktop.json), rendered PNG icons (/_pwa/icon-{180,192,512}.png from its colour and icon or initial), standalone launch entry (/_app) and compact install page (/_install). Keeping each app on its own origin lets you install individual apps alongside the OpenBelt workspace app without scope conflicts, keeps browser storage and device permissions isolated per app, and updates automatically when new versions go live. Supported Chromium browsers install directly via navigator.install or the browser's native install prompt on /_install; Safari on macOS and iOS shows Add to Dock or Add to Home Screen steps. Private apps refuse their manifest, desktop metadata, icons and /_install to people without access.

When an app declares a "desktop" block in openbelt.json or OpenBelt Desktop is running locally, /_install offers Install desktop app beside Use browser app instead. OpenBelt Desktop plays a short first-run intro over the dimmed desktop on its first launch: clicking Get started closes the intro, registers the login item, and opens your workspace (the same page the tray's Open workspace action opens), while pressing Esc closes the intro and stays quiet in the menu bar. Replay is the --intro flag only (there is no tray replay item). From the menu bar, OpenBelt Desktop runs every installed app inside one shared host process, creating a lightweight native launcher per app (an Electron AppShimHost .app bundle in ~/Applications/OpenBelt Apps on macOS, or a .desktop entry on Linux) with its own Dock icon and window identity. Desktop capabilities stay pinned to the app's exact deploy version (x-openbelt-version), and you can inspect or revoke individual capabilities from the OpenBelt Desktop tray menu without removing the app.

Only the installed, standalone window shows Refresh app, in the workspace person menu and on Settings (/settings, a phone's Settings tab). App frames show the OpenBelt logo symbol as the link back to all apps, followed by the app name, with no wordmark, refresh button or update notice. It checks for OpenBelt updates when opened, brought to the foreground, reconnected, and every five minutes while visible. Update available → Refresh reloads the current page when you choose. The URL and page scroll are restored. Workspace edits block refresh.

Browser tabs keep their usual reload controls and show no refresh or update UI. Installation adds no offline cache or background sync: opening, checking versions, and refreshing need a connection. App deployments still follow the app SDK's existing reload behavior; this notice tracks OpenBelt's platform code, not individual app versions.

Notifications: each person allows them one app at a time

An app's function sends a notification with ctx.notify (Functions). It reaches only people who allowed that app's notifications:

  1. The first time an app notifies you, you get nothing. The next time you open the app, it asks at the bottom: Get notifications from this app?, Allow or Not now.
  2. Allow asks the browser for permission, subscribes this device, and turns the app on. Not now keeps it off, and the app doesn't ask again.
  3. The Notifications switch in the app's panel changes your answer later.

A tap on a notification opens the app's page in the workspace frame, at /a/<app>/<path>.

The workspace's one service worker, /_pwa/sw.js, registers when you allow an app. It only shows notifications and opens their pages: it handles no requests, so pages load as they do without it.

Source: docs/viewers.md on GitHub