Skip to content

Getting Started

Environment & Configuration

All configuration is done via environment variables in your .env file at the project root.

Important: Rebase validates environment variables with Zod at startup. If anything required is missing or malformed (a URL that is not a URL, a port that is not a number), the server refuses to boot and names the variable.

Where the schema lives depends on how you run the backend. A project booted by the runtime — rebase dev, rebase start, the published image — uses the schema the runtime owns (loadBootEnv in @rebasepro/server), which is the union of every table below. A project that has run rebase eject owns a backend/src/env.ts calling loadEnv({ extend }), and can add its own typed variables there.

Variable Description Example
DATABASE_URL PostgreSQL connection string. Optional in development — unset, rebase dev runs a managed PostgreSQL for the project, with its data under .rebase/. Required everywhere else. postgresql://user:pass@localhost:5432/mydb
JWT_SECRET Secret key for signing JWT tokens. Use a strong random string (min 32 chars). Required in production (auto-generated in development). a1b2c3d4e5...

On a managed database, sslmode=require may not mean what it says.

To psql and every libpq tool, require means “encrypted, certificate not checked”. The Node driver Rebase runs on reads it as verify-full, so a database whose certificate no public authority signed — common on managed Postgres — refuses the runtime with self-signed certificate, while psql connects with the same URL. The runtime and rebase db commands stop with a message that says this.

Pick one:

  • sslmode=no-verify — encrypted, not checked: what require means to libpq. It is a node-postgres spelling that libpq lacks, so psql, pg_dump and Atlas refuse it with invalid sslmode value: "no-verify". Rebase’s own commands (rebase db push, rebase db backup, rebase db restore) pass it to them as sslmode=require, so they work with the URL as configured; for psql by hand, swap in sslmode=require.
  • sslmode=verify-full&sslrootcert=/path/to/ca.pem — checked against the provider’s CA certificate. The same for every tool.

uselibpqcompat=true&sslmode=require, which the Node driver’s own warning suggests, works for the runtime too; Rebase’s commands drop uselibpqcompat before handing the URL to libpq tools, which reject it.

Variable Description Default
VITE_API_URL Backend API URL for the typed SDK. Set this in development only — see below. page origin
VITE_GOOGLE_CLIENT_ID Google OAuth client ID. Enables “Sign in with Google”. —

Leave VITE_API_URL unset in production builds.

In development the frontend and backend are separate origins, so the dev server injects this. In production the Rebase backend serves the SPA, so the API is the page’s own origin and the client resolves it that way on its own.

Baking an absolute URL into a production bundle works right up until a second hostname points at the same app: a custom domain then loads the page from example.com and calls the API on example.rebase.website, which is cross-origin, so every request fails preflight. Allowing the origin in CORS does not fix it either — the refresh cookie is SameSite=Lax and is not sent cross-site, so you would clear the console errors and still have broken auth. Unset, every domain pointing at the app works with no CORS configuration at all.

Variable Description Default
PORT Port for the backend HTTP server. Read by rebase start. rebase dev reads it from the shell environment only — a PORT in .env is not read there, because the port is resolved before that file is loaded — and otherwise binds a port derived from the project path, so several projects can run at once. rebase dev --port beats both, and the start banner names the rung it used. 3001
LOG_LEVEL Logging verbosity: error, warn, info, debug info
REBASE_LOG_RAW_QUERIES Show the SQL behind a Failed query: [redacted] line. Every failing statement is redacted by default, because a failed query carries its bound parameters — an email, a password hash. Set it to true while diagnosing a DDL, RLS or change-capture failure. Ignored when NODE_ENV=production. false
NODE_ENV Environment: development, production, or test development
CORS_ORIGINS Comma-separated list of allowed origins. Required in production unless FRONTEND_URL is set: a production boot with neither refuses to start. In development it is added to localhost — see below. —
FRONTEND_URL URL of the frontend app. Used as an alternative to CORS_ORIGINS, in both environments. —
ADMIN_CONNECTION_STRING Admin-level database connection string (used for schema introspection and admin operations). The database it names is not the one the SQL console calls current, nor what a new branch copies by default: both are the database the app’s own connection is on (see REBASE_BRANCH_PARENT_DATABASE for a server on a branch). DATABASE_URL
DISABLE_DB_ROLE_SWITCHING Disable PostgreSQL role-switching in SQL Editor (useful for custom authentication where DB roles are not mapped). Studio’s SQL console then says that the rows were read as the connection owner, names it, and greys out its role picker. false
REBASE_BRANCH_PARENT_DATABASE The database the branch this server runs on was copied from. rebase dev sets it on a checkout switched to a branch. A server with it keeps the branch registry on that database and copies new branches from it by default, so Studio’s Branches pane shows the main database’s branches. —

Development allows localhost, plus whatever CORS_ORIGINS (or FRONTEND_URL) names — the same list production uses, with localhost added rather than substituted. So the variable works the same way in both environments, and the cases that need it in development are the ordinary ones:

# A phone on the LAN, a colleague's machine, an ngrok tunnel,
# a forwarded Codespaces port — all non-localhost origins.
CORS_ORIGINS=http://192.168.1.5:5173

An origin that is neither localhost nor listed is refused, and the refusal is logged once per origin with the exact line that would allow it. Refusing is not caution for its own sake: the API sends credentials, so reflecting an arbitrary Origin would let any site the developer happens to visit make authenticated requests against the dev server with their session and read the answers.

