Skip to main content

Local Mode with PGLite

Steward includes a PGLite backend — full PostgreSQL running in-process via WebAssembly. This means you can run a complete Steward instance with zero external dependencies: no Postgres server, no Redis, no Docker. This is ideal for:
  • Local development — spin up Steward in seconds, no database setup
  • Desktop apps — Steward as an embedded sidecar (e.g., Electrobun apps)
  • Testing — in-memory mode for fast, isolated tests
  • Offline use — full functionality without network connectivity

Starting Local Mode

On first start you’ll see:
Subsequent starts skip migrations that have already been applied.

Environment Variables

In local mode, STEWARD_MASTER_PASSWORD is auto-generated if not provided. This is fine for development but means vault data encrypted with the generated key cannot be decrypted after restart unless you set a fixed password.

Auto-Detection

You can also use the regular API entry point — Steward auto-selects PGLite if:
  • STEWARD_DB_MODE=pglite is set, OR
  • DATABASE_URL is not set
The embedded entry point is preferred because it initializes PGLite before importing the API, ensuring the database is ready before the first request.

Using with the SDK

Local mode exposes the same REST API — point the SDK at localhost:3200:

Using with React Components


Data Persistence

PGLite persists data as files in the data directory:
To reset local data:
To back up local data:

In-Memory Mode for Tests

For unit/integration tests, in-memory mode is fastest:
Each test run starts with a clean database — no cleanup needed.

Limitations vs Production Mode

PGLite is fully functional for development, testing, and light-usage desktop scenarios. For production multi-tenant deployments, use a real Postgres instance (Neon works great).