Generate docker-compose.yml, nginx reverse-proxy configs, and SSL certificates from your .env file. Run this every time you change .env before calling nself start.
Never hand-edit generated files
docker-compose.yml and nginx/ are fully generated by nself build. Any manual edits will be overwritten on the next build. Put customizations in .env or in nginx/conf.d/*.conf (hand-managed, never overwritten).
# Standard workflow: edit .env, build, start
nself build
nself start
# Preview what would be generated without writing files
nself build --dry-run
# Validate your .env before building
nself build --validatenself build [FLAGS]nself build reads your project .env file (following the cascade.env.dev → .env.local → .env.staging/.env.prod → .env.secrets → .env.computed) and generates the complete infrastructure definition:
.conf fragment per service, assembled into the main nginx config by the Nginx container at startup..env.The generated docker-compose.yml carries the header comment # GENERATED BY nself build — DO NOT HAND EDIT. This is intentional: the file is owned by the build step, not by you. All configuration belongs in .env.
| Flag | Default | Description |
|---|---|---|
--dry-run | false | Preview the generated files to stdout without writing them to disk |
--validate | false | Validate .env configuration (type checks, required fields, port conflicts) before generating |
--force | false | Overwrite existing generated files without prompting |
--clean | false | Remove previously generated files before building (equivalent to running nself clean first) |
--env NAME | active env | Target a specific environment: dev, staging, or prod |
--verbose, -v | false | Show each generated file path and its service mapping |
--quiet, -q | false | Suppress all output except errors |
project/
├── docker-compose.yml # GENERATED — main Docker Compose config
├── nginx/
│ ├── nginx.conf # GENERATED — root nginx config (do not edit)
│ ├── sites/
│ │ ├── hasura.conf # GENERATED — per-service fragments
│ │ ├── auth.conf
│ │ ├── storage.conf
│ │ └── ...
│ └── conf.d/ # HAND-MANAGED — safe to edit, never overwritten
│ └── custom.conf
└── ssl/
├── cert.pem # GENERATED — TLS certificate
└── key.pem # GENERATED — TLS private key# The standard sequence after any .env change:
nself build
nself start# Catch .env errors before generating files
nself build --validate
# Validate and preview (no disk writes)
nself build --validate --dry-run# Build for staging (loads .env.staging)
nself build --env staging
# Build for production (loads .env.prod)
nself build --env prod# Remove stale generated files, then rebuild from scratch
nself build --clean --forcenself build --verbose
# Generated: docker-compose.yml (12 services)
# Generated: nginx/nginx.conf
# Generated: nginx/sites/hasura.conf
# Generated: nginx/sites/auth.conf
# ....env, .env.dev, .env.staging, or .env.prodnself plugin install/remove