Variable Description Default
JWT_SECRET Secret for JWT signing (required in production, auto-generated in development) —
JWT_PRIVATE_KEY PEM private key for signing access tokens asymmetrically (RS256), so anything holding the JWKS can verify a session without being able to mint one. Accepts a PEM with real newlines, a PEM with \n escapes, or base64 of the whole PEM. Without it tokens stay HS256. —
JWT_KEY_ID Names JWT_PRIVATE_KEY in the token header and in the JWKS. Change it whenever the key changes — rotation depends on old and new being distinguishable. default
JWT_ACCESS_EXPIRES_IN Access token lifetime 1h
JWT_REFRESH_EXPIRES_IN Refresh token lifetime. Sliding — every rotation re-ups it, so this governs how long a session survives inactivity. Set 400d for sessions that outlast a long absence; browsers cap the refresh cookie there. 30d
ALLOW_REGISTRATION Allow new users to register (true/false). Outside production the first user can always register, whatever this says — an empty user table has to admit somebody, and that somebody becomes the admin. In production (NODE_ENV=production) that window is closed: an empty table refuses the bootstrap registration with SETUP_REQUIRED, a first account created through open registration is an ordinary account, and the admin is named with REBASE_ADMIN_EMAIL below or assigned with the service key. The scaffold’s .env.example sets it to true; the framework default is off. false
DISABLE_SELF_REGISTRATION Kill switch. Closes the first-user bootstrap window that ALLOW_REGISTRATION=false deliberately leaves open outside production, so registration is shut even against an empty database. Pair it with REBASE_ADMIN_EMAIL below, or the deployment has no way to produce its first signed-in caller. Every shipped deployment artifact sets it. —
REBASE_ADMIN_EMAIL Email of the first admin account, created at boot while the user table is still empty and never afterwards. This is how a production deployment gets its admin: the operator names the first account instead of racing the internet for it. Boot warns when the table is empty in production and this is unset. —
REBASE_ADMIN_PASSWORD Password for that account. At least 12 characters, or it is refused and the account is not created. Change it after the first sign-in. —
MFA_ENCRYPTION_KEY Encrypts every stored TOTP secret. Unset, the secrets are encrypted with JWT_SECRET instead and boot warns once — so rotating JWT_SECRET signs everybody out and leaves every enrolled authenticator undecryptable. Set a dedicated key (32+ random characters) before anyone enrols. —
MFA_ENCRYPTION_KEY_PREVIOUS The key being rotated away from. Set both during a rotation: new secrets are written with MFA_ENCRYPTION_KEY and existing ones are still readable, so nobody is locked out of their own account mid-rotation. Remove it once every secret has been re-encrypted. —
ALLOW_ANONYMOUS Enable anonymous sign-in (POST /api/auth/anonymous). Opt-in, and deliberately not gated by ALLOW_REGISTRATION. false
AUTH_REQUIRE Require authentication for the data API. Set false for a fully public read surface — RLS still applies. true
AUTH_DEFAULT_ROLE Role assigned to a newly registered user when none is given. —
AUTH_ALLOW_USER_LOOKUP Mount POST /api/auth/find-user, which resolves an email to a minimal public profile (uid, displayName, photoURL) for invite-by-email flows. Authenticated callers only, and it never returns the email, roles or metadata of the user it found. Off by default: it is an enumeration surface. false
AUTH_COOKIE_SAME_SITE SameSite on the refresh cookie: Strict, Lax or None. None requires HTTPS and is only for a genuinely cross-site frontend. Lax
AUTH_COOKIE_SECURE Secure on the refresh cookie. Secure by default; AUTH_COOKIE_SECURE=false for plain http — a deployment on a LAN address where the browser would otherwise drop the cookie and the session would die at the access token’s expiry with no error. It warns at boot. http://localhost does not need it. true
GOOGLE_CLIENT_ID Google OAuth client ID (backend validation) —
GOOGLE_CLIENT_SECRET Google OAuth client secret —
GITHUB_CLIENT_ID GitHub OAuth client ID —
GITHUB_CLIENT_SECRET GitHub OAuth client secret —
MICROSOFT_CLIENT_ID Microsoft OAuth client ID —
MICROSOFT_CLIENT_SECRET Microsoft OAuth client secret —
LINKEDIN_CLIENT_ID LinkedIn OAuth client ID —
LINKEDIN_CLIENT_SECRET LinkedIn OAuth client secret —
FACEBOOK_CLIENT_ID Facebook OAuth client ID —
FACEBOOK_CLIENT_SECRET Facebook OAuth client secret —
TWITTER_CLIENT_ID X/Twitter OAuth client ID —
TWITTER_CLIENT_SECRET X/Twitter OAuth client secret —
DISCORD_CLIENT_ID Discord OAuth client ID —
DISCORD_CLIENT_SECRET Discord OAuth client secret —
GITLAB_CLIENT_ID GitLab OAuth client ID. A self-hosted instance’s baseUrl has no environment spelling — configure GitLab in the auth block for that. —
GITLAB_CLIENT_SECRET GitLab OAuth client secret —
BITBUCKET_CLIENT_ID Bitbucket OAuth client ID —
BITBUCKET_CLIENT_SECRET Bitbucket OAuth client secret —
SLACK_CLIENT_ID Slack OAuth client ID —
SLACK_CLIENT_SECRET Slack OAuth client secret —
SPOTIFY_CLIENT_ID Spotify OAuth client ID —
SPOTIFY_CLIENT_SECRET Spotify OAuth client secret —
APPLE_CLIENT_ID Apple Services ID, for web sign-in. It is public and is published in GET /auth/config. Apple has no static client secret, because Rebase signs a short-lived ES256 JWT for each token exchange. So Apple needs APPLE_TEAM_ID, APPLE_KEY_ID and APPLE_PRIVATE_KEY, plus this or APPLE_BUNDLE_IDS, and configures nothing without them. —
APPLE_BUNDLE_IDS Comma-separated bundle ids of the native iOS/macOS apps whose Sign in with Apple codes are accepted. —
APPLE_TEAM_ID Apple Developer Team ID, the JWT’s issuer. —
APPLE_KEY_ID Key ID of the private key registered with Apple. —
APPLE_PRIVATE_KEY Contents of the .p8 private key file, newlines and all (\n escapes are accepted). —
REBASE_SERVICE_KEY Static admin API key. Bypasses normal JWT auth for server-to-server calls when passed as Authorization: Bearer <key>. (Auto-generated in development). —
REBASE_PLATFORM_TOKEN_KEY The hosting platform’s public key (PEM, EC P-256) that rpt_ platform tokens are verified against; several PEM blocks during a key rotation. The platform sets it at deploy, and it holds nothing secret. Together with REBASE_PLATFORM_TOKEN_AUDIENCE it lets the admin gate accept a platform token for cron:read, and for nothing else. —
REBASE_PLATFORM_TOKEN_AUDIENCE The project id a platform token’s aud must equal, so a token minted for another project is refused. With only one of the two variables set, the server boots, logs a warning, and answers every rpt_ token with 401 PLATFORM_TOKENS_OFF. —
REBASE_PLATFORM_SIGNIN_URL Where the admin panel’s Continue with Rebase Cloud goes: the project’s page in the platform’s console, which signs the project’s owners in and comes back. The platform sets it at deploy with the two above; with them, POST /api/auth/platform-signin accepts the platform’s one-minute auth:admin-signin token and opens an admin session. Without it the door still works from the console’s Open CMS, and the login screen only explains it. —
REBASE_RATE_LIMIT_STORE Where rate-limit counters live, for the auth routes and for rateLimit in custom functions: memory (per-process) or sql (shared across replicas). A process cannot see its own replica count, so a deployment with peers has to say so — three replicas on the default enforce three times the limit. Any other value refuses to boot rather than falling back, postgres included. memory
AUTH_MAGIC_LINK Mount the passwordless sign-in-link flow. Needs an email service configured, or the link has nowhere to go. false
AUTH_EMAIL_OTP Mount passwordless sign-in with a six-digit code sent by email. Same email requirement as above. false
AUTH_MAGIC_LINK_CREATES_USERS Passwordless sign-up: a magic-link or email-code request for an unknown address creates the account, while registration is open. false
AUTH_REFRESH_TOKEN_REUSE What a refresh token replayed after its reuse window does: reject (refuse it, keep the session) or revoke-session (end the sign-in). Anything else fails the boot. reject
AUTH_REQUIRE_EMAIL_VERIFICATION Confirm-first registration: no password sign-in until the address is verified. Needs email; the boot refuses it without. false
CAPTCHA_PROVIDER Turn on captcha verification on the auth routes: turnstile or hcaptcha. Unset means no captcha. —
CAPTCHA_SECRET The provider’s secret, used server-side to verify the token the browser sends. Required once CAPTCHA_PROVIDER is set. —
CAPTCHA_ROUTES Comma-separated auth routes to protect (for example register,login). Unset protects the provider’s default set. —
Variable Description Default
STORAGE_TYPE Storage backend: local, s3, gcs, or platform (files in a prefix the hosting platform owns, moved over URLs its storage broker signs; set by the platform). In production local disables storage unless FORCE_LOCAL_STORAGE=true local
STORAGE_PATH Base path for local storage. A relative path is read from the directory the server runs in: the project root under rebase dev, backend/ in a server rebase eject wrote <project>/uploads
FORCE_LOCAL_STORAGE Allow local storage in production — only with a durable volume holding STORAGE_PATH and the <STORAGE_PATH>__<key> directories of named local buckets beside it false
STORAGE_DOWNLOAD_TOKEN_TTL Seconds a private file’s download URL works — the token getSignedUrl() puts in it. At most 604800 (a week) 300
STORAGE_MAX_FILE_SIZE Largest file the source accepts, in bytes, on every upload path — __<KEY> for a named source. Not a whole number of bytes refuses the boot 52428800 (50 MB)
S3_BUCKET S3 bucket name (when STORAGE_TYPE=s3) —
S3_REGION AWS region —
S3_ACCESS_KEY_ID AWS access key —
S3_SECRET_ACCESS_KEY AWS secret key —
S3_ENDPOINT Custom S3 endpoint (for MinIO, Cloudflare R2, etc.) —
S3_FORCE_PATH_STYLE Force path-style URLs for S3 bucket (true/false) false
GCS_BUCKET GCS bucket name (when STORAGE_TYPE=gcs) —
GCS_PROJECT_ID GCP project. Usually inferred from the credentials. —
GCS_KEY_FILENAME Path to a service-account key file. Omit on GCP, where Workload Identity supplies credentials. —
STORAGE_PUBLIC_READ Serve every object to anyone, no token. Only for a bucket that genuinely is a public CDN. One of the ways to satisfy the boot guard above. false
STORAGE_ALLOW_ANY_AUTHENTICATED Let any signed-in caller read, write, list and delete every object. Named INSECURE in the config object for a reason: it is only defensible in a single-tenant app where every account is trusted with every file. false
STORAGE_POLICIES Storage access rules as JSON: [{ "path", "operations"?, "allow" }], allow being "public", "authenticated", "owner" or { "roles": [...] }. Deny by default, and satisfies the boot guard. An invalid list refuses the boot. See Storage authorization. —
STORAGE_BROKER_URL The platform’s storage broker, for STORAGE_TYPE=platform. Set by the platform that runs the broker. —
STORAGE_BROKER_PROJECT The project id the broker scopes this deployment’s files to, for STORAGE_TYPE=platform. Set by the platform. —
STORAGE_RENDITION_CACHE Cache generated image renditions (resizes, format conversions) instead of producing them per request. false

