This comprehensive reference covers all environment variables available in nself. These variables allow you to customize every aspect of your deployment without modifying code.
Never commit environment files to version control. Use strong, unique passwords for all services in production.
Variable | Default | Description |
---|---|---|
PROJECT_NAME | nself-backend | Name of your project, used in Docker container names |
ENV | dev | Environment type: dev, prod (v0.2.1+) |
ENVIRONMENT | development | Legacy environment variable (deprecated, use ENV) |
DEBUG | true | Enable debug mode (development only) |
LOG_LEVEL | info | Logging level: debug, info, warn, error |
Variable | Default | Description |
---|---|---|
DOMAIN | local.nself.org | Primary domain for your deployment |
SUBDOMAIN_PREFIX | (empty) | Prefix for service subdomains |
SSL_MODE | none | SSL provider (letsencrypt, custom, self-signed, none) |
FORCE_SSL | false | Redirect HTTP to HTTPS |
Variable | Default | Description |
---|---|---|
POSTGRES_DB | postgres | Database name |
POSTGRES_USER | postgres | Database user |
POSTGRES_PASSWORD | postgres | Database password (⚠️ Change in production) |
POSTGRES_HOST | postgres | Database host |
POSTGRES_PORT | 5432 | Database port |
Variable | Default | Description |
---|---|---|
POSTGRES_MAX_CONNECTIONS | 100 | Maximum concurrent connections |
POSTGRES_SHARED_BUFFERS | 128MB | Shared buffer pool size |
POSTGRES_EFFECTIVE_CACHE_SIZE | 4GB | Effective cache size for query planning |
POSTGRES_WORK_MEM | 4MB | Memory for query operations |
POSTGRES_MAINTENANCE_WORK_MEM | 64MB | Memory for maintenance operations |
Variable | Default | Description |
---|---|---|
DB_AUTO_MIGRATE | false | Automatically run migrations on startup |
DB_SEED_ON_INIT | true | Run seeding scripts on first startup |
DB_ENV_SEEDS | true | Use environment-specific seed directories (v0.2.1+) |
BACKUP_ENABLED | false | Enable automated backups |
BACKUP_SCHEDULE | 0 2 * * * | Backup schedule (cron format) |
BACKUP_RETENTION | 7 | Number of backups to retain |
Variable | Default | Description |
---|---|---|
HASURA_GRAPHQL_ADMIN_SECRET | myadminsecret | Admin secret for console access (⚠️ Change in production) |
HASURA_GRAPHQL_JWT_SECRET | {"type":"HS256","key":"secret"} | JWT configuration for authentication |
HASURA_GRAPHQL_ENABLE_CONSOLE | true | Enable web console (disable in production) |
HASURA_GRAPHQL_DEV_MODE | true | Enable development mode features |
HASURA_GRAPHQL_UNAUTHORIZED_ROLE | anonymous | Default role for unauthenticated users |
Variable | Default | Description |
---|---|---|
HASURA_GRAPHQL_QUERY_DEPTH_LIMIT | 10 | Maximum query depth allowed |
HASURA_GRAPHQL_NODE_LIMIT | 100 | Maximum nodes per query |
HASURA_GRAPHQL_BATCH_SIZE | 100 | Maximum batch size for mutations |
HASURA_GRAPHQL_PG_CONNECTIONS | 50 | PostgreSQL connection pool size |
HASURA_GRAPHQL_PG_TIMEOUT | 180 | PostgreSQL connection timeout (seconds) |
Variable | Default | Description |
---|---|---|
HASURA_GRAPHQL_LOG_LEVEL | info | Logging level |
HASURA_GRAPHQL_ENABLED_LOG_TYPES | startup,http-log | Types of logs to enable |
HASURA_GRAPHQL_STRUCTURED_LOGGING | true | Enable structured JSON logging |
Variable | Default | Description |
---|---|---|
REDIS_ENABLED | true | Enable Redis service |
REDIS_HOST | redis | Redis host |
REDIS_PORT | 6379 | Redis port |
REDIS_PASSWORD | (empty) | Redis password (set for production) |
REDIS_DB | 0 | Redis database number |
Variable | Default | Description |
---|---|---|
REDIS_MAXMEMORY | 256MB | Maximum memory usage |
REDIS_MAXMEMORY_POLICY | allkeys-lru | Eviction policy when memory limit is reached |
REDIS_TCP_KEEPALIVE | 300 | TCP keepalive timeout |
REDIS_TIMEOUT | 0 | Client connection timeout (0 = no timeout) |
Variable | Default | Description |
---|---|---|
MINIO_ENABLED | true | Enable MinIO service |
MINIO_ROOT_USER | minioadmin | MinIO admin username (⚠️ Change in production) |
MINIO_ROOT_PASSWORD | minioadmin | MinIO admin password (⚠️ Change in production) |
MINIO_DEFAULT_BUCKETS | uploads,avatars,documents | Buckets to create on startup |
Variable | Default | Description |
---|---|---|
MINIO_API_PORT | 9000 | MinIO API port |
MINIO_CONSOLE_PORT | 9001 | MinIO web console port |
MINIO_DATA_DIR | ./storage/minio/data | Data storage directory |
MINIO_CONFIG_DIR | ./storage/minio/config | Configuration directory |
Variable | Default | Description |
---|---|---|
NESTJS_SERVICES | (empty) | Comma-separated list of NestJS services |
NESTJS_VERSION | 10.x | NestJS framework version |
NESTJS_PORT_START | 3000 | Starting port for NestJS services |
NESTJS_CORS_ENABLED | true | Enable CORS for NestJS services |
Variable | Default | Description |
---|---|---|
PYTHON_SERVICES | (empty) | Comma-separated list of Python services |
PYTHON_VERSION | 3.11 | Python version to use |
PYTHON_PORT_START | 8000 | Starting port for Python services |
PYTHON_FRAMEWORK | fastapi | Python framework: fastapi, flask, django |
Variable | Default | Description |
---|---|---|
GOLANG_SERVICES | (empty) | Comma-separated list of Go services |
GOLANG_VERSION | 1.21 | Go version to use |
GOLANG_PORT_START | 8080 | Starting port for Go services |
GOLANG_CGO_ENABLED | 0 | Enable/disable CGO |
Variable | Default | Description |
---|---|---|
SSL_MODE | none | Select SSL provider |
SSL_CERT_PATH | /etc/ssl/certs/server.crt | SSL certificate file path |
SSL_KEY_PATH | /etc/ssl/private/server.key | SSL private key file path |
FORCE_SSL | false | Redirect HTTP to HTTPS |
Variable | Default | Description |
---|---|---|
LETSENCRYPT_EMAIL | admin@example.com | Email for Let's Encrypt registration |
LETSENCRYPT_DOMAINS | example.com,api.example.com | Domains for SSL certificates |
Variable | Default | Description |
---|---|---|
POSTGRES_MEMORY_LIMIT | 1024MB | PostgreSQL memory limit |
HASURA_MEMORY_LIMIT | 512MB | Hasura memory limit |
REDIS_MEMORY_LIMIT | 256MB | Redis memory limit |
MINIO_MEMORY_LIMIT | 512MB | MinIO memory limit |
Variable | Default | Description |
---|---|---|
POSTGRES_CPU_LIMIT | 1.0 | PostgreSQL CPU limit (cores) |
HASURA_CPU_LIMIT | 0.5 | Hasura CPU limit (cores) |
REDIS_CPU_LIMIT | 0.3 | Redis CPU limit (cores) |
MINIO_CPU_LIMIT | 0.5 | MinIO CPU limit (cores) |
Variable | Default | Description |
---|---|---|
MAILHOG_ENABLED | true | Enable email testing service |
NHOST_DASHBOARD_ENABLED | true | Enable Nhost dashboard |
ADMINER_ENABLED | false | Enable database browser |
SWAGGER_ENABLED | true | Enable API documentation |
Variable | Default | Description |
---|---|---|
BULLMQ_WORKERS | (empty) | Comma-separated list of BullMQ workers |
FUNCTIONS_ENABLED | false | Enable serverless functions |
FUNCTIONS_RUNTIME | node | Functions runtime: node, python, go |
# .env.local - Development
PROJECT_NAME=my-app
ENV=dev # New in v0.2.1
DEBUG=true
# Database
POSTGRES_PASSWORD=dev_password
POSTGRES_DB=myapp_dev
# Services
REDIS_ENABLED=true
MAILHOG_ENABLED=true
NHOST_DASHBOARD_ENABLED=true
# Development domains
DOMAIN=local.nself.org
SSL_MODE=none
# .env.prod-template - Production template
# Copy to .env before deployment
PROJECT_NAME=my-app
ENV=prod # New in v0.2.1
DEBUG=false
LOG_LEVEL=warn
# Database with strong password
POSTGRES_PASSWORD=very-secure-production-password
POSTGRES_DB=myapp
# Security
HASURA_GRAPHQL_ADMIN_SECRET=very-secure-admin-secret
HASURA_GRAPHQL_JWT_SECRET={"type":"HS256","key":"very-long-jwt-secret-key"}
# SSL
DOMAIN=api.myapp.com
SSL_MODE=letsencrypt
LETSENCRYPT_EMAIL=admin@myapp.com
# Performance
POSTGRES_MEMORY_LIMIT=2048MB
HASURA_MEMORY_LIMIT=1024MB
REDIS_MEMORY_LIMIT=512MB
# Disable development services
MAILHOG_ENABLED=false
NHOST_DASHBOARD_ENABLED=false
Copy .env.prod-template
to .env
before deployment.
Now that you understand environment variables:
Environment variables provide flexible configuration for all aspects of your nself deployment. Use them to customize your setup without modifying code.