Configuration
Environment variables
Inject secrets and runtime config into your app without hardcoding them in your repository.
How it works
Environment variables are set per-project and injected at runtime into the container process. They are never committed to your repository and never appear in build logs.
Variables set in Lofenta take precedence over any .env file that may exist in your repository.
System variables
Lofenta automatically injects the following variables into every container:
PORTThe port your app must listen on. Always bind to this, not a hardcoded port.
LOFENTA_ENVAlways "production". Use this to gate production-only behaviour.
LOFENTA_DEPLOY_IDUnique ID of the current deployment (UUID). Useful for tracing.
LOFENTA_PROJECTYour project slug (e.g. my-app).
Setting variables
The easiest way to manage environment variables is in the dashboard, under Dashboard > Environment for your project. Add, edit, or remove keys there and redeploy to apply them. You can also manage them via the API.
Via API
PUT /api/projects/[id]/env
Content-Type: application/json
[
{ "key": "DATABASE_URL", "value": "postgres://..." },
{ "key": "STRIPE_SECRET_KEY", "value": "sk_live_..." }
]The request body is an array of { key, value } objects. This is a replace-all operation: the array you send becomes the complete set of variables.
Removing a variable
To remove a variable, omit its key from the array you send. Any key not present in the request is deleted.
Build-time variables
Variables are available both at build time (during npm run build) and at runtime (when your server process is running).
NEXT_PUBLIC_ are inlined into the client bundle. Server-only secrets do not need any prefix.Secrets vs plain values
All environment variables are stored encrypted at rest using AES-256. Values are decrypted only at deployment time and injected directly into the container environment. They are never written to disk in plaintext.
Limits
Next
Build configuration
Override build commands and install steps