@protobase/cli 0.26.9 → 0.28.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.
Files changed (45) hide show
  1. package/dist/build/app-icons.js +51 -0
  2. package/dist/build/deploy-bundle.js +6 -4
  3. package/dist/bundle/manifest.js +5 -1
  4. package/dist/{package.js → cli/package.js} +1 -1
  5. package/dist/dev/entry.js +7 -1
  6. package/dist/main.js +2 -0
  7. package/dist/mobile/api-origin.js +34 -0
  8. package/dist/mobile/arguments.js +16 -0
  9. package/dist/mobile/cap-run-args.js +22 -0
  10. package/dist/mobile/capacitor-config.js +25 -0
  11. package/dist/mobile/capacitor.js +17 -0
  12. package/dist/mobile/child-env.js +26 -0
  13. package/dist/mobile/child-process.js +17 -0
  14. package/dist/mobile/fingerprint.js +12 -0
  15. package/dist/mobile/generate.js +20 -0
  16. package/dist/mobile/info-plist.js +11 -0
  17. package/dist/mobile/installed-package.js +20 -0
  18. package/dist/mobile/load-project.js +25 -0
  19. package/dist/mobile/mobile-config.js +26 -0
  20. package/dist/mobile/package.js +13 -0
  21. package/dist/mobile/pinned-packages.js +27 -0
  22. package/dist/mobile/platform.js +4 -0
  23. package/dist/mobile/register.js +33 -0
  24. package/dist/mobile/run.js +84 -0
  25. package/dist/mobile/web-part.js +54 -0
  26. package/dist/mobile/workspace.js +42 -0
  27. package/dist/project/favicon-link.js +24 -2
  28. package/dist/project/project-admin.js +5 -2
  29. package/dist/project/protobase-folder.js +5 -0
  30. package/dist/project/service-worker.js +1 -1
  31. package/dist/serve/bundle-ui.js +2 -1
  32. package/dist/version/version.js +1 -1
  33. package/package.json +6 -6
  34. package/skills/protobase/SKILL.md +2 -0
  35. package/skills/protobase/references/guides/deploy.md +2 -1
  36. package/skills/protobase/references/guides/mobile-app.md +64 -0
  37. package/skills/protobase/references/guides/plugin-build.md +2 -1
  38. package/skills/protobase/references/reference/api.md +1 -1
  39. package/skills/protobase/references/reference/app-identity.md +54 -0
  40. package/skills/protobase/references/reference/auth.md +8 -3
  41. package/skills/protobase/references/reference/cli.md +19 -3
  42. package/skills/protobase/references/reference/custom-components.md +1 -1
  43. package/skills/protobase/references/reference/email.md +1 -1
  44. package/skills/protobase/references/reference/installable-app.md +11 -2
  45. package/skills/protobase/references/reference/theme.md +2 -2
@@ -0,0 +1,54 @@
1
+ import { bundleLayout } from "../bundle/manifest.js";
2
+ import { buildDeployBundle } from "../build/deploy-bundle.js";
3
+ import path from "node:path";
4
+ import { cp, mkdir, readFile, rm, writeFile } from "node:fs/promises";
5
+ import { apiOriginMeta } from "@protobase/schema/internal";
6
+ const escapeAttribute = (value) => value.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
7
+ /** The page naming the API origin the shell calls, in the `<meta>` tag the shell reads (see `apiOriginMeta`). */
8
+ const withApiOrigin = (html, origin) => {
9
+ const at = html.indexOf("</head>");
10
+ if (at < 0) throw new Error("The shell's index.html has no </head> to name the API origin in");
11
+ return `${html.slice(0, at)}<meta name="${apiOriginMeta}" content="${escapeAttribute(origin)}">${html.slice(at)}`;
12
+ };
13
+ /**
14
+ * The app's files: the deploy bundle's `public/` (the shell, the project's UI plugins, theme and favicon), its
15
+ * index.html naming the API origin. The bundle is built beside it and removed, so its server config module and
16
+ * packages never sit where Capacitor copies from.
17
+ */
18
+ const buildWebPart = async ({ projectDir, ws, extensions, apiOrigin, build = buildDeployBundle, onWarning }) => {
19
+ const bundle = path.join(ws, "bundle");
20
+ const web = path.join(ws, "web");
21
+ await rm(bundle, {
22
+ recursive: true,
23
+ force: true
24
+ });
25
+ await build({
26
+ projectDir,
27
+ outDir: bundle,
28
+ extensions,
29
+ ...onWarning && { onWarning }
30
+ });
31
+ await rm(web, {
32
+ recursive: true,
33
+ force: true
34
+ });
35
+ await cp(path.join(bundle, bundleLayout.public), web, { recursive: true });
36
+ await rm(bundle, {
37
+ recursive: true,
38
+ force: true
39
+ });
40
+ const index = path.join(web, bundleLayout.spa);
41
+ await writeFile(index, withApiOrigin(await readFile(index, "utf8"), apiOrigin));
42
+ };
43
+ /** A stand-in for the app's files with `--live`, where the app opens `protobase dev` and never shows them. */
44
+ const placeholderWebPart = async (ws) => {
45
+ const web = path.join(ws, "web");
46
+ await rm(web, {
47
+ recursive: true,
48
+ force: true
49
+ });
50
+ await mkdir(web, { recursive: true });
51
+ await writeFile(path.join(web, bundleLayout.spa), "<!doctype html><title>protobase dev</title>\n");
52
+ };
53
+ //#endregion
54
+ export { buildWebPart, placeholderWebPart, withApiOrigin };
@@ -0,0 +1,42 @@
1
+ import { protobaseVersion } from "../version/version.js";
2
+ import { protobaseFolder } from "../project/protobase-folder.js";
3
+ import { existsSync } from "node:fs";
4
+ import path from "node:path";
5
+ import { mkdir, readFile, writeFile } from "node:fs/promises";
6
+ import { fileURLToPath } from "node:url";
7
+ //#region src/mobile/workspace.ts
8
+ /** Where the mobile build lives in a project: npm's install of @protobase/mobile, the app's files and native projects. */
9
+ const workspaceDir = (projectDir) => path.join(projectDir, protobaseFolder, "mobile");
10
+ const fromSource = path.extname(import.meta.url) === ".ts";
11
+ /** The @protobase/mobile to install: the CLI's own version, or this repository's package when the CLI runs from source. */
12
+ const mobileSpec = (source = fromSource) => source ? `file:${fileURLToPath(new URL("../../../mobile", import.meta.url))}` : protobaseVersion;
13
+ /** The workspace's package.json: @protobase/mobile and the project's extra plugins. */
14
+ const workspacePackageJson = ({ mobileSpec, plugins = {} }) => ({
15
+ private: true,
16
+ dependencies: {
17
+ "@protobase/mobile": mobileSpec,
18
+ ...plugins
19
+ }
20
+ });
21
+ /**
22
+ * Writes the workspace in `dir`, ignored by git, and installs its packages with npm when its package.json changed or
23
+ * one of them is missing, as after an install that failed. `--install-links` copies a `file:` package and puts its
24
+ * dependencies at the workspace's root, where Capacitor looks for them.
25
+ */
26
+ const prepareWorkspace = async (dir, packageJson, run) => {
27
+ await mkdir(dir, { recursive: true });
28
+ await writeFile(path.join(dir, ".gitignore"), "*\n");
29
+ const file = path.join(dir, "package.json");
30
+ const content = `${JSON.stringify(packageJson, null, 2)}\n`;
31
+ const changed = !existsSync(file) || await readFile(file, "utf8") !== content;
32
+ const missing = Object.keys(packageJson.dependencies).some((name) => !existsSync(path.join(dir, "node_modules", name, "package.json")));
33
+ if (changed) await writeFile(file, content);
34
+ if (changed || missing) await run("npm", [
35
+ "install",
36
+ "--install-links",
37
+ "--no-audit",
38
+ "--no-fund"
39
+ ]);
40
+ };
41
+ //#endregion
42
+ export { mobileSpec, prepareWorkspace, workspaceDir, workspacePackageJson };
@@ -1,9 +1,15 @@
1
1
  import { faviconFile, projectFavicon } from "../build/favicon.js";
