@protobase/cli 0.125.1 → 0.126.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,7 +7,7 @@ import { configExports } from "@protobase/server";
7
7
  * the config and its views, as `protobase relay app` prints it, without the address, id or keys a build does not hold.
8
8
  * `undefined` without `realtime.relay`, so its presence means the app hands its connections to the relay.
9
9
  */
10
- const bundleRelay = async (config) => {
10
+ const bundleRealtime = async (config) => {
11
11
  const relay = config.realtime?.relay;
12
12
  if (!relay) return;
13
13
  const views = configExports(await projectResources(config)).views.map((view) => view.toModel());
@@ -17,4 +17,4 @@ const bundleRelay = async (config) => {
17
17
  });
18
18
  };
19
19
  //#endregion
20
- export { bundleRelay };
20
+ export { bundleRealtime };
@@ -7,7 +7,7 @@ import { layoutCheck } from "./layout-check.js";
7
7
  import { extensionImports } from "../project/extensions.js";
8
8
  import { viteBundle } from "./vite-bundle.js";
9
9
  import { cliProtobaseIds, provideCliModules } from "../project/cli-modules.js";
10
- import { bundleRelay } from "./bundle-relay.js";
10
+ import { bundleRealtime } from "./bundle-relay.js";
11
11
  import { collectComponents } from "./component-names.js";
12
12
  import { bundleEntryCode } from "./entry-code.js";
13
13
  import { hostPackages } from "./packages/host-packages.js";
@@ -102,7 +102,7 @@ const buildConfigBundle = async ({ projectDir, outFile, bun, extensions = [], co
102
102
  native: [...native.values()],
103
103
  mobile: config.mobile,
104
104
  notifications: Boolean(config.notifications),
105
- relay: await bundleRelay(config)
105
+ realtime: await bundleRealtime(config)
106
106
  };
107
107
  };
108
108
  //#endregion
