Skip to main content

Environment Variables

Backend

VariableRequiredDefaultDescription
DATABASE_URLYesPostgreSQL connection string. Format: postgres://user:password@host:port/dbname
JWT_SECRETYesSecret key used to sign and verify JWT tokens. Minimum 32 characters.
PORTYesPort the HTTP server listens on.
HOSTNo0.0.0.0Bind address. Use 0.0.0.0 to accept connections from any interface.
ALLOWED_ORIGINNohttp://localhost:3000CORS allowed origin for the management API. Comma-separated for multiple origins. Use * to allow all (not recommended in production).
RUST_LOGNoinfoLog level. Options: error, warn, info, debug, trace.

Frontend

VariableRequiredDefaultDescription
VITE_API_URLYeshttp://localhost:8080Base URL of the backend API. Set as a build-time argument. Vite inlines this into the bundle at compile time, not runtime.
VITE_API_URL is a build argument

VITE_API_URL must be set before the frontend Docker image is built, not at runtime. If you change the API URL, rebuild the image.

docker build --build-arg VITE_API_URL=https://api.yourhost.com -t frontend .

Generating a JWT secret

openssl rand -base64 48

Use the output as your JWT_SECRET. Keep it out of source control. Store it in a secrets manager or your platform's environment variable UI.

Example .env

.env
DATABASE_URL=postgres://postgres:yourpassword@localhost:5432/featureflags
JWT_SECRET=Sx7kQpZ3mNvRtY9wXjLbCdFhGaEiKuOp...
PORT=8080
HOST=0.0.0.0
ALLOWED_ORIGIN=https://ffs.yourhost.com
RUST_LOG=info