Server configuration
The back end reads its settings from environment variables (or from the .env file at the
repository root). The .env.example file lists every key, without values. In development, all of
them have defaults that work with no configuration.
Back end
| Variable | Default (development) | Description |
|---|---|---|
DATABASE_URL |
The Docker Compose Postgres | Database connection (asyncpg driver). |
ENVIRONMENT |
development |
development or production. Turns on the production safeguards. |
SERVICE_NAME |
modulecad-api |
Service identification in the logs. |
CORS_ORIGINS |
http://localhost:5173,http://localhost:4173 |
Allowed browser origins, comma-separated. |
APP_BASE_URL |
http://localhost:5173 |
The app’s public address, used in email links. No trailing slash. |
MAILER |
log |
log (prints emails to the console) or disabled (drops them). |
TRUST_PROXY_HEADERS |
false |
Trust X-Forwarded-For to identify the client IP. Only behind a proxy that rewrites the header. |
MAX_REQUEST_BYTES |
20971520 (20 MB) |
Maximum size of a request body. |
ALLOW_COMPANY_CREATE_ON_SIGNUP |
true |
Allows creating a company at sign-up. |
SEED_PASSWORD |
seedpass1 |
Password of the demo accounts created by the seed. |
OPENROUTER_API_KEY |
(empty) | OpenRouter key. Without it, the AI assistant is off (503 ai_disabled); everything else works normally. |
OPENROUTER_MODEL |
anthropic/claude-sonnet-4.5 |
Model used by the assistant. |
AI_MAX_MESSAGE_CHARS |
500 |
Maximum size of a user message. |
AI_HISTORY_LIMIT |
8 |
History messages sent to the model. |
AI_MAX_HISTORY_CHARS |
24000 |
Total character limit of the history. |
AI_RATE_PER_MIN |
5 |
AI requests per user per minute. |
AI_SIR_KEY |
(derived, development only) | Fernet key that encrypts the furniture’s intermediate representation sent to the client. |
AI_MODEL_PRICES |
(internal table) | JSON with per-model prices, used only to estimate costs in the logs. |
Production safeguards
With ENVIRONMENT=production, the server refuses to start when:
DATABASE_URLis still the default development credential;CORS_ORIGINSonly contains thelocalhostorigins;ALLOW_COMPANY_CREATE_ON_SIGNUPisn’t explicitlyfalse;OPENROUTER_API_KEYis set butAI_SIR_KEYisn’t;MAILERislog(password reset tokens would show up in the logs) — you have to setMAILER=disabledon purpose or configure a real provider.
The seed script also refuses to use the default password in production and never runs --wipe in
production.
Front end
| Variable | Default | Description |
|---|---|---|
VITE_API_URL |
http://localhost:8090 |
The API’s address. Read at build time and baked into the bundle — changing it needs a new build. |
Today only the log and disabled modes exist. In the current production installation sending is
disabled, so verification and password reset emails are not delivered.
Deployment
The SPA is published on Netlify from the monorepo (netlify.toml); commits that only change
services/api/**, docs/**, design-system/** or *.md files don’t trigger a build. The API and
Postgres run with Docker Compose (compose.yaml + compose.prod.yaml) behind Caddy.
The operational step by step — provisioning, DNS, deploy, rollback and a contingency plan for demos —
is in docs/deployment.md. The migration to a k3s cluster on Hetzner is documented in
docs/architecture/infrastructure.md.