MAGIC_LINK_URL.

Variable Description
SMTP_HOST SMTP server host
SMTP_PORT SMTP server port
SMTP_SECURE Enable secure connection (true/false)
SMTP_USER SMTP username
SMTP_PASS SMTP password
SMTP_FROM Sender address for system emails
SMTP_NAME Display name on the sender address
APP_NAME Product name used in email subjects and bodies (default: Rebase)
EMAIL_LOGO_URL Logo shown atop the default email templates. Absolute http(s) PNG or JPG — clients strip SVG and block data: URIs. Unset, an app still named Rebase gets the Rebase mark and a renamed one gets none
MAGIC_LINK_URL Where an emailed magic link points. A base gets /auth/magic-link?token=… appended; a URL containing {token} is the whole link, for a frontend that does not serve /auth/magic-link. Quote it in .env, where an unquoted # starts a comment: MAGIC_LINK_URL="https://app.example.com/app.html#ml={token}". A value with a hash or a file path and no {token} is warned about at boot. Unset, the base is FRONTEND_URL
Variable Description Default
DB_POOL_MAX Maximum pooled connections 20
DB_POOL_IDLE_TIMEOUT Milliseconds an idle connection is kept 30000
DB_POOL_CONNECT_TIMEOUT Milliseconds to wait for a connection 10000
DATABASE_DIRECT_URL Direct (non-pooled) connection. Realtime needs one: LISTEN/NOTIFY does not survive a transaction pooler such as PgBouncer, and without it change notifications are disabled with a warning rather than silently lost. The job worker holds its wake-up LISTEN on it too. Fills the Postgres adapter’s directConnectionString when that is unset. —
DATABASE_READ_URL Read replica, such as a hot standby. When it names another server, signed-in reads (lists, single rows, counts, aggregates) are served there under the same row-level security; writes, sign-in, realtime, crons, jobs, the SQL console and rebase.sql stay on the primary. A reader who just wrote reads from the primary for REBASE_READ_STICKY_MS, and everyone does while the replica is more than REBASE_READ_MAX_LAG_MS behind or failing. Fills the Postgres adapter’s readConnectionString when that is unset; up to and including 0.28 the replica’s pool was opened and never read from. —
REBASE_READ_STICKY_MS After a write, how long the same user’s reads go to the primary, so a save followed by a list shows the save. Per server instance. 5000
REBASE_READ_MAX_LAG_MS Replica lag past which every read goes to the primary. 1000
DATABASE_POOLED true when DATABASE_URL goes through a transaction-mode pooler such as PgBouncer. The pool then sends no search_path or statement_timeout at connect (the pooler would refuse or drop them) and sets both in each transaction; the boot gives the database role a default search_path of public for statements outside one. DATABASE_DIRECT_URL becomes required, and realtime, the job worker’s wake-up, index builds, branching and the SQL console all use it. The replica’s URL is taken to be pooled too. DATABASE_POOLED__<KEY> for another data source. —
REBASE_DB_POOL_MAX A ceiling on every pool in the process, applied whatever each one asked for. Plain digits only: a malformed value is ignored rather than silently serializing the server. —

