@protobase/cli 0.96.9 → 0.96.11

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.
@@ -1,4 +1,4 @@
1
1
  //#region package.json
2
- var version = "0.96.9";
2
+ var version = "0.96.11";
3
3
  //#endregion
4
4
  export { version };
package/dist/serve/env.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { readTrustedProxies } from "./client-address.js";
2
2
  import { readDbConnections } from "@protobase/server";
3
+ import { isIP } from "node:net";
3
4
  import { readSigningKey } from "@protobase/server/mobile-release";
4
5
  //#region src/serve/env.ts
5
6
  const defaultPort = 8787;
@@ -12,12 +13,15 @@ const readBoolean = (env, name, fallback) => {
12
13
  const readServeEnv = (env) => {
13
14
  const port = env.PORT ? Number(env.PORT) : defaultPort;
14
15
  if (!Number.isInteger(port) || port < 0 || port > 65535) throw new Error(`PORT must be a port number, not "${env.PORT}"`);
16
+ const host = env.PROTOBASE_HOST || void 0;
17
+ if (host && isIP(host) === 0) throw new Error(`PROTOBASE_HOST must be an IP address, such as 127.0.0.1, not "${host}"`);
15
18
  const minutes = env.PROTOBASE_FILES_CLEANUP_MINUTES ? Number(env.PROTOBASE_FILES_CLEANUP_MINUTES) : 60;
16
19
  if (!Number.isInteger(minutes) || minutes < 0) throw new Error(`PROTOBASE_FILES_CLEANUP_MINUTES must be a whole number of minutes, not "${env.PROTOBASE_FILES_CLEANUP_MINUTES}"`);
17
20
  const mobileSigningKey = readSigningKey(env);
18
21
  const connections = env.PROTOBASE_DB_CONNECTIONS ? readDbConnections(env) : void 0;
19
22
  return {
20
23
  port,
24
+ ...host && { host },
21
25
  databaseUrl: env.DATABASE_URL || void 0,
22
26
  ...connections && { dbConnections: connections },
23
27
  requestLog: readBoolean(env, "REQUEST_LOG", false),
@@ -12,9 +12,9 @@ import pg from "pg";
12
12
  import { assistantSettings, authStoreTables, backgroundSettled, checkAi, checkAuthSchema, checkCalls, checkChanges, checkChannelSends, checkComments, checkComputed, checkDerived, checkJobsSchema, checkNotificationsSchema, checkQueryRunner, checkRealtimeRelay, checkResourcesOutsideAuthStore, checkStatusSchema, checkUserTablesSchema, checkWebhooksSchema, checkWorkflowsSchema, configExports, createFileCleanup, relayed, sqlSends, startJobs } from "@protobase/server";
13
13
  import { createAdaptorServer, upgradeWebSocket } from "@hono/node-server";
14
14
  //#region src/serve/lifecycle.ts
15
- const listen = (server, port) => new Promise((resolve, reject) => {
15
+ const listen = (server, port, host) => new Promise((resolve, reject) => {
16
16
  server.once("error", reject);
17
- server.listen(port, () => {
17
+ server.listen(port, host, () => {
18
18
  server.off("error", reject);
19
19
  resolve();
20
20
  });
@@ -87,7 +87,7 @@ const startServe = async ({ config, env, openDb = (url) => openAppDatabase(pg, u
87
87
  overrideGlobalObjects: false,
88
88
  websocket: { server: sockets }
89
89
  });
90
- await listen(server, env.port).catch(async (error) => {
90
+ await listen(server, env.port, env.host).catch(async (error) => {
91
91
  await jobs?.stop();
92
92
  throw error;
93
93
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@protobase/cli",
3
- "version": "0.96.9",
3
+ "version": "0.96.11",
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.96.9",
47
- "@protobase/layout": "0.96.9",
48
- "@protobase/query": "0.96.9",
49
- "@protobase/schema": "0.96.9",
50
- "@protobase/server": "0.96.9",
51
- "@protobase/ui": "0.96.9",
52
- "@protobase/workflows": "0.96.9",
46
+ "@protobase/config": "0.96.11",
47
+ "@protobase/layout": "0.96.11",
48
+ "@protobase/query": "0.96.11",
49
+ "@protobase/schema": "0.96.11",
50
+ "@protobase/server": "0.96.11",
51
+ "@protobase/ui": "0.96.11",
52
+ "@protobase/workflows": "0.96.11",
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",
@@ -18,7 +18,7 @@ Develop, build and run an app, on servers, in containers and on phones.
18
18
  - [Source maps](../reference/cli.md#source-maps): The bundle and plugins can carry source maps with debug ids, for an error tracker to read browser stack frames.
19
19
  - [Extensions](../reference/cli.md#extensions): A host adds its own widgets, dock assistant tools (`assistant/tools.ts`) and MCP tools (`mcp/tools.ts`) to every app it builds.
20
20
  - [Native packages](../reference/cli.md#native-packages): npm packages with native add-ons are bundled for Linux.
21
- - [Serve runtime](../reference/cli.md#serve): Runs a bundle, set by environment variables, with a health check, startup checks, jobs and a clean shutdown.
21
+ - [Serve runtime](../reference/cli.md#serve): Runs a bundle, set by environment variables, with a health check, startup checks, jobs and a clean shutdown. `PROTOBASE_HOST=127.0.0.1` keeps it to this computer.
22
22
  - [Host module list](../reference/cli.md#the-config-module): Each release of `@protobase/cli` carries the modules its runtime supplies to a bundle as `@protobase/cli/host-modules.json`, for a host to check a bundle's imports against the version that serves it.
23
23
  - [Migrations at update time](../guides/deploy.md#migrations): The bundle carries the project's migrations, and the runtime applies them in one transaction before the new version serves.
24
24
  - [Single-file runtime](../reference/cli.md#build-serve): The runtime as one file, so a host needs only Bun and that file.
@@ -4,6 +4,7 @@
4
4
 
5
5
  Start a new app, or an admin over an existing Postgres database, and keep the config in step with it.
6
6
 
7
+ - [Try it on Windows](../getting-started.md#try-it-on-windows): One line in the Run box or a terminal starts a local Protobase with workflows on and a sample workflow, with nothing installed, and one folder to delete afterwards.
7
8
  - [Project starter](../getting-started.md#start-an-app): `npm create protobase` (also `bun create` and `pnpm create`) starts a new app from the scratch, automations (workflows on), ERP, property portal or real estate preset, with its own Postgres in Docker for development, and prints the next steps. Each preset has an `AGENTS.md` with rules for coding agents.
8
9
  - [Start on an existing database](../getting-started.md#on-an-existing-database): `npm create protobase <database-url>` makes a project on a Postgres database you already have and asks which of its tables become resources, only reading the database.
9
10
  - [Example apps](../getting-started.md#run-the-erp-example): Seeded example apps on Postgres: an ERP, real estate property management and a public property portal.
@@ -8,6 +8,16 @@ Protobase is a config-driven admin panel framework for existing Postgres databas
8
8
 
9
9
  An app's own React code, its components, field types and actions, is a [plugin](reference/plugins.md): built on its own against a plugin API that Protobase's releases keep, and loaded by the admin app when it starts. Protobase maintains the admin app, the API and the server, and a plugin keeps working as the app moves to newer releases, with their fixes and features, without changes of its own. Below 1.0 a new minor version may still change the config, and the bundle is built again for it; the plugins' code stays as it is (see [Who maintains what](reference/plugins.md#who-maintains-what)).
10
10
 
11
+ ## Try it on Windows
12
+
13
+ To see whether Protobase is of use before setting anything up, paste this line into the Run box (Win+R), a Command Prompt or PowerShell:
14
+
15
+ ```
16
+ powershell -c "irm https://docs.protobase.net/try.ps1|iex"
17
+ ```
18
+
19
+ It downloads `protobase-try.exe` from the latest release, about 45 MB, and PostgreSQL 18, about 40 MB, once, and starts the [automations](#start-an-app) preset with [workflows](reference/workflows.md) on, on this computer alone. It prints the address, `http://localhost:3000` unless that port is taken, and an admin's email and password, adds a sample workflow, "Say hello", and opens the browser. Nothing is installed and nothing needs Git, Node or Bun: the program, the database and the app's files stay in `%LOCALAPPDATA%\Protobase\automations`, with the password in `sign-in.txt` there. Ctrl+C or closing the window stops it; the line starts it again, and takes the newer program when a release is out. To remove everything, stop it and delete that folder. It is a trial of a finished app, not a project to change: [Start an app](#start-an-app) makes one.
20
+
11
21
  ## Start an app
12
22
 
13
23
  `npm create protobase my-app` asks which preset to start from, scratch (the default), automations (scratch with [workflows](reference/workflows.md) on), the ERP, the property portal or real estate, writes the project into `my-app`, with the `@protobase` packages in `devDependencies` at the caret range of the latest release, so it is [bundled](reference/versioning.md#bundled-and-locked-projects): dev, the build and its scripts run the CLI's own copies, and a newer CLI in that range updates it with no change to its files. It prints the next steps. Without a folder it asks for one too. `--preset <name>` picks the preset without asking; without a terminal it takes scratch. `bun create protobase` and `pnpm create protobase` do the same, and take `--preset` without the `--` that npm needs. It needs Node 22.12 or later. Each preset has an `AGENTS.md` with the rules for a coding agent that changes the app, such as a new migration file for every schema change.
@@ -155,4 +165,4 @@ bun run --cwd tests/apps/property-portal dev # http://localhost:517
155
165
  | `bun run release --dry-run` | the next version and its changelog, from the commits since the last release (see [Versioning](reference/versioning.md)) |
156
166
  | `bun run docs:check` | opens every page of the built site in Chromium and fails on console errors and failed requests; `BASE=https://docs.protobase.net` checks the live site |
157
167
 
158
- Each public import is a package in `packages/` (`@protobase/schema`, `layout`, `query`, `client`, `ui`, `server`, `config` for `protobase.config.ts`, `mobile` for `protobase mobile`, and `cli` for the `protobase` command); `packages/presets` writes the projects a new app starts from and is not published; `packages/create-protobase` is `npm create protobase`, with every preset. See [Architecture](reference/architecture.md) for the layout and import rules.
168
+ Each public import is a package in `packages/` (`@protobase/schema`, `layout`, `query`, `client`, `ui`, `server`, `config` for `protobase.config.ts`, `mobile` for `protobase mobile`, and `cli` for the `protobase` command); `packages/presets` writes the projects a new app starts from and is not published; `packages/try` builds `protobase-try.exe` for [Try it on Windows](#try-it-on-windows) and is not published either; `packages/create-protobase` is `npm create protobase`, with every preset. See [Architecture](reference/architecture.md) for the layout and import rules.
@@ -426,6 +426,7 @@ Serves the API of a bundle from `protobase build` and owns the process around it
426
426
  | `DATABASE_URL` | the API's pool (Kysely over `pg`, 10 connections) |
427
427
  | `PROTOBASE_DB_CONNECTIONS` | the connections that pool opens, such as the database's limit for the app; default 10. Sign-in's store shares them. [API functions](../guides/api-functions.md) and [jobs](jobs.md) hold at most one less, so a long import leaves a connection to page and API requests; those with [`longQueries`](../guides/api-functions.md#long-queries) take theirs from one more connection, kept for them. A query waits at most 2 seconds for a free connection, then fails with `503 connections-busy` ([Safety](api.md#safety)); a new connection may take up to 30 seconds to open, such as while a database that scaled to zero wakes |
428
428
  | `PORT` | default 8787 |
429
+ | `PROTOBASE_HOST` | the IP address the server listens on, such as `127.0.0.1` so only this computer reaches it; default every interface |
429
430
  | `REQUEST_LOG` | `true` logs every request; default `false` |
430
431
  | `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 required, `?requireTLS=false` sends in plaintext, see [Email](email.md#configuration)) or `smtps://...:465`; without it they are off ([Password reset](auth.md#password-reset), [Emailed sign-in codes](auth.md#emailed-sign-in-codes)) |
431
432
  | `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 |
@@ -4,7 +4,7 @@
4
4
 
5
5
  How Protobase is versioned and released, the commit convention behind it, bundled and locked projects, and which bundles a serve runtime runs.
6
6
 
7
- Protobase follows [semantic versioning](https://semver.org). Every push to `main` that holds a fix, a feature or a breaking change is released: the pushed commit is tagged `v<version>`, and a [GitHub release](https://github.com/PrototeamHQ/protobase/releases) of that tag holds the release's changes. Every `@protobase` package is then published to npm at that version. A release adds no commit to `main`: a release's version is its tag, not a `package.json` field, so the version in the repository's `package.json` files is not bumped. `CHANGELOG.md` lists only the releases from before releases stopped committing.
7
+ Protobase follows [semantic versioning](https://semver.org). Every push to `main` that holds a fix, a feature or a breaking change is released: the pushed commit is tagged `v<version>`, and a [GitHub release](https://github.com/PrototeamHQ/protobase/releases) of that tag holds the release's changes, and `protobase-try.zip` with `protobase-try.version`, the Windows program behind [Try it on Windows](../getting-started.md#try-it-on-windows). Every `@protobase` package is then published to npm at that version. A release adds no commit to `main`: a release's version is its tag, not a `package.json` field, so the version in the repository's `package.json` files is not bumped. `CHANGELOG.md` lists only the releases from before releases stopped committing.
8
8
 
9
9
  ## Versions below 1.0
10
10