NexosNexos

Environment Variables

Env vars hold secrets and config your app reads at boot. Nexos encrypts every value at rest with AES-256-GCM and injects them into every preview environment.

Two kinds. Variables you set (API keys, flags) and variables Nexos injects automatically (DATABASE_URL, REDIS_URL, PORT, S3 credentials). Both appear in process.env.

Auto-injected variables

Set automatically when the corresponding service is enabled. Do not define these yourself.

VariableWhen it's setExample
PORTAlways3000
DATABASE_URLPostgres enabledpostgresql://user:pass@host:5432/app
REDIS_URLRedis enabledredis://host:6379
MONGODB_URLMongoDB enabledmongodb://user:pass@host:27017/app
ELASTICSEARCH_URLElasticsearch enabledhttp://host:9200
S3_ENDPOINT, S3_ACCESS_KEY, S3_SECRET_KEY, S3_BUCKETMinIO enabledhttp://host:9000, …
SMTP_HOST, SMTP_PORTMailHog enabledhost, 1025

Setting your own variables

Three ways to set them:

  • Dashboard — Project Settings → Environment Variables.
  • nexos.yamlenv: block. Good for non-secret config. See nexos.yaml.
  • Bulk .env import — paste or upload a .env file in the dashboard. Existing keys are updated; new keys created.

Listed values are masked — only the first four characters are shown. For real secrets, prefer the dashboard over committed YAML.

Encryption at rest

Every value is AES-256-GCM encrypted with a unique random IV before it lands in the database. The plaintext is decrypted only at deploy time, when the value is injected into the container. The encryption key is configured on the API server via ENCRYPTION_KEY (a 32-byte hex string).

API

# Create or update
curl -X PUT https://api.nexos.rs/api/projects/:id/env-vars \
  -H "Authorization: Bearer nxs_..." \
  -H "Content-Type: application/json" \
  -d '{"key": "STRIPE_SECRET_KEY", "value": "sk_test_..."}'

# List (values masked)
curl https://api.nexos.rs/api/projects/:id/env-vars \
  -H "Authorization: Bearer nxs_..."

# Delete
curl -X DELETE https://api.nexos.rs/api/projects/:id/env-vars/:varId \
  -H "Authorization: Bearer nxs_..."