Configuration principles
Secrets and deployment-specific values live in environment variables. Behaviour that should be identical across deployments lives in code. That split keeps configuration predictable and avoids silent divergence between environments.
Do not set NODE_ENV in an environment file. The build and start commands set it correctly.
Environment categories
The application reads database, Supabase, domain, bootstrap admin, analytics, and AI provider values. The repository's .env.example is the authoritative list; treat it as the source of truth when a new variable is added.
- Database: DATABASE_URL, DIRECT_URL
- Supabase: URL, anon key, service role key, storage bucket names
- Application: NEXT_PUBLIC_APP_DOMAIN, session and auth settings
- Bootstrap: admin email, password, and display name
- AI: GOOGLE_GENERATIVE_AI_API_KEY, REPLICATE_API_TOKEN
- Analytics: GOOGLE_ANALYTICS_ID (optional, production only)
Behavioural constants
Pagination defaults, ERP module visibility, quote/invoice reference length, and toast behaviour are code constants, not environment variables. They are intentionally shared across deployments.
If you need a different page size or module set, change the constant and rebuild. This avoids environments drifting apart through undocumented env tweaks.
Translations and storage
The ERP translations are JSON files stored in Supabase Storage. The application fetches the locale file at request time and caches it. Public marketing pages are English and do not depend on the translation catalog.
Business files use Supabase buckets: a public bucket for assets such as the logo, and a private bucket for uploads and generated report PDFs. Private files are served through authenticated URLs.
Changing the deployment domain
Set NEXT_PUBLIC_APP_DOMAIN to the public origin, including the scheme. Update the Supabase Auth redirect URLs to match. If you add a custom domain, configure DNS and TLS at your host before switching the variable.
Frequently asked questions
Can I change pagination with an environment variable?
No. Page size defaults and maximums are code constants. Change them in the constants file and rebuild.
Where do I set the AI keys?
In the deployment environment: GOOGLE_GENERATIVE_AI_API_KEY for business agents and REPLICATE_API_TOKEN for the AI Image Studio.