Read by the runtime — rebase dev, rebase start and the published server image. A project that has ejected owns these decisions in its own code instead.

Variable Description Default
REBASE_RLS_AUDIT true runs the scheduled row-level-security audit, which reports tables that are served without policies. The project must declare @rebasepro/rls-check among its dependencies: the runtime ships no copy, and without the package the boot refuses, naming it. false keeps the scan off this process. —
REBASE_RLS_REQUEST_ROLE The Postgres role signed-in and anonymous requests run as. Give each project on a shared cluster its own. A database records the role it runs as, and a boot configured for another refuses to start until rebase db request-role migrate moves it. See Running on an existing or shared database. rebase_user
REBASE_RLS_PROVISION_ROLE auto creates the request role and lets the connection switch to it; never leaves both to you and only checks them. auto
REBASE_RLS_GRANTS What Rebase grants the request role: schema (every table in the schemas it serves, plus default privileges), managed (only the tables it serves) or none. schema
REBASE_RLS_POLICY_TARGET requestRole narrows Rebase’s permissive policies to the request role(s), so other roles reading the same tables get nothing from them. public
REBASE_RLS_ADMIN_POLICIES public writes the policies only the server context or an admin can pass TO public, and runs admins as the request role. By default they are TO rebase_admin, so signed-in users’ owner-scoped reads can use the owner index. See Admin requests and rebase_admin. adminRole
REBASE_RLS_DEFAULT_POLICIES false drops the server-or-admin baseline policy from every table. true
REBASE_RLS_IDENTITY supabase also sets request.jwt.claims and request.jwt.claim.*, so policies written with auth.uid() see the caller. rebase
REBASE_RLS_SHARED_ROLE What a boot does when another login can switch into the request role: warn, refuse or ignore. warn
REBASE_BASE_PATH Base path for every API route. The client must be told the same thing — see Changing basePath. /api
REBASE_SERVE_STATIC Serve the bundle’s static/admin assets from this process. Turn it off when a CDN sits in front. true
REBASE_STUDIO Serve the built-in admin panel at /_studio when its static bundle is available: a project’s tables as collections, its users and roles among them, and the Studio. It is what a project with no code is administered with. Set false to disable. true
REBASE_STUDIO_DIR Directory containing the prebuilt admin panel served at /_studio. Defaults to /studio in the container image. /studio
REBASE_HISTORY Record entity change history. true
REBASE_COMPRESSION gzip/brotli responses. true
REBASE_PUSH true turns on push notifications: the /api/push routes, the rebase.push_subscriptions table and rebase.push. false
REBASE_VAPID_PUBLIC_KEY, REBASE_VAPID_PRIVATE_KEY The VAPID key pair push messages are signed with. Outside production a pair is generated and kept in .rebase-dev-secrets.json when unset; in production push stays off without them. —
REBASE_VAPID_SUBJECT A mailto: address or https:// URL the push services can contact. Defaults to the origin of an https REBASE_PUBLIC_URL. —
REBASE_MAX_BODY_SIZE Maximum request body, in bytes (10485760, not 10MB — a value that is not a number refuses to boot rather than silently removing the limit). 0 turns the limit off. 10485760 (10 MiB)
REBASE_ENABLE_SWAGGER The OpenAPI surface. Tri-state. Unset, in every environment: /api/docs is served to the callers GET /api/schema/tables describes tables to, each the document of the tables they are described, and there is no Swagger UI. true publishes the whole document to everyone, with the Swagger UI at /api/swagger outside production (never in production). false keeps the document behind the admin gate. —
REBASE_DEPLOYMENT_ID The deployment this process runs, as the platform names it; named on the line that says the runtime is listening. Rebase Cloud sets it. —
REBASE_METRICS Expose Prometheus metrics at /metrics. false
REBASE_HSTS_INCLUDE_SUBDOMAINS Add includeSubDomains to the Strict-Transport-Security header, so browsers refuse plain HTTP on every subdomain of the host for six months — hosts this process does not serve included. Turn it on only when every subdomain of the domain is HTTPS-only. Anything but true/false refuses to boot. See Security headers. false
REBASE_METRICS_TOKEN Bearer token guarding /metrics. Unset leaves the endpoint open to anything that can reach the port — fine on a private network, not on a public one, and the boot logs say so. —
REBASE_MIGRATE_ON_BOOT What the runtime may do to the tables’ schema at boot. ensure (the default, everywhere — production included) runs the additive pass: create missing tables, columns and enum types, never drop or rewrite one. none leaves the declared tables’ schema alone, but the framework’s own tables (auth, API keys, jobs, cron) are still created and kept current; REBASE_PROVISION=false turns those off too. The published image accepts only those two and refuses to boot on push. In a split deployment exactly one process may provision, so every other role must set none or refuse to boot. ensure
REBASE_PROVISION false makes the runtime change nothing in its database: no table, column, index, function, trigger, policy, role or grant, at boot or later, the framework’s own included. It reports what is missing by name instead. For a database that only your change process may change. See When only your change process may change the database. Only true and false are accepted. true
REBASE_REQUIRE_SCHEMA_MATCH Refuse to boot when the database was last provisioned from a different set of tables than this process was built from. Unset (or anything other than true/1) warns instead. warn
REBASE_REQUIRE_FILES_LOADED Refuse to boot when a function or cron file throws or does not parse while importing, naming each file and why, so a rolling deploy leaves the old version serving. A restart is held to it too. Unset (or anything other than true) skips the file and serves the rest. A file that imports cleanly and exports no function or job is always skipped, not refused. skip
REALTIME_CDC Database-level change capture: auto (read changes from the WAL where the database allows it, else use triggers, else fall back to app-level, logging each fallback as info), trigger (force it, warn if impossible), wal (read changes from the write-ahead log instead of triggers; needs wal_level=logical and a role that may replicate, falls back to trigger otherwise), off. See Realtime. Wins over realtime.cdc. auto
REALTIME_CHANNEL_BUS Cross-instance transport for broadcast channels and presence: memory or postgres. Ignored when realtime.bus was given a constructed transport. memory
REALTIME_MAX_SUBSCRIPTIONS_PER_SOCKET How many subscriptions one realtime socket may hold; the next is refused with TOO_MANY_SUBSCRIPTIONS. A positive whole number — anything else stops the server at boot. Wins over realtime.maxSubscriptionsPerSocket. See Realtime. 1000
REALTIME_MAX_SOCKETS_PER_USER How many realtime sockets one user, or one API key, may hold open on one server instance. An administrator’s impersonating sockets count against the administrator. The next one’s sign-in is refused with TOO_MANY_SOCKETS and the socket closed (4002); the SDK keeps retrying, so it gets in when another closes. A positive whole number — anything else stops the server at boot. Wins over realtime.maxSocketsPerUser. No ceiling
REALTIME_REFETCH_MAX_WAIT_MS The longest a change waits for the refetch that delivers it to live subscribers, in ms. A refetch waits for 300 ms without a change, and at most this long under a steady stream of writes. A positive whole number — anything else stops the server at boot. Wins over realtime.refetchMaxWaitMs. 1000
REALTIME_RECOUNT_INTERVAL_MS How long a big list subscription’s total may be reused before it is counted again, in ms; frames that reuse it carry meta.totalAsOf. Unset, every frame counts. Wins over realtime.recountIntervalMs. Unset
REALTIME_RECOUNT_MIN_ROWS The smallest last total REALTIME_RECOUNT_INTERVAL_MS applies to; smaller lists are counted on every frame. Wins over realtime.recountMinRows. 100000
ALLOW_LOCALHOST_IN_PRODUCTION Permit localhost/loopback values under NODE_ENV=production. Off, so a production boot fails loudly rather than connecting to a database that is not there. false
REBASE_PROVISION_ONLY 1/true runs the schema pass and exits without opening a socket — the shape a migration Job wants, from the same image and the same bundle as the server that follows it. It also creates the tables a serving process would otherwise make on first use, and starts no cron or job queue. An empty value is unset, so an unsubstituted ${SOMETHING} in a compose file cannot turn an ordinary deployment into one that migrates and refuses to serve. Refused together with REBASE_PROVISION=false. —
REBASE_PROVISION_SQL_OUT A file path. A provisioning run (REBASE_PROVISION_ONLY=true) writes every schema change it made to it, in order, as a SQL script to review and apply with psql. Rows it wrote are not included. Refused on a process that serves. —
REBASE_LIVE_SCHEMA_ALLOW_MACHINE_APPLY true lets a machine — an agent, a CI job — apply a schema change through /api/admin/schema, not only plan one. Off unless asked for: the credential that would make such a change is the one most likely to be sitting in a CI variable. false
REBASE_FUNCTIONS_TIMEOUT_MS How long a custom function may run before its request is aborted. Same knob as the functionsTimeoutMs option. 0 turns it off. A function that declares its own (defineFunction(…, { timeoutMs })) uses that instead. 30000
REBASE_FUNCTIONS_MAX_TIMEOUT_MS The longest timeout a function may declare for itself with defineFunction(…, { timeoutMs }), in ms; one that asks for more gets this. A positive number; anything else reads as unset. 300000
REBASE_EXIT_ON_UNHANDLED_REJECTION true makes an unhandled promise rejection terminate the process instead of logging it. On under an orchestrator that will restart you; off where a restart is worse than a leak. false
REBASE_CRON_ALWAYS_ON Silences the boot warning on a platform the runtime detects as scale-to-zero, where a timer that fires in an idle instance fires in no instance. It changes nothing else: set it when you keep at least one instance running. —
TRUSTED_PROXY_HOPS How many proxies sit in front of this server, so the rate limiter can read the real client address out of X-Forwarded-For. Fail-safe default 0: with no proxy, trusting the header would let any caller forge an identity. 0

