@protobase/cli 0.53.6 → 0.53.8
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.
- package/dist/cli/package.js +1 -1
- package/package.json +7 -7
- package/skills/protobase/references/features/sign-in-and-accounts.md +1 -0
- package/skills/protobase/references/guides/deploy.md +1 -1
- package/skills/protobase/references/guides/mobile-app.md +1 -0
- package/skills/protobase/references/reference/architecture.md +1 -1
- package/skills/protobase/references/reference/auth.md +18 -2
- package/skills/protobase/references/reference/blocks.md +1 -1
- package/skills/protobase/references/reference/config/sign-in.md +11 -0
package/dist/cli/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@protobase/cli",
|
|
3
|
-
"version": "0.53.
|
|
3
|
+
"version": "0.53.8",
|
|
4
4
|
"description": "The protobase command: scaffold, doctor, dev, build and serve a Protobase project.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -42,12 +42,12 @@
|
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@better-auth/core": "^1.7.12",
|
|
44
44
|
"@hono/node-server": "^2.1.3",
|
|
45
|
-
"@protobase/config": "0.53.
|
|
46
|
-
"@protobase/layout": "0.53.
|
|
47
|
-
"@protobase/query": "0.53.
|
|
48
|
-
"@protobase/schema": "0.53.
|
|
49
|
-
"@protobase/server": "0.53.
|
|
50
|
-
"@protobase/ui": "0.53.
|
|
45
|
+
"@protobase/config": "0.53.8",
|
|
46
|
+
"@protobase/layout": "0.53.8",
|
|
47
|
+
"@protobase/query": "0.53.8",
|
|
48
|
+
"@protobase/schema": "0.53.8",
|
|
49
|
+
"@protobase/server": "0.53.8",
|
|
50
|
+
"@protobase/ui": "0.53.8",
|
|
51
51
|
"@react-email/render": "^2.1.0",
|
|
52
52
|
"@scalar/hono-api-reference": "^0.12.10",
|
|
53
53
|
"@tailwindcss/vite": "^4.3.3",
|
|
@@ -14,6 +14,7 @@ Sign-in methods, users, roles, organizations and tokens.
|
|
|
14
14
|
- [Leaked passwords](../reference/auth.md#leaked-passwords): New passwords that appear in a known data breach are refused, when the app turns the check on.
|
|
15
15
|
- [Emailed sign-in codes](../reference/auth.md#emailed-sign-in-codes): People sign in with a code sent to their email. An address with no account is emailed that it has none, so the person tries the one they signed up with. An app can have the sign-in page lead with the code and put the password behind "Use a password".
|
|
16
16
|
- [Changing the address](../reference/auth.md#changing-the-address): People move their account to a new email address from the account page, once they enter the code sent there.
|
|
17
|
+
- [Deleting the account](../reference/auth.md#deleting-the-account): People delete their own account from the account page, after confirming it, in the web app and the mobile app. On by default; an app whose accounts an organization's admins manage turns it off.
|
|
17
18
|
- [Open sign-up](../reference/auth.md#open-sign-up): Anyone can create an account after confirming an emailed code.
|
|
18
19
|
- [Passkeys](../reference/auth.md#passkeys): People sign in with their device's face or fingerprint unlock, or with a security key.
|
|
19
20
|
- [Two-factor authentication](../reference/auth.md#two-factor-authentication): A second step with an authenticator app, backup codes or emailed codes.
|
|
@@ -41,7 +41,7 @@ Every release pushes two public images to GitHub's registry, for `linux/amd64` a
|
|
|
41
41
|
| Image | What it holds |
|
|
42
42
|
| --- | --- |
|
|
43
43
|
| `ghcr.io/prototeamhq/protobase:<version>` | the serve runtime, compiled with Bun into `/opt/protobase/protobase-serve`, which serves the API of the bundle mounted at `/app` (and, given the folder, its app too, see [a self-hosted image](#a-self-hosted-image)); the release's prebuilt admin app at `/opt/protobase/shell`, which a host may serve for the bundle's [shell paths](../reference/plugins.md#the-shell) instead of the bundle's copy; Bun for its healthcheck on `/health`, and the C++ runtime native add-ons link. It runs as `nonroot` (65532) and writes nothing, so it runs with a read-only root filesystem |
|
|
44
|
-
| `ghcr.io/prototeamhq/protobase-dev:<version>` | Bun, the `protobase` command of that version installed globally (in `/opt/protobase/cli`, on `PATH`), and the presets at `/opt/protobase/presets/<name>` (`erp`, `real-estate`, `scratch`), with the dependencies they share installed in `/workspace` and Bun's cache in `/opt/bun-cache`. The global `protobase` builds a bundled project with nothing installed and hands a locked one over to the CLI it installed (see [Bundled and locked projects](../reference/versioning.md#bundled-and-locked-projects)). It has no Node: the presets' scripts and the `protobase` command run on Bun. It runs as `bun` (1000) |
|
|
44
|
+
| `ghcr.io/prototeamhq/protobase-dev:<version>` | Bun, the `protobase` command of that version installed globally (in `/opt/protobase/cli`, on `PATH`), and the presets at `/opt/protobase/presets/<name>` (`erp`, `property-portal`, `real-estate`, `scratch`), with the dependencies they share installed in `/workspace` and Bun's cache in `/opt/bun-cache`. The global `protobase` builds a bundled project with nothing installed and hands a locked one over to the CLI it installed (see [Bundled and locked projects](../reference/versioning.md#bundled-and-locked-projects)). It has no Node: the presets' scripts and the `protobase` command run on Bun. It runs as `bun` (1000) |
|
|
45
45
|
|
|
46
46
|
```sh
|
|
47
47
|
docker run -v "$PWD/dist:/app:ro" -p 127.0.0.1:8787:8787 -e DATABASE_URL -e PROTOBASE_URL -e PROTOBASE_SECRET ghcr.io/prototeamhq/protobase:"$VERSION" # the version of the @protobase/cli that built dist/
|
|
@@ -127,4 +127,5 @@ You submit the app under your own developer account, on both stores: Apple rejec
|
|
|
127
127
|
- **What may change without a store release:** the app's files, which a later Protobase release can update over the air: the shell, UI plugins, theme, in-app logo and copy, and fixes and features within the app's purpose. Apple allows downloaded interpreted code that does not change the app's primary purpose ([Apple Developer Program License Agreement](https://developer.apple.com/support/terms/apple-developer-program-license-agreement/) 3.3.1(B)), and Google Play allows JavaScript in a WebView ([Device and Network Abuse](https://support.google.com/googleplay/android-developer/answer/9888379)).
|
|
128
128
|
- **What needs a store release:** native code, Capacitor or plugin changes (`mobile.plugins`), permissions, the app's name, its home-screen icon and its splash screen.
|
|
129
129
|
- **Big new features** still go through Apple's review with a store release, even when they could ship over the air: Apple asks that an app's features be documented and reviewed, none hidden (App Review Guidelines 2.3.1 and 2.5.19).
|
|
130
|
+
- **Account deletion is built in:** Apple requires an app that lets people create an account to let them delete it in the app too (App Review Guidelines 5.1.1(v)). The account page's [Delete account](../reference/auth.md#deleting-the-account) does that, on by default; keep `auth.accountDeletion` on for an app you submit.
|
|
130
131
|
- **A plain WebView of an admin app risks rejection:** Apple expects an app to be more than a repackaged website (4.2). Native touches help, such as push notifications, sharing, the camera or biometric sign-in, through `mobile.plugins`.
|
|
@@ -23,7 +23,7 @@ A Bun workspace of npm packages under the `@protobase` scope, in `packages/<name
|
|
|
23
23
|
| `@protobase/presets` | `packages/presets` | none: private, `bun run presets:write` writes a project per preset | Bun | none; each preset depends on the `@protobase` packages of the major it is written at, locked at that version |
|
|
24
24
|
| `tests/apps/*` | | none | any | `@protobase/*` entry points only |
|
|
25
25
|
|
|
26
|
-
The presets are written from `tests/apps/erp`, `tests/apps/real-estate` and `tests/apps/scratch` (from scratch) by `bun run presets:write <version> <dir>`, run from a clone of this repository; `npm create protobase` (`packages/create-protobase`) writes them too, without a lockfile. Each is a standalone copy with the `@protobase` packages in `devDependencies`, so an app made from it is [bundled](versioning.md#bundles-and-runtimes) and runs on the CLI's own copies, in the caret range of `<version>`, `^x.y.z`, so an app takes the updates semver calls compatible: within that major from 1.0 on, and within that minor below 1.0, where a minor may break, and its own `bun.lock` at exactly `<version>`. Its `tsconfig.json` extends `.protobase/tsconfig.json`, which [`protobase types`](cli.md#types) writes, as `dev`, `build` and its `typecheck` and `test` scripts do first, and its database scripts run with [`protobase run`](cli.md#run). The examples in this repository list the packages in `dependencies`, locked to the workspace's, and their `tsconfig.json` extends nothing: Vite reads it when it transforms their files, and would fail before the file it extends is written. The three declare the same dependencies, so one `node_modules` fits them all, and their `db:migrate` (the auth schema's migrations included), `typecheck` and `test` scripts take their settings from the environment, or a `.env` beside them, and reach nothing outside the project.
|
|
26
|
+
The presets are written from `tests/apps/erp`, `tests/apps/property-portal`, `tests/apps/real-estate` and `tests/apps/scratch` (from scratch) by `bun run presets:write <version> <dir>`, run from a clone of this repository; `npm create protobase` (`packages/create-protobase`) writes them too, without a lockfile. Each is a standalone copy with the `@protobase` packages in `devDependencies`, so an app made from it is [bundled](versioning.md#bundles-and-runtimes) and runs on the CLI's own copies, in the caret range of `<version>`, `^x.y.z`, so an app takes the updates semver calls compatible: within that major from 1.0 on, and within that minor below 1.0, where a minor may break, and its own `bun.lock` at exactly `<version>`. Its `tsconfig.json` extends `.protobase/tsconfig.json`, which [`protobase types`](cli.md#types) writes, as `dev`, `build` and its `typecheck` and `test` scripts do first, and its database scripts run with [`protobase run`](cli.md#run). The examples in this repository list the packages in `dependencies`, locked to the workspace's, and their `tsconfig.json` extends nothing: Vite reads it when it transforms their files, and would fail before the file it extends is written. The three declare the same dependencies, so one `node_modules` fits them all, and their `db:migrate` (the auth schema's migrations included), `typecheck` and `test` scripts take their settings from the environment, or a `.env` beside them, and reach nothing outside the project.
|
|
27
27
|
|
|
28
28
|
The JSX runtime belongs to `@protobase/layout` because a layout file names one package in `@jsxImportSource @protobase/layout`, and TypeScript and Vite look up `jsx-runtime` and `jsx-dev-runtime` under it. Each field type is split along the same lines: its Zod builder is `packages/schema/src/fields/<type>.ts` and its SQL parameter conversion `packages/query/src/fields/<type>.ts`.
|
|
29
29
|
|
|
@@ -75,6 +75,7 @@ The store's migrations make the user table only when it is missing, and add each
|
|
|
75
75
|
| `PROTOBASE_TRUSTED_ORIGINS` | extra comma separated origins, the default of `auth.trustedOrigins`; a dev tunnel needs its exact host here, such as `https://my-tunnel.trycloudflare.com`, since none is trusted by default; an entry with `*` trusts every host it matches |
|
|
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 the app's `url` |
|
|
78
|
+
| `PROTOBASE_LOCKED_ACCOUNTS` | the addresses of accounts no one may take over, comma separated, passed by the platform, such as a demo's shared account: their address, password, passkeys, two-factor authentication and linked accounts stay as they are, from any endpoint or host call, which fails with `403 ACCOUNT_LOCKED`, and they cannot be deleted |
|
|
78
79
|
| `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
80
|
| `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
81
|
| `PROTOBASE_APP_NAME` | the app's name, passed by the platform: it overrides `name` |
|
|
@@ -172,12 +173,12 @@ Everyone signed in has an account page at `/-/account`, which "Account" in the u
|
|
|
172
173
|
|
|
173
174
|
| Tab | Address | Blocks |
|
|
174
175
|
| --- | --- | --- |
|
|
175
|
-
| Profile | `/-/account` | `Profile` |
|
|
176
|
+
| Profile | `/-/account` | `Profile`, `DeleteAccount` |
|
|
176
177
|
| Sign-in & security | `/-/account/security` | `Password`, `Passkeys`, `TwoFactor`, `ConnectedAccounts` |
|
|
177
178
|
| Devices | `/-/account/devices` | `Devices` |
|
|
178
179
|
| Connected apps | `/-/account/apps` | `ConnectedApps` |
|
|
179
180
|
|
|
180
|
-
A tab whose blocks all leave themselves out is not offered, such as Connected apps in an app without [MCP](#oauth-for-mcp-clients).
|
|
181
|
+
A tab whose blocks all leave themselves out is not offered, such as Connected apps in an app without [MCP](#oauth-for-mcp-clients). `DeleteAccount` leaves itself out when the app turns [account deletion](#deleting-the-account) off.
|
|
181
182
|
|
|
182
183
|
To change it, export a page named `account` of your own: it replaces the standard one at `/-/account`, and is neither at `/account` nor in the sidebar. `accountTabs` holds the standard tabs by name (`profile`, `security`, `devices`, `apps`), so the page lists the ones it keeps beside its own:
|
|
183
184
|
|
|
@@ -257,6 +258,21 @@ On the [account page](#account-page), the `Password` block does both: with a pas
|
|
|
257
258
|
|
|
258
259
|
The [account page](#account-page)'s Devices tab lists the sessions with this one first and marked, a Sign out on each other one and Sign out of all other devices. It names each by its browser and system from the user agent, and a staff session by the operator alone, such as "Protobase staff" with when it signed in and until when, never the staff member.
|
|
259
260
|
|
|
261
|
+
## Deleting the account
|
|
262
|
+
|
|
263
|
+
Everyone signed in can delete their own account: the account page's Profile tab ends with "Delete account", which asks them to confirm in a dialog, with their password when the account has one. It is on by default, since an app store requires an app that makes accounts to let people delete them in the app, and `accountDeletion: false` turns it off, for an app whose accounts an organization's admins manage:
|
|
264
|
+
|
|
265
|
+
```ts
|
|
266
|
+
auth: { accountDeletion: false }
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
It is Better Auth's own deletion, `POST /api/auth/delete-user` with `{ password }`, which the client has as `session.deleteAccount(password?)` and `GET /api/auth/status` offers as `"accountDeletion": true`. It deletes the user with their sessions, sign-in methods and linked accounts, as an admin's [removal](#users-page) does, along with what the app keeps of them elsewhere, such as their [devices for push](../guides/push-notifications.md), and their [MCP clients](#oauth-for-mcp-clients)' grants; the app's own records that point at the user stay. This device is signed out, and the address can no longer sign in.
|
|
270
|
+
|
|
271
|
+
- Without a password, as for someone who signs in with [emailed codes](#emailed-sign-in-codes) or a passkey, the session must have signed in within the last day, else it is `SESSION_EXPIRED`, which the page shows as "sign out and sign in again first". A wrong password is `INVALID_PASSWORD`.
|
|
272
|
+
- The last active admin cannot delete themselves (`400 LAST_ADMIN`), nor can an account in `PROTOBASE_LOCKED_ACCOUNTS` (`403 ACCOUNT_LOCKED`); nothing is deleted then.
|
|
273
|
+
- A [staff session](#staff-sign-in) cannot delete the account (`STAFF_CANNOT_CHANGE_SIGN_IN`).
|
|
274
|
+
- With `accountDeletion: false` the endpoint answers `404` and the page offers nothing. Better Auth's emailed confirmation link (`/delete-user/callback`) is always off.
|
|
275
|
+
|
|
260
276
|
## Leaked passwords
|
|
261
277
|
|
|
262
278
|
`leakedPasswords: true` refuses a new password that appears in a known data breach. It is off by default, since it sends a request to an outside service each time a password is set.
|
|
@@ -390,7 +390,7 @@ Everyone who can sign in, for admins: find them by address, tick their roles, bl
|
|
|
390
390
|
|
|
391
391
|
### Account blocks
|
|
392
392
|
|
|
393
|
-
`Profile`, `Password`, `Passkeys`, `TwoFactor`, `ConnectedAccounts`, `Devices` and `
|
|
393
|
+
`Profile`, `Password`, `Passkeys`, `TwoFactor`, `ConnectedAccounts`, `Devices`, `ConnectedApps` and `DeleteAccount` are the parts of the signed-in person's own account: their name and address (which they can change, the address with an [emailed code](auth.md#changing-the-address)), their [password](auth.md#name-password-and-devices) (changed, or set for the first time), their [passkeys](auth.md#passkeys), [two-factor authentication](auth.md#two-factor-authentication), the sign-in providers they linked, the devices signed in as them (each one but this one to [sign out](auth.md#name-password-and-devices)), the apps such as MCP clients they allowed to act as them, below the app's MCP address to connect one, and the [deletion of their account](auth.md#deleting-the-account). Each takes no props or children, reads its own data, and leaves itself out where it does not apply: `ConnectedAccounts` without an OAuth sign-in provider, `ConnectedApps` without MCP, `DeleteAccount` with `auth.accountDeletion: false`. They act on whoever is signed in, so they are allowed on the page named `account` alone; anywhere else stops the config. That page is the [account page](auth.md#account-page) at `/-/account`, which `accountTabs` helps build from the standard tabs.
|
|
394
394
|
|
|
395
395
|
```tsx
|
|
396
396
|
export const account = page('account',
|
|
@@ -198,6 +198,17 @@ Refuses a new password that appears in a known data breach, by Have I Been Pwned
|
|
|
198
198
|
export default defineConfig({ auth: { leakedPasswords: true } })
|
|
199
199
|
```
|
|
200
200
|
|
|
201
|
+
## auth.accountDeletion
|
|
202
|
+
|
|
203
|
+
- **Type:** `boolean`
|
|
204
|
+
- **Default:** `true`
|
|
205
|
+
|
|
206
|
+
Lets the signed-in person delete their own account from the account page, as app stores require of an app that makes accounts. `false` turns it off, for an app whose accounts an organization's admins manage. See [Deleting the account](../auth.md#deleting-the-account).
|
|
207
|
+
|
|
208
|
+
```ts
|
|
209
|
+
export default defineConfig({ auth: { accountDeletion: false } })
|
|
210
|
+
```
|
|
211
|
+
|
|
201
212
|
## auth.users
|
|
202
213
|
|
|
203
214
|
- **Type:** `{ table?: string; columns?: Record<string, string>; metadata?: string }`
|