Browse documentation

Node configuration

Orez accepts the same core settings from orez.config.ts, CLI flags, and startZeroLite(). Configuration-file values override defaults, and CLI values override the file.

import { defineConfig } from 'orez'

export default defineConfig({
  backend: 'pglite',
  dataDir: '.orez',
  migrations: './db/migrations',
  seed: './db/seed.sql',
  zeroMutateUrl: 'http://localhost:3000/api/zero/push',
  zeroQueryUrl: 'http://localhost:3000/api/zero/pull',
  onHealthy: 'echo "Zero is ready"',
})

Orez searches the current directory for orez.config.ts, .js, then .mjs. TypeScript configuration requires Bun or Node 22.6 and newer.

Runtime and endpoints

Config keyCLI flagCLI defaultMeaning
backend--backendpglitepglite or postgres
dataDir--data-dir.orezPersistent Orez state
pgPort--pg-port6434PostgreSQL or proxy port
zeroPort--zero-port5849Public zero-cache port
adminPort--admin-port6477Admin dashboard port
pgUser--pg-useruserLocal PostgreSQL user
pgPassword--pg-passwordpasswordLocal PostgreSQL password
logLevel--log-levelwarnerror, warn, info, or debug

Ports move upward when occupied. The programmatic runner returns the resolved pgPort and zeroPort.

Raw startZeroLite() defaults adminPort to 0. The CLI supplies 6477 and starts the dashboard. Set --disable-admin to turn the CLI dashboard off.

Schema and lifecycle

Config keyCLI flagDefaultMeaning
migrations / migrationsDir--migrationsnoneSQL migration directory
seed / seedFile--seedsrc/database/seed.sql if presentOptional seed SQL
onDbReady--on-db-readynoneHook after database setup, before zero-cache
onHealthy--on-healthynoneHook after the entire stack is healthy
zeroPublicationsconfig onlymanaged defaultComma-separated ZERO_APP_PUBLICATIONS value
zeroMutateUrlconfig or envnoneZERO_MUTATE_URL passed to zero-cache
zeroQueryUrlconfig or envnoneZERO_QUERY_URL passed to zero-cache

A hook may be a shell-command string or, through configuration and the API, an async callback. onDbReady receives database connection environment variables and runs before change tracking is refreshed and zero-cache starts.

PGlite and SQLite controls

Config keyCLI flagDefaultMeaning
forceWasmSqlite--force-wasm-sqlitefalseRequire the bedrock SQLite WASM adapter
disableWasmSqlite--disable-wasm-sqlitefalseRequire Zero’s native SQLite addon
useWorkerThreadsinverse of --no-worker-threadstrueRun PGlite outside the main thread
singleDb--single-dbfalseShare one PGlite instance across three database names
ephemeral--ephemeralfalseIn-memory PGlite and per-run replica cache
readReplicas--read-replicas0Number of in-memory PGlite read replicas
pgliteOptionsconfig/API only{}Additional PGlite constructor options
checkpointIntervalMs--checkpoint-interval in seconds300000PGlite WAL checkpoint interval; 0 disables it

readReplicas belongs to the multi-instance PGlite worker layout and cannot be combined with singleDb.

Logging and optional services

Config keyCLI flagDefaultMeaning
maxLogFileSize--max-log-size in MB2097152 bytesPer-file rotation threshold
disableDiskLogs--disable-disk-logsfalseKeep admin logs in memory only
s3--s3falseStart local S3-compatible storage
s3Port--s3-port9200Local S3 port
skipZeroCache--skip-zero-cachefalseRun only the PGlite database and proxy

s3 and s3Port are available through the CLI, config file, and Vite plugin. The standalone API uses startS3Local() from orez/s3.

Environment variables

OREZ_BACKEND=postgres and OREZ_LOG_LEVEL=debug provide simple global overrides. Existing ZERO_* variables are forwarded to zero-cache, including authentication and application settings. Orez manages and overwrites the database URLs, replica path, Zero port, and process NODE_ENV because those values describe the stack it started.

The runner supplies conservative development defaults including one sync worker and a disabled Zero query planner. Environment variables can override most Zero defaults. The managed connection values always follow the actual Orez ports and data directory.