One image and one bundle can be booted several times over, each serving a different part of the project. One line each here, because this page claims to list every variable; what each combination mounts and owns — and which combinations refuse to boot — is on Split Processes.

Variable Description Default
REBASE_ROLE Which part this process serves: all, api, functions or worker. all
REBASE_CRON_SCHEDULER Override whether this process runs the cron timers. Unset follows the role. —
REBASE_JOB_WORKERS Override whether this process runs job-queue workers. Unset follows the role. —
REBASE_FUNCTIONS_ONLY Serve only the named custom functions in this process. —
REBASE_FUNCTIONS_EXCLUDE Serve every custom function except the named ones. —
REBASE_FUNCTIONS_UPSTREAM Where the API process forwards a function request it does not serve itself. On a worker, where its own rebase.functions calls go. An http(s) URL. —

An opt-in Model Context Protocol endpoint at /mcp, so an AI client can read and write this project as the signed-in user. Off unless set, and — unlike every other surface — no REBASE_ROLE turns it on: the others describe a process shape, while this one is a decision to hand credentials to third-party software, and it should be made by a person rather than inherited from a container’s job title.

rebase dev sets REBASE_MCP_ENABLED=true for the backend it starts, unless the shell or .env already has a line for it, and that backend names its own http://localhost:<port> as the public URL when REBASE_PUBLIC_URL is unset. Nothing else does either: a production process needs both variables.

