Skip to content

Environment Variables

Configuration for the pipel8ne backend is done through environment variables, typically set in a .env file at the project root.

Required variables

These must be set before starting the server. The application will refuse to start if they are missing.

JWT_SECRET

Secret key used to sign and verify JSON Web Tokens.

Requirements:

  • Any string, but should be long and random (64+ hex characters recommended)
  • Keep this private — anyone with this value can forge authentication tokens

Generate:

bash
node -e "console.log(require('crypto').randomBytes(64).toString('hex'))"

SECRETS_ENCRYPTION_KEY

Key used to encrypt credentials stored in the vault (AES-256-GCM).

Requirements:

  • Exactly 32 bytes (64 hex characters)
  • If you change this key, all previously stored credentials become unreadable

Generate:

bash
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"

DANGER

Back up this key. If you lose it, all credentials stored in the vault are permanently unrecoverable.


DATABASE_URL

MongoDB connection string.

Format:

mongodb://[username:password@]host[:port]/database[?options]

Examples:

env
# Local development
DATABASE_URL=mongodb://pipel8ne:dev_password@localhost:27017/pipel8ne_dev?authSource=admin

# MongoDB Atlas
DATABASE_URL=mongodb+srv://user:password@cluster.mongodb.net/pipel8ne?retryWrites=true&w=majority

# Docker Compose (internal network)
DATABASE_URL=mongodb://pipel8ne:password@mongo:27017/pipel8ne?authSource=admin

Optional variables

NODE_ENV

Controls runtime behavior.

ValueEffect
developmentEnables Swagger UI at /docs, verbose logging
productionDisables Swagger UI, minimal logging

Default: development


PORT

The port the HTTP server listens on.

Default: 3000


Full .env example

env
# Required
DATABASE_URL=mongodb://pipel8ne:dev_password@localhost:27017/pipel8ne_dev?authSource=admin
JWT_SECRET=your_64_hex_char_jwt_secret_here
SECRETS_ENCRYPTION_KEY=your_64_hex_char_encryption_key_here

# Optional
NODE_ENV=development
PORT=3000

Docker Compose

When using Docker Compose, variables can be set in .env at the project root. Docker Compose automatically loads this file:

yaml
# docker-compose.yml (excerpt)
services:
  backend:
    env_file: .env

Or inline in the compose file:

yaml
services:
  backend:
    environment:
      - JWT_SECRET=${JWT_SECRET}
      - SECRETS_ENCRYPTION_KEY=${SECRETS_ENCRYPTION_KEY}
      - DATABASE_URL=mongodb://pipel8ne:${MONGO_PASSWORD}@mongo:27017/pipel8ne

Released under the MIT License.