Skip to content

Multi-Tenancy

Build SaaS applications with built-in tenant isolation, quotas, and change data capture.

Tenant Management

Create Tenant

Terminal window
\tenant create acme_corp enterprise schema

List Tenants

Terminal window
\tenants

Switch Tenant Context

Terminal window
\tenant use acme_corp

Isolation Levels

LevelDescription
sharedLogical isolation via tenant_id column
schemaPer-tenant schema isolation
databaseFull database isolation

Quotas

Set Quotas

Terminal window
# \tenant quota set <tenant> <storage_mb> <connections> <qps>
\tenant quota set acme_corp 10240 50 1000

View Usage

Terminal window
\tenant usage acme_corp

Plans

Terminal window
\tenant plans # List plans
\tenant plan create pro 2 51200 50 1000 # <name> <tier> <storage_mb> <conn> <qps>
\tenant plan acme_corp pro # Assign plan

Change Data Capture (CDC)

Terminal window
\tenant cdc # View recent events
\tenant cdc export events.json # Export to file

Where Tenants Are Managed

Manage tenants, plans and quotas from the REPL (above) or the embedded Rust API; a REST API for tenant management is planned. Tenants, plans and policies live in the memory of the process that defines them and are not persisted across restarts.

In the stock Nano server, row-level security is enforced through the embedded API and the REPL; SQL CREATE POLICY and enforcement for REST and wire clients are planned.