2
+ import { existsSync } from "node:fs";
3
+ import path from "node:path";
2
4
  import { readFile } from "node:fs/promises";
5
+ import { pngIcons } from "@protobase/server";
3
6
  //#region src/project/favicon-link.ts
4
7
  /**
5
- * Links the project's favicon at `/protobase.favicon.svg` in the app's page. A bundle always has the file (see
6
- * `buildFavicon`); the dev server answers it from the project's protobase.favicon.svg, or Protobase's without one.
8
+ * Links the project's favicon at `/protobase.favicon.svg` in the app's page, and its Apple touch icon at
9
+ * `/protobase.apple-touch-icon.png`, which Safari takes for the home screen as it takes no SVG. A bundle always has
10
+ * the favicon (see `buildFavicon`) and the touch icon when the project has one (see `buildIcons`); without it Safari
11
+ * shows a picture of the page instead. The dev server answers them from the project's files, the favicon Protobase's
12
+ * without one, and the project's other PNG icons the same way.
7
13
  */
8
14
  const faviconLink = (projectDir) => {
9
15
  let base = "/";
@@ -20,6 +26,15 @@ const faviconLink = (projectDir) => {
20
26
  response.end(body);
21
27
  }, next);
22
28
  });
29
+ for (const { file } of Object.values(pngIcons)) server.middlewares.use(`/${file}`, (_request, response, next) => {
30
+ const own = projectDir === void 0 ? void 0 : path.join(projectDir, file);
31
+ if (!own || !existsSync(own)) return next();
32
+ readFile(own).then((body) => {
33
+ response.setHeader("content-type", "image/png");
34
+ response.setHeader("cache-control", "no-cache");
35
+ response.end(body);
36
+ }, next);
37
+ });
23
38
  },
24
39
  transformIndexHtml: {
25
40
  order: "post",
@@ -31,6 +46,13 @@ const faviconLink = (projectDir) => {
31
46
  href: `${base}${faviconFile}`
32
47
  },
33
48
  injectTo: "head"
49
+ }, {
50
+ tag: "link",
51
+ attrs: {
52
+ rel: "apple-touch-icon",
53
+ href: `${base}${pngIcons.appleTouch.file}`
54
+ },
55
+ injectTo: "head"
34
56
  }]
35
57
  }
36
58
  };
@@ -2,8 +2,8 @@ import { configExports, createAdmin, jobDefinitions } from "@protobase/server";
2
2
  //#region src/project/project-admin.ts
3
3
  /**
4
4
  * The admin API of a project over `db`, as `dev`, `serve` and `worker` build it: its config module's resources, views,
5
- * pages and subscriptions, and the rest of its config; served from a bundle, the plugins it carries and their field
6
- * types. `jobs` are the project's own and the delivery of its events and history. With a `reporter`, every error the API turns
5
+ * pages and subscriptions, and the rest of its config; served from a bundle, the plugins it carries, their field
6
+ * types and which icons are the project's own (`protobase dev` passes the project's icons alone). `jobs` are the project's own and the delivery of its events and history. With a `reporter`, every error the API turns
7
7
  * into a 500 goes to the error tracker too, besides the project's `onUnhandledError` or the console. With the host's
8
8
  * `upgradeWebSocket`, it serves `/realtime/v1` too.
9
9
  */