Variable Description Default
REBASE_MCP_ENABLED Mount the MCP surface. Requires REBASE_PUBLIC_URL; without it the surface declines to mount and says so in the boot log. false
REBASE_PUBLIC_URL This deployment’s externally reachable origin, e.g. https://app.example.com. The MCP surface cannot derive it — taking the origin from the Host header would make the issuer identity, and the audience its own tokens are checked against, a value the caller supplies. —
REBASE_MCP_VIEW Path to the project’s own MCP App view (rebase-view.html, written by rebaseMcpViewPlugin()), served to Claude in place of the generic view so your custom views, fields and actions are what it draws. Without it the backend looks beside the frontend it serves. —
REBASE_MCP_OPEN_REGISTRATION Allow OAuth dynamic client registration (RFC 7591), so a client can enrol itself. Set to false to require clients be registered ahead of time. true

Off unless REBASE_LIVE_SCHEMA_REPOSITORY is set. A built bundle has no backend/schema source to edit, so with these set the schema editor reads the source from the repository, commits each change back, and runs its DDL on this database. Admin-only, and applied by a person unless REBASE_LIVE_SCHEMA_ALLOW_MACHINE_APPLY says otherwise. A repository named with no usable credential refuses to boot. See Live schema editing.

Variable Description Default
REBASE_LIVE_SCHEMA_REPOSITORY The GitHub repository to commit schema changes to, as owner/name. Setting it is what turns the feature on. —
REBASE_LIVE_SCHEMA_BRANCH The branch the commit lands on. main
REBASE_LIVE_SCHEMA_PATH Where backend/schema lives in that repository, repo-relative. A path that leaves the repository refuses to boot, and so does the removed REBASE_LIVE_SCHEMA_COLLECTIONS_PATH. backend/schema
REBASE_LIVE_SCHEMA_GITHUB_TOKEN A fine-grained token with read and write access to the repository’s contents. Set this or the three _GITHUB_APP_* variables, not both. —
REBASE_LIVE_SCHEMA_GITHUB_APP_ID A GitHub App’s id, to commit as the app instead of with a token. —
REBASE_LIVE_SCHEMA_GITHUB_APP_INSTALLATION_ID The app’s installation on the repository. —
REBASE_LIVE_SCHEMA_GITHUB_APP_PRIVATE_KEY The app’s private key: PEM, PEM with escaped newlines, or base64. —
Variable Description Default
BACKUP_SCHEDULE Cron expression for scheduled backups. Unset means scheduled backups are off. —
BACKUP_DESTINATION Local path, or an s3://bucket/prefix / gs://bucket/prefix URL. Required with BACKUP_SCHEDULE, which refuses to run without it. rebase db backup falls back to ./backups where it was run. —
BACKUP_RETENTION_DAYS Delete backups older than N days. Unset or 0 keeps everything. —
BACKUP_KEEP_MINIMUM Always retain at least N of the most recent backups, whatever retention says. —
PG_DUMP_PATH Override the pg_dump binary — it must be the server’s major version or newer. —
PG_RESTORE_PATH Override the pg_restore binary. —
PSQL_PATH Override the psql binary that rebase db restore --clean runs to make the restore one transaction. —
PG_DUMPALL_PATH Where pg_dumpall lives, when it is not on PATH. Without it — and without the PostgreSQL client tools installed — a globals backup fails with an error naming this variable. —

