Configuration
Every environment variable, what it does, and which ones you need in production.
Copy .env.example to .env.local and fill in what you need. Everything is optional in development.
Environment variables
| Variable | Needed in production | What it does |
|---|---|---|
DATABASE_URL | Yes | Postgres connection string, for example from Neon. When it is empty, Orbit uses the embedded database in .data/. |
APP_URL | Yes | The public address of your site, such as https://app.example.com. It is used in emailed links. On Vercel, the production domain is used automatically if this is empty. |
RESEND_API_KEY | For email | Sends real email through Resend. Without it, emails are printed to the server console. |
MAIL_FROM | With Resend | The sender, for example Orbit <hello@example.com>. |
CONTACT_TO | Optional | Email address that receives contact-form messages. They are always saved and shown in the admin area. |
ADMIN_EMAILS | Optional | Comma-separated emails allowed to open /admin. The admin area is off when this is empty. |
CRON_SECRET | For scheduled jobs | Protects the alert and weekly-report jobs. Without it they are disabled. |
STRIPE_SECRET_KEY | For real billing | Turns on Stripe. Without it, billing runs in demo mode. See Billing. |
STRIPE_WEBHOOK_SECRET | With Stripe | Verifies webhook calls from Stripe. |
STRIPE_PRICE_GROWTH_MONTH and the other three price ids | With Stripe | One price id for each paid plan and billing period. |
ANTHROPIC_API_KEY | For the AI assistant | Lets Ask Orbit use Claude. Without it, a built-in analyst answers. See AI assistant. |
ORBIT_AI_MODEL | Optional | The Claude model to use. The default is a fast, low-cost model. |
ORBIT_DEMO | Demo sites only | Shows reset and invite links on screen instead of emailing them. Never set this on a site with real users. |
ORBIT_PUBLIC_DEMO | Demo sites only | Set to 1 to show a "Try the live demo" button on the login page. It opens a shared, view-only workspace with sample data, no sign-up needed. Leave it unset on a real product. |
PGLITE_DIR | Optional | Folder for the embedded database. Default .data/orbit. |
Why the database switches by itself
lib/db.ts exposes one query() function. If DATABASE_URL is set it talks to Neon, otherwise to the embedded database. The same SQL runs on both, so what you test locally behaves the same in production. Tables are created automatically on first use from lib/schema.ts.
Add RESEND_API_KEY and MAIL_FROM. Emails sent: password reset, team invites, alert notices and the weekly report. To use another provider, change the one function in lib/mail.ts.
Scheduled jobs
Two endpoints do scheduled work. Both need CRON_SECRET and an Authorization: Bearer <secret> header.
| Endpoint | Purpose | Suggested schedule |
|---|---|---|
/api/cron/alerts | Checks every workspace's alert rules | Daily, or hourly on a paid Vercel plan |
/api/cron/weekly | Emails the weekly summary | Monday morning |
vercel.json already contains these schedules. Vercel Cron sends the secret for you when CRON_SECRET is set.