@@ -25,6 +25,9 @@ const projectAdmin = (project, config, db, ui, reporter, upgradeWebSocket) => {
25
25
  ...project.events && { events: project.events },
26
26
  ...project.history && { history: project.history },
27
27
  ...project.webhooks && { webhooks: project.webhooks },
28
+ ...project.mobile && { mobile: project.mobile },
29
+ ...project.app && { app: project.app },
30
+ ...ui?.icons && { icons: ui.icons },
28
31
  jobs: own,
29
32
  subscriptions,
30
33
  ...ui && {
@@ -0,0 +1,5 @@
1
+ //#region src/project/protobase-folder.ts
2
+ /** The folder in a project where Protobase keeps what it generates, such as the mobile workspace; never the app's own files. */
3
+ const protobaseFolder = ".protobase";
4
+ //#endregion
5
+ export { protobaseFolder };
@@ -15,7 +15,7 @@ const serviceWorker = () => ({
15
15
  order: "post",
16
16
  handler: () => [{
17
17
  tag: "script",
18
- children: `if ('serviceWorker' in navigator) navigator.serviceWorker.register('/${serviceWorkerFile}')`,
18
+ children: `if ('serviceWorker' in navigator && !window.Capacitor) navigator.serviceWorker.register('/${serviceWorkerFile}')`,
19
19
  injectTo: "body"
20
20
  }]
21
21
  },
@@ -1,7 +1,8 @@
1
1
  //#region src/serve/bundle-ui.ts
2
2
  const bundleUi = (manifest) => ({
3
3
  plugins: manifest.plugins.map((plugin) => `/${plugin.path}`),
4
- fieldTypes: Object.fromEntries(manifest.plugins.flatMap((plugin) => Object.entries(plugin.fields ?? {})))
4
+ fieldTypes: Object.fromEntries(manifest.plugins.flatMap((plugin) => Object.entries(plugin.fields ?? {}))),
5
+ ...manifest.icons && { icons: manifest.icons }
5
6
  });
6
7
  //#endregion
7
8
  export { bundleUi };
@@ -1,4 +1,4 @@
1
- import { version } from "../package.js";
1
+ import { version } from "../cli/package.js";
2
2
  //#region src/version/version.ts
3
3
  const protobaseVersion = version;
4
4
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@protobase/cli",
3
- "version": "0.26.9",
3
+ "version": "0.28.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": {
@@ -35,11 +35,11 @@
35
35
  "dependencies": {
36
36
  "@hono/node-server": "^2.1.3",
37
37
  "@hono/vite-dev-server": "^0.26.1",
38
- "@protobase/layout": "0.26.9",
39
- "@protobase/query": "0.26.9",
40
- "@protobase/schema": "0.26.9",
41
- "@protobase/server": "0.26.9",
42
- "@protobase/ui": "0.26.9",
38
+ "@protobase/layout": "0.28.0",
39
+ "@protobase/query": "0.28.0",
40
+ "@protobase/schema": "0.28.0",
41
+ "@protobase/server": "0.28.0",
42
+ "@protobase/ui": "0.28.0",
43
43
  "@react-email/render": "^2.1.0",
44
44
  "@scalar/hono-api-reference": "^0.12.10",
45
45
  "@tailwindcss/vite": "^4.3.3",
@@ -53,6 +53,7 @@ Guides:
53
53
  - When letting users save a list as Excel or CSV → read [Exporting a list](references/guides/export-a-list.md)
54
54
  - When importing records from a spreadsheet → read [Importing records from a spreadsheet](references/guides/import-records.md)
55
55
  - When replacing a resource's create form with a page of your own → read [A create page of your own](references/guides/create-page.md)
56
+ - When running the app on iOS or Android → read [A mobile app](references/guides/mobile-app.md)
56
57
 
57
58
  Reference:
58
59
 
@@ -81,6 +82,7 @@ Reference:
81
82
  - When building or loading plugins → read [Plugins](references/reference/plugins.md)
82
83
  - When using resources another Protobase API serves → read [Remote resources](references/reference/remote-resources.md)
83
84
  - When setting the app's tokens, colors and fonts → read [Theme](references/reference/theme.md)
85
+ - When setting the app's name, icon, home-screen icons or install colours → read [App identity](references/reference/app-identity.md)
84
86
  - When showing the app's screens in Dutch → read [Languages](references/reference/languages.md)
85
87
  - When installing the app on a phone or computer, or asking what it does offline → read [Installable app](references/reference/installable-app.md)
86
88
  - When grouping sidebar entries or listing recent records → read [Sidebar](references/reference/sidebar.md)
@@ -21,7 +21,8 @@ dist/
21
21
  protobase.config.js the config module, run by the serve runtime
22
22
  node_modules/ only with native add-ons: those packages, with linux x64 and arm64 binaries
23
23
  public/ the admin app (index.html and content-hashed assets/), the project's UI as plugins in
24
- plugins/, its theme, protobase.theme.css, and its favicon, protobase.favicon.svg
24
+ plugins/, its theme, protobase.theme.css, and its icons, protobase.favicon.svg
25
+ and the PNGs the project has
25
26
  protobase.bundle.json the manifest: which paths go to the server, which Protobase version built it, the
26
27
  plugins and the app's version
27
28
  ```
@@ -0,0 +1,64 @@
1
+ <!-- Generated by scripts/protobase-skill.ts from website/src/content/docs/guides/mobile-app.md: run `bun run docs:skill`, do not edit. -->
2
+
3
+ # A mobile app
4
+
5
+ Run a Protobase app on iOS and Android from a mobile section in its config, without setting up Capacitor yourself.
6
+
7
+ A Protobase app runs as an iOS or Android app with nothing more than a `mobile` section in its `protobase.config.ts`. `protobase mobile` wraps the app in [Capacitor](https://capacitorjs.com): the app's shell, its UI plugins, theme and favicon open from files on the device, and the app calls your server's API.
8
+
9
+ Signing in from the app is not supported yet: until then the app shows that it cannot reach the server's sign-in, while its API calls go through.
10
+
11
+ ## 1. Install the tools
12
+
13
+ - **iOS**, on a Mac: Xcode, with a simulator.
14
+ - **Android**: the Android SDK, with an emulator, and JDK 21.
15
+
16
+ Set their variables, such as `ANDROID_HOME` and `JAVA_HOME`, in your shell, not in the project's `.env`: the commands hand npm and Capacitor no variable named in any of the project's `.env*` files, even when the shell sets a variable of the same name, since those files hold the app's secrets.
17
+
18
+ ## 2. Add a mobile section
19
+
20
+ ```ts
21
+ // protobase.config.ts
22
+ export default defineConfig({
23
+ // ...
24
+ mobile: {
25
+ appId: 'com.example.shop',
26
+ plugins: { '@capacitor/camera': '^8.0.0' },
27
+ },
28
+ })
29
+ ```
30
+
31
+ - `appId` is the app's id in reverse-DNS form: at least two parts separated by dots, each starting with a letter and holding only letters, digits and underscores.
32
+ - `plugins`, optional, are extra native [Capacitor plugins](https://capacitorjs.com/docs/plugins), npm name to version. Capacitor itself, `@capacitor/app`, `@capacitor/splash-screen` and `@capawesome/capacitor-live-update` come with Protobase at fixed versions and cannot be listed. A plugin runs native code with the app's rights, and one that writes files, such as `@capacitor/filesystem`, lets a script that got into the page point the app at files it wrote (with Capacitor's own `WebView.setServerBasePath`), so list only plugins the app needs.
33
+
34
+ With a mobile section, the API answers the app's origins, `capacitor://localhost` on iOS and `https://localhost` on Android, through [CORS](../reference/api.md#cors)). Apps without one get no new dependency, and `protobase build` and `protobase dev` work as before.
35
+
36
+ ## 3. Run it
37
+
38
+ ```sh
39
+ protobase mobile run android
40
+ protobase mobile run ios
41
+ ```
42
+
43
+ The first run installs Capacitor into `.protobase/mobile/`, which ignores itself in git. Every run builds the app's files as [`protobase build`](../reference/cli.md#build)) does and generates the native project from your config again, so never edit the projects in `.protobase/mobile/` by hand. Your own package.json gains nothing.
44
+
45
+ The app calls the server at the project's auth `baseURL`; pass `--api https://shop.example.com` for another one. Plain http is only for a server on this machine (`localhost`) or, on the Android emulator, its host `10.0.2.2`; any other server needs https. An Android phone on USB reaches a server on `localhost` through a forwarded port; an iPhone needs an https server. The app's UI plugins load from the device only when the server serves a built bundle (`protobase serve dist`): against `protobase dev`, use `--live`.
46
+
47
+ `--target <id>` picks the simulator, emulator or device; without it Capacitor asks.
48
+
49
+ ## 4. Live reload
50
+
51
+ ```sh
52
+ protobase dev
53
+ protobase mobile run android --live
54
+ ```
55
+
56
+ With `--live` the app opens the running `protobase dev` instead of its own files, so it reloads as you save. `--port` names the dev server's port, 5173 by default.
57
+
58
+ ## 5. Open the native project
59
+
60
+ ```sh
61
+ protobase mobile open ios
62
+ ```
63
+
64
+ opens the generated project in Xcode, or Android Studio for `android`. To run on an iPhone, pick a signing team in Xcode's Signing & Capabilities.
@@ -29,6 +29,7 @@ dist/
29
29
  plugins/app/ protobase.ui.tsx, as the plugin app
30
30
  protobase.theme.css empty until the project has a theme
31
31
  protobase.favicon.svg Protobase's until the project has its own
32
+ protobase.*.png the project's PNG icons, when it has them
32
33
  protobase.bundle.json version 3, naming the plugins and the app's version
33
34
  ```
34
35
 
@@ -52,7 +53,7 @@ Each `--extend` folder's `protobase.ui.tsx` becomes a plugin of its own, `plugin
52
53
 
53
54
  A host that serves `public/` as before keeps working: `index.html` for navigations, files for the rest. Two things are new:
54
55
 
55
- - The plugins' `assets/` folders, `public/plugins/<name>/assets/`, are named by their content like `public/assets/`: serve them as immutable too. `plugin.json`, `protobase.theme.css` and `protobase.favicon.svg` are served with `no-cache`.
56
+ - The plugins' `assets/` folders, `public/plugins/<name>/assets/`, are named by their content like `public/assets/`: serve them as immutable too. `plugin.json`, `protobase.theme.css`, `protobase.favicon.svg` and the PNG icons are served with `no-cache`.
56
57
  - A host that keeps the prebuilt app of newer releases may serve it for the manifest's `shell.paths`, so the app gets that release's fixes without a rebuild (see [the shell](../reference/plugins.md#the-shell))). `protobase serve` does so with its own when every plugin of the bundle loads in it.
57
58
 
58
59
  ## 6. protobase dev
@@ -184,7 +184,7 @@ Real login is [Better Auth](auth.md)). Lower level:
184
184
 
185
185
  ## CORS
186
186
 
187
- The API sends no CORS headers until it has something to allow: other websites in `options.cors` (a list of origins, or `'*'` for any), which defaults to `PROTOBASE_CORS_ORIGINS` (`*` or comma separated origins), or other [origins of the app](auth.md#several-origins)), which are always allowed.
187
+ The API sends no CORS headers until it has something to allow: other websites in `options.cors` (a list of origins, or `'*'` for any), which defaults to `PROTOBASE_CORS_ORIGINS` (`*` or comma separated http and https origins), other [origins of the app](auth.md#several-origins)), which are always allowed, or a [mobile section](../guides/mobile-app.md)), which allows the app's Capacitor origins, `capacitor://localhost` and `https://localhost`. `PROTOBASE_CORS_ORIGINS` refuses other schemes at startup.
188
188
 
189
189
  - It covers `/api/*` but Better Auth's `/api/auth/*`, which checks origins itself, and [API functions](../guides/api-functions.md)) with a `cors` of their own, and supabase-js's sign-in at [`/auth/v1`](auth.md#supabase-js-and-supabasessr)).
190
190
  - An allowed origin gets `Access-Control-Allow-Origin` with its name and `Vary: Origin`, or `*` with `'*'`. No credentials: browser code calls the API with a bearer token.
@@ -0,0 +1,54 @@
1
+ <!-- Generated by scripts/protobase-skill.ts from website/src/content/docs/reference/app-identity.md: run `bun run docs:skill`, do not edit. -->
2
+
3
+ # App identity
4
+
5
+ The app's name, icon and colours, which its sidebar logo, browser tabs, home-screen icon, web manifest and mail all follow.
6
+
7
+ An app looks like its own everywhere from three things in its project: its name, its icon and its colours. The sidebar's logo, the browser tab, the icon on a phone's home screen, the [installed app](installable-app.md)) and the auth mail all follow them, with no component to write.
8
+
9
+ | What | Where | Used by |
10
+ | --- | --- | --- |
11
+ | Name | `appName` of `createAuth` ([auth configuration](auth.md#configuration))), overridden at run time by `PROTOBASE_APP_NAME` | the sidebar's logo, the end of every tab title, the installed app's name, passkey and authenticator prompts, auth mail and its sender's name |
12
+ | Icon | `protobase.favicon.svg` at the project's root | the browser tab, the sidebar's logo, the installed app's icon |
13
+ | Raster icons | optional PNGs beside the SVG, below | the iPhone home screen and Android launchers, which take no SVG |
14
+ | Colours | `app` in `protobase.config.ts` | the installed app's title bar and its start screen |
15
+
16
+ ```ts
17
+ // protobase.config.ts
18
+ export default defineConfig({
19
+ config,
20
+ auth,
21
+ authenticate,
22
+ app: { themeColor: '#0d9488', backgroundColor: '#ffffff' },
23
+ })
24
+ ```
25
+
26
+ `createAuth` takes the name because the sign-in it builds needs it, so keep the name in a constant both `auth/auth.ts` and anything else that shows it import, if you want it written once.
27
+
28
+ ## The name
29
+
30
+ `appName` names the app; `PROTOBASE_APP_NAME`, when a deployment sets it, overrides it, so a deployment can rename an app without a new build. Without either the app is called `Protobase`.
31
+
32
+ ## The icons
33
+
34
+ `protobase.favicon.svg` is the one source of the app's icon: the tab shows it, the [web manifest](installable-app.md#the-manifest)) names it, and with it the sidebar's logo draws it beside the app's name in place of Protobase's mark and wordmark. A project's own [`shell.logo`](custom-components.md#shell-slots)) still wins.
35
+
36
+ Some platforms take no SVG, so a project may put PNGs of the same icon beside it, each square at its size:
37
+
38
+ | File | Size | Used by |
39
+ | --- | --- | --- |
40
+ | `protobase.apple-touch-icon.png` | 180 × 180 | the iPhone and iPad home screen, linked by the app's page |
41
+ | `protobase.icon-192.png` | 192 × 192 | the web manifest, for Android launchers |
42
+ | `protobase.icon-512.png` | 512 × 512 | the web manifest, for Android's install screens |
43
+ | `protobase.icon-maskable.png` | 512 × 512 | the web manifest's maskable icon, which Android crops to its own shape: keep the mark within the middle 80% |
44
+
45
+ Each is optional, and none is made from the SVG: without the touch icon an iPhone's home screen shows a picture of the page. `protobase build` copies the ones the project has to the bundle's `public/`, and fails on a file that is no PNG or not its size; `protobase dev` serves them from the project's root.
46
+
47
+ ## The colours
48
+
49
+ `app` takes any CSS colour for each, and the web manifest carries the ones set:
50
+
51
+ - `themeColor`: the installed app's title bar and the browser's toolbar around it (`theme_color`).
52
+ - `backgroundColor`: the screen the installed app shows while it starts (`background_color`).
53
+
54
+ The app's own colours, its buttons and surfaces, are the [theme](theme.md))'s.
@@ -75,16 +75,16 @@ The columns Better Auth needs that the table lacks, filled from what the other s
75
75
  | `TRUSTED_ORIGINS` | extra comma separated origins; a dev tunnel needs its exact host here, such as `https://my-tunnel.trycloudflare.com`, since no wildcard is trusted |
76
76
  | `PROTOBASE_ORIGINS` | the other origins the app is served on, comma separated, passed by the platform; see [Several origins](#several-origins) |
77
77
  | `PROTOBASE_PASSKEY_DOMAIN` | the host new [passkeys](#passkeys) are made for, passed by the platform; default the host of `BETTER_AUTH_URL` |
78
- | `PROTOBASE_CORS_ORIGINS` | other websites whose browser code may call the API, `*` or comma separated origins, passed by the platform; see [CORS](api.md#cors)) |
78
+ | `PROTOBASE_CORS_ORIGINS` | other websites whose browser code may call the API, `*` or comma separated http and https origins, passed by the platform; see [CORS](api.md#cors)) |
79
79
  | `PROTOBASE_SMTP_URL`, `PROTOBASE_MAIL_FROM` | the mail server and sender for [password reset](#password-reset), [emailed sign-in codes](#emailed-sign-in-codes), emailed [two-factor](#two-factor-authentication) codes and [open sign-up](#open-sign-up), passed by the platform; all four are off without them |
80
- | `PROTOBASE_APP_NAME` | the app's name, passed by the platform: the default of `appName` |
80
+ | `PROTOBASE_APP_NAME` | the app's name, passed by the platform: it overrides `appName` |
81
81
  | `PROTOBASE_SIGN_IN_ISSUER`, `PROTOBASE_SIGN_IN_CLIENT_ID`, `PROTOBASE_SIGN_IN_CLIENT_SECRET` | the [platform sign-in provider](#platform-sign-in-provider) for people who have an account, passed by the platform; off without them. `PROTOBASE_SIGN_IN_PROVIDER` and `PROTOBASE_SIGN_IN_NAME` are optional |
82
82
  | `PROTOBASE_OPERATOR_ISSUER`, `PROTOBASE_OPERATOR_CLIENT_ID`, `PROTOBASE_OPERATOR_CLIENT_SECRET` | the [operator provider](#operator-provider) its staff sign in with to sign in as people, passed by the platform; staff sign-in is off without them. `PROTOBASE_OPERATOR_NAME` and `PROTOBASE_OPERATOR_GROUP` are optional |
83
83
 
84
84
  - Cookies are `SameSite=Lax`, and `Secure` when `BETTER_AUTH_URL` is https.
85
85
  - Sign-in is rate limited (5 password attempts per minute and client by default, `signInPerMinute`, which also limits [sign-up](#open-sign-up) requests; 3 per minute for emailed codes); the limiter keys on `x-forwarded-for`, so run behind a proxy that sets it.
86
86
  - New passwords need at least 12 characters.
87
- - `appName` is the app's name: authenticator apps and passkey prompts show it, the admin app's sidebar shows it at the top beside Protobase's mark (Protobase's wordmark when it is `Protobase`), every browser tab of the admin app ends its title with it, the [installed app](installable-app.md)) is called by it, the [auth emails](email.md#protobases-own-mail)) name the app with it, and the platform's mailer sends them as it (the sender's display name). Default `PROTOBASE_APP_NAME`, when set, and `Protobase` otherwise, then without a display name.
87
+ - `appName` is the app's name: authenticator apps and passkey prompts show it, the admin app's sidebar shows it at the top beside the app's [icon](app-identity.md#the-icons)), else Protobase's mark (Protobase's wordmark when it is `Protobase`), every browser tab of the admin app ends its title with it, the [installed app](installable-app.md)) is called by it, the [auth emails](email.md#protobases-own-mail)) name the app with it, and the platform's mailer sends them as it (the sender's display name). `PROTOBASE_APP_NAME`, when set, overrides it; without either it is `Protobase`, then without a display name. See [App identity](app-identity.md)).
88
88
 
89
89
  ## First run
90
90
 
@@ -188,6 +188,7 @@ People add passkeys (Face ID, Touch ID, Windows Hello, a phone or a security key
188
188
 
189
189
  - A passkey is made for the app's passkey domain, its RP ID: the host of `BETTER_AUTH_URL` (`admin.example.com`), or the host of one of its [other origins](#several-origins) set with `passkeyDomain` or `PROTOBASE_PASSKEY_DOMAIN`. For local development, `http://localhost` works.
190
190
  - Each passkey keeps the RP ID it was made for (`passkey.rp_id`), so changing the passkey domain breaks none. Passkeys made before Protobase kept it count for the host of `BETTER_AUTH_URL`, which they were made for; renaming that host breaks them. The column is new in 0.10: the server refuses to start until the [migration](#migrations) that adds it is applied.
191
+ - A passkey's answer, for adding a passkey or signing in, must name the origin of `BETTER_AUTH_URL` or one of the [other origins](#several-origins) exactly. An origin listed only in `TRUSTED_ORIGINS`, such as a dev tunnel, cannot use passkeys: list it as one of the other origins instead.
191
192
  - On an app with several origins, every passkey works on each of them through [Related Origin Requests](https://passkeys.dev/docs/advanced/related-origins/) (Chrome and Edge 128, Safari 18, Firefox 152; at most 5 registrable domains).
192
193
  - A browser asks for the passkeys of one RP ID at a time. When people have passkeys for more than one of the app's hosts, `GET /api/auth/status` lists them as `passkeyDomains`, the passkey domain first, and the sign-in page adds "Use a passkey made for {host}" for each of the others. `GET /api/auth/passkey/generate-authenticate-options?rpId=<host>` asks for one of them.
193
194
  - A passkey sign-in asks for no second step: the passkey is something you have and something you are or know.
@@ -450,6 +451,10 @@ Their tokens are verified against that app's keys at `<issuer>/api/auth/jwks`; a
450
451
  An app moving from Supabase keeps its `supabase.auth` calls and its `@supabase/ssr` session checks: the app serves GoTrue's endpoints at `/auth/v1`, over the same Better Auth sign-in, so `createClient(<the app's origin>, <publishable key>)` signs in, refreshes, reads the user and signs out as on Supabase.
451
452
 
452
453
  - `signInWithPassword`, `signInWithOtp` then `verifyOtp({ email, token, type: 'email' })`, `signInWithOAuth` with one of the app's [sign-in providers](#sign-in-with-github) (PKCE, as `@supabase/ssr` uses, or the implicit flow), `refreshSession`, `getUser`, `getClaims`, `updateUser({ password, data })` and `signOut` work. Each goes through Better Auth's own endpoint, with its rate limits and the [sign-in policy](#sign-in-policy).
454
+ - The implicit flow is for an https `redirect_to` only. For http, including localhost, and custom schemes, use PKCE: supabase-js `flowType: 'pkce'`; `@supabase/ssr` already uses it.
455
+ - The sign-in must start at `/auth/v1/authorize` in the same browser: `/auth/v1/callback` hands a code or a session only at the end of a provider sign-in started there.
456
+ - The browser keeps no Protobase session afterwards: the app holds its own.
457
+ - A wildcard pattern in `TRUSTED_ORIGINS` lets implicit-flow tokens go to any https host it matches.
453
458
  - Addresses are proved with the emailed 6-digit code, never a link. `signUp({ email, password, options: { data } })` needs [open sign-up](#open-sign-up) and mails a sign-up code; `verifyOtp({ email, token, type: 'signup' })` makes the account, with `data` in the [user metadata column](#an-existing-users-table), and signs in. Until then there is no account and `signUp` answers no user. `resetPasswordForEmail` mails a sign-in code; `verifyOtp` with `type: 'recovery'` signs in, and `updateUser({ password })` sets the new password.
454
459
  - The access token is ES256, valid for an hour, with Supabase's claims: `sub`, `role: authenticated`, `aud: authenticated`, `email`, `app_metadata`, `user_metadata`, `aal`, `session_id`, issued by `<baseURL>/auth/v1`. Its keys are at `/auth/v1/.well-known/jwks.json`. It is apart from the EdDSA token of [Tokens and roles](#tokens-and-roles): neither is accepted for the other.
455
460
  - The refresh token is the Better Auth session's token. Each refresh gives the session a new one, so a refresh token works once, and signing out, a ban or a revoked session ends it.
@@ -125,7 +125,7 @@ One process, one port: Vite serves the admin app from `@protobase/ui`'s `src/app
125
125
 
126
126
  `defineConfig` from `@protobase/server` types it, and its `extends` merges other configs in (see [Extending a config](#extending-a-config)).
127
127
  - **Project UI:** the app imports `protobase.ui.tsx` from the project root, with hot reload, when it exists (see [Custom components](custom-components.md))): the same contract as the plugin `protobase build` makes of it, built into the dev page instead. Layout files are checked as they load, as `protobase build` checks them.
128
- - **Theme:** the page links `/protobase.theme.css`, which the dev server answers from the project's [theme](theme.md)), checked as the build checks it, on every request, so an edit shows on the next reload. It links `/protobase.favicon.svg` too, the project's [favicon](theme.md#logo-and-favicon)) or Protobase's.
128
+ - **Theme:** the page links `/protobase.theme.css`, which the dev server answers from the project's [theme](theme.md)), checked as the build checks it, on every request, so an edit shows on the next reload. It links `/protobase.favicon.svg` too, the project's [favicon](theme.md#logo-and-favicon)) or Protobase's, and `/protobase.apple-touch-icon.png`, which it answers with the PNG [icons](app-identity.md#the-icons)) the project has.
129
129
  - **Extensions:** `--extend <dir>` merges an extension in, its UI built into the dev page beside the project's, to try one out; its files reload like the project's.
130
130
  - **Hot reload:** server code, data configs, `ui.ts` views, layouts and `protobase.config.ts` are loaded through Vite's SSR module graph. A change inside the project (or, in this repository, in `packages/server`, `packages/query`, `packages/schema`) rebuilds the API on the next request without a restart; `/meta` and `X-Meta-Version` change, so open tabs refetch. The database pool survives reloads. Newly added `ui.ts` files appear after the next change inside the project.
131
131
 
@@ -183,6 +183,7 @@ dist/
183
183
  plugins/<extension>/ each --extend folder's protobase.ui.tsx, built as a plugin
184
184
  protobase.theme.css the project's theme, checked and minified; empty without one
185
185
  protobase.favicon.svg the project's favicon; Protobase's without one
186
+ protobase.*.png the project's PNG icons, the ones it has (see App identity)
186
187
  protobase.bundle.json the manifest
187
188
  ```
188
189
 
@@ -361,11 +362,11 @@ Serves the API of a bundle from `protobase build` and owns the process around it
361
362
  | `REQUEST_LOG` | `true` logs every request; default `false` |
362
363
  | `PROTOBASE_SMTP_URL` | the SMTP server for password-reset mail, emailed sign-in and two-factor codes and the app's own [email](email.md)), credential included: `smtp://user:password@host:587` (STARTTLS when offered) or `smtps://...:465`; without it they are off ([Password reset](auth.md#password-reset)), [Emailed sign-in codes](auth.md#emailed-sign-in-codes))) |
363
364
  | `PROTOBASE_MAIL_FROM` | the sender of that mail, a plain address such as `noreply@admin.example.com`; set with `PROTOBASE_SMTP_URL` or not at all |
364
- | `PROTOBASE_APP_NAME` | the app's name, such as `Property Finder`: what its auth emails, its sidebar, its browser tabs and the [installed app](installable-app.md)) call it, and the sender's display name of its mail ([`appName`](auth.md#configuration))) |
365
+ | `PROTOBASE_APP_NAME` | the app's name, such as `Property Finder`: what its auth emails, its sidebar, its browser tabs and the [installed app](installable-app.md)) call it, and the sender's display name of its mail, over [`appName`](auth.md#configuration)) |
365
366
  | `PROTOBASE_SIGN_IN_ISSUER`, `PROTOBASE_SIGN_IN_CLIENT_ID`, `PROTOBASE_SIGN_IN_CLIENT_SECRET` | an OpenID Connect provider people who have an account can sign in with; all three or none. `PROTOBASE_SIGN_IN_PROVIDER` and `PROTOBASE_SIGN_IN_NAME` are optional ([Platform sign-in provider](auth.md#platform-sign-in-provider))) |
366
367
  | `PROTOBASE_OPERATOR_ISSUER`, `PROTOBASE_OPERATOR_CLIENT_ID`, `PROTOBASE_OPERATOR_CLIENT_SECRET` | the OpenID Connect provider of the operator's staff, for [staff sign-in](auth.md#staff-sign-in)) as people of the app; all three or none. `PROTOBASE_OPERATOR_NAME` and `PROTOBASE_OPERATOR_GROUP` are optional ([Operator provider](auth.md#operator-provider))) |
367
368
  | `PROTOBASE_ORIGINS`, `PROTOBASE_PASSKEY_DOMAIN` | the other origins the app is served on, comma separated, and the host new passkeys are made for ([Several origins](auth.md#several-origins))) |
368
- | `PROTOBASE_CORS_ORIGINS` | other websites whose browser code may call the API, `*` or comma separated origins ([CORS](api.md#cors))) |
369
+ | `PROTOBASE_CORS_ORIGINS` | other websites whose browser code may call the API, `*` or comma separated http and https origins ([CORS](api.md#cors))) |
369
370
  | `PROTOBASE_ASSISTANT_URL`, `PROTOBASE_ASSISTANT_API_KEY`, `PROTOBASE_ASSISTANT_MODEL`, `PROTOBASE_ASSISTANT_BASE_URL` | the [assistant](assistant.md#which-backend)): a backend elsewhere, or the built-in one on OpenRouter or another OpenAI-compatible endpoint; without them there is none |
370
371
  | `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 |
371
372
  | `PROTOBASE_SENTRY_DSN` | the DSN of a Sentry-compatible error tracker the app's server and admin app send their errors to, after `options.errorReporting` ([Error reporting](api.md#error-reporting))); without it nothing is sent |
@@ -475,6 +476,21 @@ Turns a Supabase project's database into the project in the current directory, i
475
476
 
476
477
  Remove `supabase-import/` to import again. Signing in Supabase's users with Protobase's auth is not part of this command yet.
477
478
 
479
+ ## `mobile`
480
+
481
+ ```sh
482
+ protobase mobile run <ios|android> [--api <url>] [--target <id>] [--live] [--port 5173] [--extend <dir>]
483
+ protobase mobile open <ios|android> [--api <url>] [--extend <dir>]
484
+ ```
485
+
486
+ Builds the project in the current directory as an iOS or Android app with Capacitor, from the `mobile` section of its `protobase.config.ts`; without one it stops and says what to add. See [A mobile app](../guides/mobile-app.md)).
487
+
488
+ - It installs `@protobase/mobile`, of the CLI's version, which pins Capacitor and its plugins, with the section's `plugins` into `.protobase/mobile/` with npm, when that changed. It builds the app's files as [`build`](#build) does and keeps only `public/`, its `index.html` naming the API origin; writes `capacitor.config.json`, compiling in only the section's plugins; and generates the platform's native project again, replacing the last one.
489
+ - `--api` is the server the app calls, the project's auth `baseURL` by default: an http or https origin, plain http only to `localhost`, `127.0.0.1` and, on iOS, `[::1]`, or on Android `10.0.2.2`. An Android app calling `localhost` gets the port forwarded.
490
+ - `run` runs the app on `--target`, or asks for one. With `--live` it opens `protobase dev` on `localhost:--port` instead of its own files. `open` opens the native project in Xcode or Android Studio.
491
+ - npm and Capacitor get the CLI's environment without any variable named in the current directory's `.env*` files, and with `CI=true`, which keeps Capacitor's telemetry off.
492
+ - It prints the workspace, the API origin and the native fingerprint, which the app also sends in its user agent as `ProtobaseNative/<fingerprint>`: a hash of the `@protobase/mobile` version and the extra plugins' installed versions.
493
+
478
494
  ## `token`
479
495
 
480
496
  ```sh
@@ -266,7 +266,7 @@ export default defineUi({ shell: { actions: NotesButton, rightPanel: Notes } })
266
266
 
267
267
  When the app has an [assistant](assistant.md)), its button follows the project's actions and its dock the project's panel.
268
268
 
269
- `logo` replaces Protobase's logo at the top of the sidebar with the app's own. It gets `compact`, true when the sidebar shows only icons, so it draws a mark alone, `workspace`, the name of the user's organization that Protobase's logo shows under it, and `appName`, the app's [name](auth.md#configuration)), which Protobase's logo shows beside its mark (`ShellLogoProps`). Its colors follow the [theme](theme.md)), and a `dark:` class gives dark its own. When it throws, Protobase's logo shows instead. The tab's icon is [the favicon](theme.md#logo-and-favicon)).
269
+ `logo` replaces Protobase's logo at the top of the sidebar with the app's own. It gets `compact`, true when the sidebar shows only icons, so it draws a mark alone, `workspace`, the name of the user's organization that Protobase's logo shows under it, `appName`, the app's [name](auth.md#configuration)), which Protobase's logo shows beside its mark, and `appIcon`, the path of the project's own [icon](app-identity.md#the-icons)) when it has one (`ShellLogoProps`). Its colors follow the [theme](theme.md)), and a `dark:` class gives dark its own. When it throws, Protobase's logo shows instead. The tab's icon is [the favicon](theme.md#logo-and-favicon)).
270
270
 
271
271
  ```tsx
272
272
  import { defineUi, type ShellLogoProps } from '@protobase/ui'
@@ -12,7 +12,7 @@ An app sends mail through one SMTP server: Protobase's own mail ([password reset
12
12
  | --- | --- |
13
13
  | `PROTOBASE_SMTP_URL` | The SMTP server, credential included: `smtp://user:password@host:587` (STARTTLS when the server offers it) or `smtps://user:password@host:465` (TLS from the start). |
14
14
  | `PROTOBASE_MAIL_FROM` | The sender, a plain address such as `noreply@shop.example.com`. The client greets the server with its domain; a `?name=` on the URL overrides that. |
15
- | `PROTOBASE_APP_NAME` | Optional: the app's name, such as `Shop`, which mail clients show as the sender's name (`Shop <noreply@shop.example.com>`). [`createAuth`'s `appName`](auth.md#configuration)), when set, takes its place. Without either the sender has no name. |
15
+ | `PROTOBASE_APP_NAME` | Optional: the app's name, such as `Shop`, which mail clients show as the sender's name (`Shop <noreply@shop.example.com>`). It overrides [`createAuth`'s `appName`](auth.md#configuration)). Without either the sender has no name. |
16
16
 
17
17
  Set both or neither. One without the other, a URL that is not `smtp://` or `smtps://`, or a sender that is not a plain address stops the app at startup. Without them mail is off: password reset and emailed codes are not offered, a job's `mail` is `undefined`, and sending an app's email rejects.
18
18
 
@@ -6,7 +6,7 @@ The admin app installs as an app of its own on phones and computers, named for t
6
6
 
7
7
  Every app built with `protobase build` can be installed from the browser, as a Progressive Web App: Chrome and Edge offer **Install** in the address bar, Android's browsers **Add to home screen**, and Safari on iPhone and iPad **Share > Add to Home Screen**. The installed app opens in a window of its own, without the browser's toolbars, at the app's home page.
8
8
 
9
- There is nothing to set up. The app installs under its name, `appName` or `PROTOBASE_APP_NAME` (see [auth configuration](auth.md#configuration))), with its favicon, `protobase.favicon.svg` (see [Logo and favicon](theme.md#logo-and-favicon))), as its icon. Safari takes no SVG icon and shows a picture of the page on the home screen instead.
9
+ There is nothing to set up. The app installs under its name, `PROTOBASE_APP_NAME` or `appName`, with its favicon, `protobase.favicon.svg`, as its icon, and the colours of `app` in `protobase.config.ts` (see [App identity](app-identity.md))). Safari takes no SVG icon: give the project a `protobase.apple-touch-icon.png`, or it shows a picture of the page on the home screen instead.
10
10
 
11
11
  ## The manifest
12
12
 
@@ -20,10 +20,19 @@ The app's page links its web app manifest at `/api/manifest.webmanifest`, which
20
20
  "start_url": "/",
21
21
  "scope": "/",
22
22
  "display": "standalone",
23
- "icons": [{ "src": "/protobase.favicon.svg", "sizes": "any", "type": "image/svg+xml" }]
23
+ "theme_color": "#0d9488",
24
+ "background_color": "#ffffff",
25
+ "icons": [
26
+ { "src": "/protobase.favicon.svg", "sizes": "any", "type": "image/svg+xml" },
27
+ { "src": "/protobase.icon-192.png", "sizes": "192x192", "type": "image/png" },
28
+ { "src": "/protobase.icon-512.png", "sizes": "512x512", "type": "image/png" },
29
+ { "src": "/protobase.icon-maskable.png", "sizes": "512x512", "type": "image/png", "purpose": "maskable" }
30
+ ]
24
31
  }
25
32
  ```
26
33
 
34
+ The colours and each PNG are there only when the project has them.
35
+
27
36
  ## Without a network
28
37
 
29
38
  The data stays online: the installed app reads and writes through the API as the browser tab does, and nothing works offline. The page registers a service worker, `/protobase.sw.js` in the bundle's `public/`, which keeps only the app itself, so the app still opens without a network and says it cannot reach the server.
@@ -123,9 +123,9 @@ The list is `packages/ui/src/tokens.css`, and a test fails when one of its token
123
123
 
124
124
  ## Logo and favicon
125
125
 
126
- The sidebar shows Protobase's logo, its mark alone when the sidebar shows only icons. A project shows its own with `shell.logo` in `protobase.ui.tsx`, a component drawn in its place ([Shell slots](custom-components.md#shell-slots))); it draws with these tokens like the rest of the app.
126
+ The sidebar shows Protobase's logo, its mark alone when the sidebar shows only icons, or, for a project with its own favicon, that icon and the app's name ([App identity](app-identity.md))). A project draws something else with `shell.logo` in `protobase.ui.tsx`, a component drawn in its place ([Shell slots](custom-components.md#shell-slots))); it draws with these tokens like the rest of the app.
127
127
 
128
- The browser tab shows Protobase's mark. A project shows its own with a `protobase.favicon.svg` at its root, beside `protobase.theme.css`: the app's `index.html` links `/protobase.favicon.svg`, which `protobase build` writes to the bundle's `public/`, the project's file or Protobase's without one, and which `protobase dev` serves the same way. An SVG can follow the system's light or dark with a `prefers-color-scheme` media query inside it, as Protobase's does.
128
+ The browser tab shows Protobase's mark. A project shows its own with a `protobase.favicon.svg` at its root, beside `protobase.theme.css`: the app's `index.html` links `/protobase.favicon.svg`, which `protobase build` writes to the bundle's `public/`, the project's file or Protobase's without one, and which `protobase dev` serves the same way. An SVG can follow the system's light or dark with a `prefers-color-scheme` media query inside it, as Protobase's does. PNGs beside it serve the platforms that take no SVG, such as an iPhone's home screen ([App identity](app-identity.md#the-icons))).
129
129
 
130
130
  ## In a plugin
131
131