The official runtime image (rebasepro/server) ships the PostgreSQL 18 client tools, so a scheduled backup runs in it against any server up to Postgres 18. Outside the image, install them yourself (apt-get install postgresql-client-18, brew install libpq).

Backups contain secrets and PII. Use a private destination with encryption-at-rest.

A managed deployment does not carry its code in the image: the runtime fetches a bundle at boot. These decide which one and how.

Variable Description Default
REBASE_BUNDLE Path to an already-extracted bundle directory. What rebase start sets locally. —
REBASE_BUNDLE_URL Where to fetch the bundle archive from, when there is no local one. —
REBASE_BUNDLE_TOKEN The bearer credential for that fetch. Treat it as a secret: it is what authorises a tenant to download its own code. —
REBASE_BUNDLE_FETCH_DIR Where a fetched bundle is extracted. Must be writable and must survive between the fetch and the boot. —
REBASE_RUNTIME_MODULES Extra modules the runtime image provides to the bundle, beyond the ones it declares itself. —

Every database, bucket and topic a project declares in backend/resources.ts is bound by environment variables named after it. The base names are below; a non-default resource appends __ and its key in upper case, so a bucket called media reads S3_BUCKET__MEDIA. rebase status prints, per resource, the exact variable it is reading and whether it is set.

Variable Description Default
REBASE_DRIVER The npm package implementing a data source’s driver, when it is not the default Postgres one. Suffixed per source: REBASE_DRIVER__ANALYTICS. —
REBASE_TOPIC_URL The connection string for a declared topic. Suffixed per topic. —

Read by rebase, not by the server. Nothing here affects a deployment.

Variable Description Default
REBASE_BASE_URL Where rebase api-keys, rebase storage and rebase auth reset-password send the service key, in the shell or in .env. Set it when the server runs some other way than rebase dev in this project: rebase start, a container, another host. Unset, they use the server rebase dev recorded while that server is running, and send nothing when it is not. —
REBASE_SERVICE_KEY The service key those commands authenticate with, read from .env: the same variable the server reads (see above). —
SERVICE_KEY An older name for that key. When .env sets it, rebase api-keys and rebase storage read it in place of REBASE_SERVICE_KEY. —
REBASE_ENV_FILE_PATH Which .env the CLI reads and writes, when it is not the project’s. —
REBASE_ROOT_RULES 0 stops rebase init and rebase skills install from writing the project’s rules into the repository root’s CLAUDE.md and AGENTS.md, for a root whose agent files you keep by hand. on
REBASE_CLOUD_URL The control plane rebase cloud talks to. —
REBASE_CLOUD_EMAIL The account rebase cloud login signs in as, instead of prompting. —
REBASE_CLOUD_PASSWORD Its password, so a secret store can hand it over without it reaching the shell’s history. —
REBASE_TOKEN A token from rebase cloud tokens create. Set, every rebase cloud command authenticates with it instead of the rebase cloud login session, and never reads or writes the stored session. In a directory rebase cloud init --claim linked, it is set aside for that project’s own token when it holds no scope on the project. The way to run rebase cloud in CI — see CI and agents. The MCP server passes it to the CLI its cloud tools spawn, and never sends it to the app: set REBASE_API_TOKEN for that. —
REBASE_DEBUG 1 prints the underlying error and request detail instead of the short message. The first thing to set when a rebase cloud command fails unhelpfully. —
REBASE_ATLAS_DEV_URL The empty database rebase db push, db generate and db migrate plan against, instead of the <db>_dev_diff they create beside DATABASE_URL. Rebase neither creates nor drops a database named here, and refuses one equal to DATABASE_URL. On the managed development database the CLI sets it to a throwaway in-memory PGlite of its own. Set it where CREATE DATABASE is not granted. <db>_dev_diff
REBASE_DEV_NO_DB rebase dev starts no database and provisions nothing — you bring your own. Same as --no-db. —
REBASE_FRONTEND_PORT Pins the frontend dev server’s port, which rebase dev otherwise derives from the project’s path. —
REBASE_DEV_READY_TIMEOUT_MS How long rebase dev waits for the backend to announce itself before saying it has not started. 0 disables the report. 30000
DATABASE_PASSWORD The password rebase dev --docker puts into the connection string it derives from docker-compose.yml. —
DO_NOT_TRACK The cross-tool convention. Set to anything but 0 and the CLI sends no telemetry. —
REBASE_TELEMETRY_DISABLED The same, for Rebase specifically. Needs no file, which is why it is the one to use in CI and in an image. —
REBASE_TELEMETRY_ENDPOINT Where telemetry is sent, for a self-hosted collector. —
REBASE_NO_UPDATE_CHECK 1 stops the CLI asking the npm registry (or npm_config_registry), once a day in a background process, for @rebasepro/cli’s dist-tags, and hides the “Rebase X is out; this CLI is Y” line every command but rebase upgrade ends with on stderr. The answer is kept in ~/.rebase/release-check.json, and the request sends nothing else. Off in CI already; NO_UPDATE_NOTIFIER does the same. —
REBASE_RELEASE_NOTICE_SHOWN Set by the CLI for the processes it starts, so a command that runs the CLI again prints the “Rebase X is out” line once. Setting it yourself hides the line for that process, as REBASE_NO_UPDATE_CHECK does. —