@@ -53,7 +53,7 @@ const buildDeployBundle = async ({ projectDir, outDir, bun, extensions = [], sou
53
53
  await removeOwnFolder(outDir, bundleNodeModules, "nodeModules");
54
54
  await removeOwnFolder(outDir, bundleMigrations, "migrations");
55
55
  const components = /* @__PURE__ */ new Set();
56
- const { native, mobile, notifications, relay } = await buildConfigBundle({
56
+ const { native, mobile, notifications, realtime } = await buildConfigBundle({
57
57
  projectDir,
58
58
  outFile: path.join(outDir, bundleLayout.server),
59
59
  bun,
@@ -104,7 +104,7 @@ const buildDeployBundle = async ({ projectDir, outDir, bun, extensions = [], sou
104
104
  ...mobileSection && { mobile: mobileSection },
105
105
  ...packages.length > 0 ? { nodeModules: bundleNodeModules } : {},
106
106
  ...migrations ? { migrations } : {},
107
- ...relay && { relay }
107
+ ...realtime && { realtime }
108
108
  };
109
109
  await writeFile(path.join(outDir, manifestFile), `${JSON.stringify(manifest, null, 2)}\n`);
110
110
  return manifest;
@@ -21,12 +21,12 @@ const isPlugin = (value) => isObject(value) && typeof value.name === "string" &&
21
21
  const isShell = (value) => isObject(value) && typeof value.protobase === "string" && Number.isInteger(value.pluginApi) && isStringList(value.paths) && (value.builtAt === void 0 || isTime(value.builtAt));
22
22
  const isTime = (value) => Number.isSafeInteger(value) && value >= 0;
23
23
  const isVersions = (value) => isObject(value) && Object.values(value).every((item) => typeof item === "string");
24
- const isRelay = (value) => isObject(value) && (value.client_events === void 0 || isObject(value.client_events) && isObject(value.client_events.channels)) && (value.presence === void 0 || isObject(value.presence) && typeof value.presence.path === "string" && Number.isInteger(value.presence.grace_seconds));
24
+ const isRealtime = (value) => isObject(value) && (value.client_events === void 0 || isObject(value.client_events) && isObject(value.client_events.channels)) && (value.presence === void 0 || isObject(value.presence) && typeof value.presence.path === "string" && Number.isInteger(value.presence.grace_seconds));
25
25
  const isIcons = (value) => isObject(value) && typeof value.favicon === "boolean" && isStringList(value.png) && value.png.every((icon) => icon in pngIcons);
26
26
  const parseManifest = (value, file) => {
27
27
  const manifest = value;
28
28
  if (manifest?.version !== 3) throw new Error(`${file} is not a version 3 bundle manifest; rebuild it with \`protobase build\``);
29
- const { builtAt, server, public: publicDir, api, spa, plugins, theme, shell, icons, native, mobile, nodeModules, migrations, relay } = manifest;
29
+ const { builtAt, server, public: publicDir, api, spa, plugins, theme, shell, icons, native, mobile, nodeModules, migrations, realtime } = manifest;
30
30
  if (typeof server !== "string" || typeof publicDir !== "string" || typeof spa !== "string" || typeof theme !== "string" || !isStringList(api)) throw new Error(`${file} needs server, public, spa and theme paths and an api list`);
31
31
  if (!Array.isArray(plugins) || !plugins.every(isPlugin)) throw new Error(`${file} needs a plugins list, each with a name, path and api`);
32
32
  if (!isShell(shell)) throw new Error(`${file} needs a shell with its protobase version, pluginApi and paths`);
@@ -36,7 +36,7 @@ const parseManifest = (value, file) => {
36
36
  if (mobile !== void 0 && !(isObject(mobile) && isVersions(mobile.plugins) && (mobile.appId === void 0 || typeof mobile.appId === "string") && (mobile.push === void 0 || typeof mobile.push === "boolean"))) throw new Error(`${file} has a mobile that is not { appId, plugins, push } with an app id, a map of package names to versions and true or false`);
37
37
  if (nodeModules !== void 0 && typeof nodeModules !== "string") throw new Error(`${file} has a nodeModules that is no path`);
38
38
  if (migrations !== void 0 && typeof migrations !== "string") throw new Error(`${file} has a migrations that is no path`);
39
- if (relay !== void 0 && !isRelay(relay)) throw new Error(`${file} has a relay that is not { client_events, presence } with its channels and a presence path and grace`);
39
+ if (realtime !== void 0 && !isRealtime(realtime)) throw new Error(`${file} has a realtime that is not { client_events, presence } with its channels and a presence path and grace`);
40
40
  return {
41
41
  version: 3,
42
42
  ...builtAt !== void 0 && { builtAt },
@@ -52,7 +52,7 @@ const parseManifest = (value, file) => {
52
52
  ...mobile && { mobile },
53
53
  ...nodeModules === void 0 ? {} : { nodeModules },
54
54
  ...migrations === void 0 ? {} : { migrations },
55
- ...relay && { relay }
55
+ ...realtime && { realtime }
56
56
  };
57
57
  };
58
58
  const readManifest = async (bundleDir) => {
@@ -1,4 +1,4 @@
1
1
  //#region package.json
2
- var version = "0.125.1";
2
+ var version = "0.126.0";
3
3
  //#endregion
4
4
  export { version };
@@ -1,6 +1,6 @@
1
1
  //#region src/relay/register.ts
2
2
  const registerRelay = (program) => {
3
- program.command("relay").description("The realtime relay the app hands its connections to (realtime.relay)").command("app").description("Print the app's entry for the relay's apps file, from realtime.relay or PROTOBASE_RELAY_*, url and the views").action(async () => {
3
+ program.command("relay").description("The realtime relay the app hands its connections to (realtime.relay)").command("app").description("Print the app's entry for the relay's apps file, from realtime.relay or PROTOBASE_REALTIME_*, url and the views").action(async () => {
4
4
  const [{ configExports, relaySettings }, { loadSourceConfig }, { projectResources }, { loadNearestEnvFile }, { relayAppEntry }] = await Promise.all([
5
5
  import("@protobase/server"),
6
6
  import("../config/source-config.js"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@protobase/cli",
3
- "version": "0.125.1",
3
+ "version": "0.126.0",
4
4
  "description": "The protobase command: scaffold, doctor, dev, build and serve a Protobase project.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -43,13 +43,13 @@
43
43
  "dependencies": {
44
44
  "@better-auth/core": "^1.7.12",
45
45
  "@hono/node-server": "^2.1.3",
46
- "@protobase/config": "0.125.1",
47
- "@protobase/layout": "0.125.1",
48
- "@protobase/query": "0.125.1",
49
- "@protobase/schema": "0.125.1",
50
- "@protobase/server": "0.125.1",
51
- "@protobase/ui": "0.125.1",
52
- "@protobase/workflows": "0.125.1",
46
+ "@protobase/config": "0.126.0",
47
+ "@protobase/layout": "0.126.0",
48
+ "@protobase/query": "0.126.0",
49
+ "@protobase/schema": "0.126.0",
50
+ "@protobase/server": "0.126.0",
51
+ "@protobase/ui": "0.126.0",
52
+ "@protobase/workflows": "0.126.0",
53
53
  "@react-email/render": "^2.1.0",
54
54
  "@scalar/hono-api-reference": "^0.12.10",
55
55
  "@sentry/vite-plugin": "^11.10.0",
@@ -17,7 +17,7 @@ The changes of each record, comments on it, and pages that refresh as records ch
17
17
  - [Change stream](../reference/live.md#the-stream): Apps follow record changes over a stream that catches up after a reconnect.
18
18
  - [Polling, then a socket](../reference/live.md#polling-then-a-socket): Apps and Node scripts poll for changes first and switch to a WebSocket after 30 seconds, or at once, falling back to polling while the socket is down.
19
19
  - [Presence](../reference/channels.md#presence) (beta): Apps see who else has a record open and what each of them tracks, such as online or away, for whoever may read the record.
20
- - [Realtime relay](../reference/realtime-relay.md) (in development): Apps hand their realtime connections to a relay, so they and their database can sleep while people stay connected: the app issues connect tickets for signed-in people and visitors, keeps the relay's channel members in step with its members records, tells each channel's members of every change, and closes a session's sockets when it signs out or expires. `protobase dev` runs a relay for the app by itself. An app on a platform that runs the relay picks up its address and keys from PROTOBASE_RELAY_URL, PROTOBASE_RELAY_APP, PROTOBASE_RELAY_API_KEY, PROTOBASE_RELAY_TICKET_KEY and PROTOBASE_RELAY_PRESENCE_KEY; a value in the config wins. `protobase build` writes the app's events and presence for the relay's apps file into the bundle's manifest, and the platform's PROTOBASE_RELAY_ENABLED switch, true or false, says when it moves the app.
20
+ - [Realtime relay](../reference/realtime-relay.md) (in development): Apps hand their realtime connections to a relay, so they and their database can sleep while people stay connected: the app issues connect tickets for signed-in people and visitors, keeps the relay's channel members in step with its members records, tells each channel's members of every change, and closes a session's sockets when it signs out or expires. `protobase dev` runs a relay for the app by itself. An app on a platform that runs the relay, Protobase Realtime, picks up its address and keys from PROTOBASE_REALTIME_URL, PROTOBASE_REALTIME_APP, PROTOBASE_REALTIME_API_KEY, PROTOBASE_REALTIME_TICKET_KEY and PROTOBASE_REALTIME_PRESENCE_KEY; a value in the config wins. `protobase build` writes the app's events and presence for the relay's apps file into the bundle's manifest, and the platform's PROTOBASE_REALTIME_ENABLED switch, true or false, says when it moves the app.
21
21
  - [Relay presence](../reference/realtime-relay.md#presence) (in development): The relay reports who comes online, goes away and goes offline; the app keeps it in a resource of its own, raises that resource's events, so workflows can act when someone goes offline, and tells the people who share a conversation with them, whose sidebar and members page show them online, away or offline.
22
22
  - [Relay in pages](../reference/realtime-relay.md#pages) (in development): Pages follow the relay on one socket: open views stay current from its notices and read again once after a reconnect, conversations show who types, sidebar groups say "typing…" and count unread messages without reading per message, also of a conversation the person was just added to, all by configuration; `client.relay` gives the same from code.
23
23
  - [Relay client events](../reference/realtime-relay.md#client-events) (in development): Each channel resource declares in the config the events its clients may send each other, such as typing, with a schema, a size and a rate.
@@ -306,7 +306,7 @@ By default the bundle runs on Node and on Bun. `--bun` makes it a bundle for Bun
306
306
  - `theme` is the project's [theme](theme.md), which the app links at `/protobase.theme.css`. It is always there, empty when the project has none.
307
307
  - `nodeModules` is present only when the config module imports [native packages](#native-packages). It is always the `node_modules` folder beside `server`, where Bun and Node resolve the module's imports from, and holds plain packages: JavaScript, `package.json` files and native binaries for linux x64 and arm64 (glibc), which the runtime loads with `dlopen`. A host keeps it next to the server module and must not mount it `noexec` (an add-on there then fails with `failed to map segment from shared object`). Its binaries link nothing but glibc, `libstdc++.so.6`, `libgcc_s.so.1` and libraries in the bundle itself, so the run image must have those three. Without `nodeModules`, the server module is the only file the runtime reads.
308
308
  - `migrations` is present only when the project has a `db/migrations` folder: its `.sql` files, which the runtime's `migrate` applies (see [Deploy](../guides/deploy.md)). A host never serves it.
309
- - `relay` is present only when the config has [`realtime.relay`](realtime-relay.md): the app's part of its entry in the relay's apps file, as [`relay app`](#relay-app) prints it, without the address, id or any key: `client_events`, when a channel resource has events, and with presence `presence`, the path of the app's presence endpoint and the reports' `grace_seconds`. A host that runs the relay completes it with the app's id, keys, origin and presence key, and the presence endpoint at the app's address.
309
+ - `realtime` is present only when the config has [`realtime.relay`](realtime-relay.md): the app's part of its entry in the apps file of Protobase Realtime, the WebSocket relay, as [`relay app`](#relay-app) prints it, without the address, id or any key: `client_events`, when a channel resource has events, and with presence `presence`, the path of the app's presence endpoint and the reports' `grace_seconds`. A host that runs Realtime completes it with the app's id, keys, origin and presence key, and the presence endpoint at the app's address.
310
310
  - `api` lists the path prefixes the server answers. A path is under a prefix when it equals it or continues it with `/` (`/api` covers `/api/meta` and `/api/v1:batchWrite`, not `/apiary`). It is always `/api` and the two OAuth discovery documents [MCP clients](auth.md#oauth-for-mcp-clients) read, which answer 404 without MCP: a bundle assumes the API lives under `/api`, with the resources at the default `apiPath` `/api/v1`, `/api/meta`, the docs, the API functions and the built-in assistant beside them and Better Auth at `/api/auth`. A bundle built before them sends them to the UI: rebuild it. The serve runtime refuses a config that sets another `apiPath`.
311
311
  - Every other path is the UI's. A `GET` or `HEAD` for a file in `public` gets that file; a folder gets its `index.html`. Otherwise a request whose `Accept` header contains `text/html` (a navigation) gets `spa` with status 200, so deep links such as `/orders/42` load the app; anything else gets 404. Other methods get 405.
312
312
  - Files under an `assets/` folder, `public/assets/` and each plugin's, are named by their content hash and never change: serve them with `Cache-Control: public, max-age=31536000, immutable`, and everything else, `index.html`, each `plugin.json` and the theme, with `no-cache`.
@@ -487,8 +487,8 @@ Serves the API of a bundle from `protobase build` and owns the process around it
487
487
  | `PROTOBASE_RUNS_ON_NOTE` | `true` ends the sign-in page on the [Runs on Protobase note](app-identity.md#runs-on-protobase-note), for a hosting platform; default `false`, and any value but `true` or `false` stops startup |
488
488
  | `PROTOBASE_RUNTIME_URL` | the endpoint behind the top bar's [runtime update button](versioning.md#runtime-updates), such as a hosting platform's; without it there is no button |
489
489
  | `PROTOBASE_SENTRY_DSN` | the DSN of a Sentry-compatible error tracker the app's server and admin app send their errors to, after the config's `errorReporting` ([Error reporting](api.md#error-reporting)); without it nothing is sent |
490
- | `PROTOBASE_RELAY_URL`, `PROTOBASE_RELAY_APP`, `PROTOBASE_RELAY_API_KEY`, `PROTOBASE_RELAY_TICKET_KEY`, `PROTOBASE_RELAY_PRESENCE_KEY` | the address, the app's id, its API and ticket keys and its presence key of the [realtime relay](realtime-relay.md#from-the-platform), each where the config's `realtime.relay` leaves it out; without `realtime.relay` the relay stays off |
491
- | `PROTOBASE_RELAY_ENABLED` | `true` when the platform moves the app to the [realtime relay](realtime-relay.md#from-the-platform); `true` without `realtime.relay` in the config stops the server. Unset or empty is `false`; any other value stops the server |
490
+ | `PROTOBASE_REALTIME_URL`, `PROTOBASE_REALTIME_APP`, `PROTOBASE_REALTIME_API_KEY`, `PROTOBASE_REALTIME_TICKET_KEY`, `PROTOBASE_REALTIME_PRESENCE_KEY` | the address, the app's id, its API and ticket keys and its presence key of [Protobase Realtime](realtime-relay.md#from-the-platform), the WebSocket relay, each where the config's `realtime.relay` leaves it out; without `realtime.relay` the relay stays off |
491
+ | `PROTOBASE_REALTIME_ENABLED` | `true` when the platform moves the app to [Realtime](realtime-relay.md#from-the-platform); `true` without `realtime.relay` in the config stops the server. Unset or empty is `false`; any other value stops the server |
492
492
  | `PROTOBASE_MAP_STYLE_URL` | the URL of the MapLibre style the record page's [maps](ui-config.md#maps) are drawn with, after the config's `maps`; without it there are no maps |
493
493
  | `PROTOBASE_SOURCES` | other Protobase APIs whose resources the app draws as its own, a JSON list of `{ "url", "label", "resources", "roles"? }` after the config's `remoteResources` ([Remote resources](remote-resources.md#declaring-a-source)) |
494
494
  | `PROTOBASE_FILES_<NAME>`, `PROTOBASE_FILES_RETENTION`, `PROTOBASE_FILES_SECRET` | [file providers](files.md#providers) and their settings, over `files` in the config; a bucket's credentials in `PROTOBASE_FILES_<NAME>_ACCESS_KEY_ID` and `_SECRET_ACCESS_KEY` |
@@ -684,7 +684,7 @@ Recounts a [time rollup](data-config.md#keeping-it-up-to-date)'s buckets from th
684
684
  protobase relay app
685
685
  ```
686
686
 
687
- Prints the app's entry for the apps file of the [realtime relay](realtime-relay.md), as JSON: its `id`, `api_keys` and `ticket_keys` from `realtime.relay`, or else `PROTOBASE_RELAY_APP`, `PROTOBASE_RELAY_API_KEY` and `PROTOBASE_RELAY_TICKET_KEY`, and in `origins` the origin of the app's `url` (or `PROTOBASE_URL`); in `client_events` each channel resource's [client events](realtime-relay.md#client-events), with `typing` on those whose conversation page types; with [presence](realtime-relay.md#presence), `presence` with the app's presence endpoint at that `url`, the presence key (or `PROTOBASE_RELAY_PRESENCE_KEY`) and a `grace_seconds` of 30. Its `client_events` and presence path and grace are the bundle manifest's [`relay`](#the-manifest). Add the relay's limits and options to it there. It reads `protobase.config.ts` with `command: 'tool'` and the `.env` nearest the current directory.
687
+ Prints the app's entry for the apps file of [Realtime](realtime-relay.md), as JSON: its `id`, `api_keys` and `ticket_keys` from `realtime.relay`, or else `PROTOBASE_REALTIME_APP`, `PROTOBASE_REALTIME_API_KEY` and `PROTOBASE_REALTIME_TICKET_KEY`, and in `origins` the origin of the app's `url` (or `PROTOBASE_URL`); in `client_events` each channel resource's [client events](realtime-relay.md#client-events), with `typing` on those whose conversation page types; with [presence](realtime-relay.md#presence), `presence` with the app's presence endpoint at that `url`, the presence key (or `PROTOBASE_REALTIME_PRESENCE_KEY`) and a `grace_seconds` of 30. Its `client_events` and presence path and grace are the bundle manifest's [`realtime`](#the-manifest). Add the relay's limits and options to it there. It reads `protobase.config.ts` with `command: 'tool'` and the `.env` nearest the current directory.
688
688
 
689
689
  ## `auth migration`
690
690
 
@@ -43,7 +43,7 @@ export default defineConfig(({ env }) => ({
43
43
  | `channels.<resource>.members` | Where the channel's members come from: a resource whose records each put one person in one channel, with its relation field to the channel resource (`channel`) and its field of the person's user id (`user`). Index both columns: tickets read by the user, notices by the channel. Without `members`, the channel is open: a channel of a public record, which tickets list when asked (see [Tickets](#tickets)). |
44
44
  | `channels.<resource>.mentions` | A field of the records noticed on the channel that lists the user ids they mention, an array or one id, which [notices](#notices) carry. |
45
45
  | `channels.<resource>.events` | The [events](#client-events) the channel's members may send each other, by name, each with its payload's `schema`, its `maxBytes` and the rate one person may send it at, `perSecond` in bursts of `burst`. |
46
- | `presence` | Turns on [presence](#presence): the app's own resource it is kept in, its fields of the person's user id (`user`), the status (`status`) and when it began (`at`), and the bearer token of the relay's reports (`key`), at least 32 characters, which defaults to [`PROTOBASE_RELAY_PRESENCE_KEY`](#from-the-platform). |
46
+ | `presence` | Turns on [presence](#presence): the app's own resource it is kept in, its fields of the person's user id (`user`), the status (`status`) and when it began (`at`), and the bearer token of the relay's reports (`key`), at least 32 characters, which defaults to [`PROTOBASE_REALTIME_PRESENCE_KEY`](#from-the-platform). |
47
47
 
48
48
  The relay needs the app's own [sign-in](auth.md), whose sessions its tickets name, with its store in the app's own database, as the `auth` config puts it: an auth store in another database is refused. A members resource's changes must be captured, so declare [`.live()`](live.md) on it; the relay hears of the changes of every resource whose changes are captured, such as a live one, that is a channel resource or has a relation field to one. [`protobase migration`](cli.md#migration) writes the trigger that ends a deleted session's sockets, in the `relay` schema, after the auth store's steps when the same file writes them, so a new app's first migration sets up both; the server checks it at start.
49
49
 
@@ -51,21 +51,21 @@ The relay needs the app's own [sign-in](auth.md), whose sessions its tickets nam
51
51
 
52
52
  ### From the platform
53
53
 
54
- An app on a platform that runs the relay picks up its address and keys from the environment, so its config names only its channels:
54
+ An app on a platform that runs the relay, Protobase Realtime, picks up its address and keys from the environment, so its config names only its channels:
55
55
 
56
56
  | Variable | Default of |
57
57
  | --- | --- |
58
- | `PROTOBASE_RELAY_URL` | `url` |
59
- | `PROTOBASE_RELAY_APP` | `app` |
60
- | `PROTOBASE_RELAY_API_KEY` | `apiKey` |
61
- | `PROTOBASE_RELAY_TICKET_KEY` | `ticketKey` |
62
- | `PROTOBASE_RELAY_PRESENCE_KEY` | `presence.key` |
58
+ | `PROTOBASE_REALTIME_URL` | `url` |
59
+ | `PROTOBASE_REALTIME_APP` | `app` |
60
+ | `PROTOBASE_REALTIME_API_KEY` | `apiKey` |
61
+ | `PROTOBASE_REALTIME_TICKET_KEY` | `ticketKey` |
62
+ | `PROTOBASE_REALTIME_PRESENCE_KEY` | `presence.key` |
63
63
 
64
64
  Each is a default on its own: a value in the config wins, and a key that neither sets stops the server at start, naming the key and its variable. The relay stays off without `realtime.relay` in the config, however many of these are set: the app turns it on by declaring its channels.
65
65
 
66
- `PROTOBASE_RELAY_ENABLED` is the platform's switch: `true` when its apps file carries the app's entry, `false`, or unset or empty, otherwise; any other value stops the server at start, naming it. A config with `realtime.relay` uses the relay whatever it says. `true` without `realtime.relay` stops the server at start, as the channels and their members come only from the config. <gap>An app without `realtime.relay` cannot move to the relay with `PROTOBASE_RELAY_ENABLED` because deriving its channels and their members from its conversation pages is not implemented.</gap>
66
+ `PROTOBASE_REALTIME_ENABLED` is the platform's switch: `true` when its apps file carries the app's entry, `false`, or unset or empty, otherwise; any other value stops the server at start, naming it. A config with `realtime.relay` uses the relay whatever it says. `true` without `realtime.relay` stops the server at start, as the channels and their members come only from the config. <gap>An app without `realtime.relay` cannot move to the relay with `PROTOBASE_REALTIME_ENABLED` because deriving its channels and their members from its conversation pages is not implemented.</gap>
67
67
 
68
- [`protobase build`](cli.md#the-manifest) writes the app's part of its apps file entry into the bundle's manifest, as `relay`: its `client_events` and, with presence, the presence endpoint's path and `grace_seconds`, without the address, id or any key. A platform reads it from each build and completes the entry with the app's id, keys, origin and presence key, and the endpoint at the app's address.
68
+ [`protobase build`](cli.md#the-manifest) writes the app's part of its apps file entry into the bundle's manifest, as `realtime`: its `client_events` and, with presence, the presence endpoint's path and `grace_seconds`, without the address, id or any key. A platform reads it from each build and completes the entry with the app's id, keys, origin and presence key, and the endpoint at the app's address.
69
69
 
70
70
  ```ts
71
71
  export default defineConfig({
@@ -127,7 +127,7 @@ The resource is keyed by its user field, its status field is text or an enum of
127
127
 
128
128
  Only the relay writes the records, so give no role `presences.create`, `presences.update` or `presences.delete`: whoever may write one can set anyone's presence and raise its events. A role that reads the resource reads the presence of everyone its rows allow, which can reach further than `people` does, so grant `presences.read` no wider than that.
129
129
 
130
- The relay posts its reports to `POST /api/relay/presence` with the presence key as its bearer token, never a sign-in; the [apps file entry](cli.md#relay-app) names the address. A report holds at most 500 changes, each a person's status and when it began. The app writes them in one statement, which replaces a record's status only with one that began later, and answers `204`: a report the relay sends again, or one that arrives late, changes nothing. A report with a missing or wrong key is refused with `401` before its body is read. To change the key, change it in the config, or `PROTOBASE_RELAY_PRESENCE_KEY`, and in the apps file; the relay sends a refused report again, waiting up to a minute between tries, until the app takes it, so no change is lost. When the relay restarted, which a report says with its start time, everyone it has not reported since and who is not offline yet is set offline as of that start, once in each server process for each start; the relay sends no report until someone's status changes, so this waits for the first one.
130
+ The relay posts its reports to `POST /api/relay/presence` with the presence key as its bearer token, never a sign-in; the [apps file entry](cli.md#relay-app) names the address. A report holds at most 500 changes, each a person's status and when it began. The app writes them in one statement, which replaces a record's status only with one that began later, and answers `204`: a report the relay sends again, or one that arrives late, changes nothing. A report with a missing or wrong key is refused with `401` before its body is read. To change the key, change it in the config, or `PROTOBASE_REALTIME_PRESENCE_KEY`, and in the apps file; the relay sends a refused report again, waiting up to a minute between tries, until the app takes it, so no change is lost. When the relay restarted, which a report says with its start time, everyone it has not reported since and who is not offline yet is set offline as of that start, once in each server process for each start; the relay sends no report until someone's status changes, so this waits for the first one.
131
131
 
132
132
  Each write goes through the resource's table, so its changes raise the resource's [events](events.md), [webhooks](webhooks.md) and [workflows](workflows.md) as any other record's do, such as a workflow on `presences.wentOffline`. An offline report raises its event once.
133
133