Configuration
All server settings live in one .env at the repo root (copy .env.example). The API, migrations and scripts read it; the web app gets API_URL at build time.
| Variable | Used by | Example | Notes |
|---|---|---|---|
DATABASE_URL |
API, migrations | postgres://b2bkit:b2bkit@localhost:5432/b2bkit |
Any Postgres 15+ |
BETTER_AUTH_SECRET |
API | openssl rand -base64 32 |
Required. Changing it signs everyone out |
BETTER_AUTH_URL |
API | http://localhost:3001 |
Public URL that serves /api/auth/*. In production behind the web app: the web URL |
WEB_URL |
API | http://localhost:3000 |
Links in emails, CORS and trusted origin |
API_URL |
Web (build time) | http://localhost:3001 |
Where web rewrites /api/* to |
SMTP_URL |
API | smtps://user%40domain.com:pass@mail.example.com:465 |
Empty: emails print to the console. @ in the user name becomes %40 |
EMAIL_FROM |
API | "Acme <hello@acme.com>" |
Must be allowed by your SMTP provider |
B2BKIT_LICENSE_KEY |
CLI | B2BK-XXXX-XXXX-XXXX |
Kit updates via the CLI (coming) |
Mobile (apps/mobile/.env):
| Variable | Example | Notes |
|---|---|---|
EXPO_PUBLIC_API_URL |
https://api.acme.com |
Defaults to your computer's address on port 3001 in development |
EXPO_PUBLIC_WEB_URL |
https://app.acme.com |
Password reset and invitation links open here |
Demo-only (web build): NEXT_PUBLIC_DEMO_CREDENTIALS shows a demo login on the sign-in page and turns on the demo banner.