JWT_SECRET is required in production. It and REBASE_SERVICE_KEY are generated for you outside it, so you can start without setting anything up.

Those generated values are cached in .rebase-dev-secrets.json, beside .rebase-dev-port and .rebase-dev-url and gitignored with them. Before, they were regenerated on every boot — so restarting the dev server logged you out of your own app and invalidated any API key you had just created.

  • Set either variable explicitly and yours is used; nothing is cached or read.
  • Point the cache somewhere else with REBASE_DEV_SECRETS_FILE — a path, and the only variable in this section you would ever set deliberately.
  • Delete the file to roll both secrets. The next boot writes a fresh one.
  • If the file cannot be written — a read-only container, say — the server starts anyway with an ephemeral secret, exactly as it used to.

Nothing is cached in production, or under a test runner. In production nothing is generated either: a boot with no JWT_SECRET fails, naming the variable, and that is unchanged:

The environment is not valid:
JWT_SECRET: is required

The RebaseBackendConfig passed to initializeRebaseBackend() provides programmatic control:

import { initializeRebaseBackend } from "@rebasepro/server";
import { createPostgresAdapter } from "@rebasepro/server-postgres";
import { env } from "./env";
await initializeRebaseBackend({
app,
server,
schemaDir: "./schema", // The backend/schema directory: the tables, and what the schema editor writes
basePath: "/api", // Base path for all API routes (default: "/api")
database: createPostgresAdapter({
connection: db,
schema: { tables, enums, relations }
}),
auth: { // Authentication config
jwtSecret: env.JWT_SECRET,
accessExpiresIn: env.JWT_ACCESS_EXPIRES_IN,
refreshExpiresIn: env.JWT_REFRESH_EXPIRES_IN,
requireAuth: true, // Require auth for data API (default: true)
allowRegistration: env.ALLOW_REGISTRATION,
google: env.GOOGLE_CLIENT_ID
? {
clientId: env.GOOGLE_CLIENT_ID,
clientSecret: env.GOOGLE_CLIENT_SECRET
}
: undefined,
serviceKey: env.REBASE_SERVICE_KEY
},
// No bucket configured in production means storage is off, not local:
// uploads answer 501 rather than landing on a filesystem that is erased
// on the next redeploy.
storage: env.STORAGE_TYPE === "s3"
? {
type: "s3",
bucket: env.S3_BUCKET!,
region: env.S3_REGION,
accessKeyId: env.S3_ACCESS_KEY_ID,
secretAccessKey: env.S3_SECRET_ACCESS_KEY,
endpoint: env.S3_ENDPOINT
}
: env.STORAGE_TYPE === "gcs"
? {
type: "gcs",
bucket: env.GCS_BUCKET!,
projectId: env.GCS_PROJECT_ID,
keyFilename: env.GCS_KEY_FILENAME
}
: isProduction && !env.FORCE_LOCAL_STORAGE
? undefined
: {
type: "local",
basePath: env.STORAGE_PATH || "./uploads"
},
history: true, // Enable entity change history
enableSwagger: true, // Publish the whole OpenAPI document at /api/docs to everyone
logging: {
level: "info"
}
});

The same options, without app, server and basePath and with a required provision, build a backend that serves nothing until you mount it: createRebaseBackend. See Custom Server Integration.

basePath moves every API route, so the client has to be told the same thing — otherwise it keeps asking for /api/... and gets a 404 for everything:

import { createRebaseClient } from "@rebasepro/client";
export const rebase = createRebaseClient({
baseUrl: "https://api.example.com",
apiPath: "/v1" // must match the backend's basePath
});

The admin panel picks this up from the client it is given; nothing else needs configuring. If you build a request URL by hand, join it from the client rather than writing /api yourself:

import { useApiBase } from "@rebasepro/app";
function Widget() {
const apiBase = useApiBase(); // e.g. "https://api.example.com/v1"
// fetch(`${apiBase}/data/products`)
}

SQL Editor Permission Denied (permission denied for table <name>)

Section titled “SQL Editor Permission Denied (permission denied for table <name>)”
  • Symptoms: Custom queries executed in Rebase Studio’s SQL editor fail with cause: error: permission denied for table <name>, even though the spreadsheet CMS view loads data successfully.
  • Cause: By default, Rebase attempts to execute SQL Editor queries by temporarily switching database roles to match the active user’s application role (e.g., SET LOCAL ROLE "admin"). If you are using custom authentication where roles exist only in database tables rather than actual PostgreSQL roles, the role switch fails or database privileges are missing. The CMS spreadsheet view executes under the default connection owner user and bypasses this.
  • Solution: Add DISABLE_DB_ROLE_SWITCHING=true to your backend .env configuration. This forces Rebase to run SQL Editor queries using the connection owner’s privileges (typically a superuser/owner). The SQL Editor then says, above the results, that they were read as the connection owner, and greys out its role picker.

SQL Editor Schema Fetch Failed (Cross-database execution requires adminConnectionString)

Section titled “SQL Editor Schema Fetch Failed (Cross-database execution requires adminConnectionString)”
  • Symptoms: Studio fails to load the schema tree, or SQL Editor throws Failed to fetch schema: Cross-database execution requires adminConnectionString to be configured in the backend.
  • Cause: Rebase requires administrative privileges to query database system catalogs and run administrative commands. If adminConnectionString is not provided to the bootstrapper, or getAdmin() is overridden to return undefined, these operations fail.
  • Solution: Ensure adminConnectionString is configured during backend bootstrapper initialization:
    createPostgresBootstrapper({
    connection: db,
    schema: { tables, enums, relations },
    adminConnectionString: process.env.ADMIN_CONNECTION_STRING || process.env.DATABASE_URL
    })