Commands - nself-org/nchat GitHub Wiki
Version: v1.0.9 Last Updated: April 18, 2026 Complete command reference for nself CLI
- Global Options
- Project Commands
- Service Commands
- Database Commands
- Development Commands
- Utility Commands
- Advanced Commands
- Environment Variables
Available for all commands:
nself [command] [options]
Global Flags:
--help, -h Show help for any command
--version, -v Show nself CLI version
--verbose Enable verbose output
--quiet, -q Suppress non-error output
--config FILE Use custom config file
--project-dir DIR Specify project directory (default: .backend)Initialize a new nself project.
Syntax:
nself init [PROJECT_NAME] [options]Options:
--template, -t TEMPLATE Use project template (default, minimal, full)
--demo Initialize with demo data
--no-ssl Skip SSL certificate generation
--domain DOMAIN Set custom domain (default: localhost)
--env ENV Set environment (dev, staging, prod)Examples:
# Basic initialization
nself init my-app
# Initialize with demo data
nself init my-app --demo
# Minimal setup (core services only)
nself init my-app --template minimal
# Full setup (all services enabled)
nself init my-app --template full
# Custom domain
nself init my-app --domain myapp.local
# Production environment
nself init my-app --env prodGenerated Structure:
PROJECT_NAME/
└── .backend/
├── .env # Environment variables
├── docker-compose.yml # Service definitions
├── hasura/
│ ├── metadata/ # Hasura metadata
│ └── migrations/ # Database migrations
├── nginx/
│ ├── nginx.conf # Nginx config
│ └── conf.d/ # Site configs
├── postgres/
│ └── init/ # Init scripts
└── ssl/
└── certificates/ # SSL certs
Generate or update docker-compose.yml file.
Syntax:
nself build [options]Options:
--update Update existing configuration
--force Overwrite without confirmation
--services SERVICES Enable specific services (comma-separated)
--monitoring Enable monitoring bundle
--output FILE Output to specific fileExamples:
# Regenerate docker-compose.yml
nself build
# Update with new services
nself build --update --services redis,minio
# Enable monitoring
nself build --monitoring
# Force overwrite
nself build --forceStart all or specific services.
Syntax:
nself start [SERVICE...] [options]Options:
--detach, -d Run in background (default)
--build Build images before starting
--force-recreate Recreate containers
--no-deps Don't start linked services
--scale SERVICE=NUM Scale service to NUM instances
--wait Wait for services to be healthyExamples:
# Start all services
nself start
# Start specific services
nself start postgres hasura
# Start with rebuild
nself start --build
# Start and wait for healthy
nself start --wait
# Scale Hasura to 3 instances
nself start --scale hasura=3
# Start in foreground (view logs)
nself start --no-detachService Names:
-
postgres- PostgreSQL database -
hasura- Hasura GraphQL Engine -
auth- Nhost Auth service -
nginx- Nginx reverse proxy -
minio- MinIO object storage -
storage- Hasura Storage service -
redis- Redis cache -
mailpit- Email testing -
functions- Serverless functions -
meilisearch- Full-text search -
mlflow- ML tracking
Stop all or specific services.
Syntax:
nself stop [SERVICE...] [options]Options:
--timeout, -t SECONDS Shutdown timeout (default: 10)Examples:
# Stop all services
nself stop
# Stop specific services
nself stop hasura auth
# Stop with 30s timeout
nself stop --timeout 30
# Stop immediately (force)
nself stop --timeout 0Restart all or specific services.
Syntax:
nself restart [SERVICE...] [options]Options:
--timeout, -t SECONDS Shutdown timeout
--no-deps Don't restart linked servicesExamples:
# Restart all services
nself restart
# Restart specific service
nself restart hasura
# Restart with quick timeout
nself restart --timeout 5Show status of all services.
Syntax:
nself status [options]Options:
--format FORMAT Output format (table, json, yaml)
--watch, -w Continuously watch statusExamples:
# Show status (default table format)
nself status
# JSON output
nself status --format json
# Watch status (refresh every 2s)
nself status --watch
# YAML output
nself status --format yamlOutput:
Service Status Health Port Uptime
─────────────────────────────────────────────────
postgres running healthy 5432 2h 15m
hasura running healthy 8080 2h 14m
auth running healthy 4000 2h 14m
nginx running healthy 80/443 2h 14m
redis running healthy 6379 2h 14m
minio running healthy 9000 2h 14m
storage running healthy 5001 2h 13m
mailpit running healthy 8025 2h 13m
View service logs.
Syntax:
nself logs [SERVICE...] [options]Options:
--follow, -f Follow log output
--tail LINES Number of lines to show (default: 100)
--since TIME Show logs since timestamp
--until TIME Show logs until timestamp
--timestamps, -t Show timestamps
--no-color Disable colored outputExamples:
# View all logs
nself logs
# Follow specific service
nself logs -f hasura
# Last 50 lines
nself logs --tail 50
# Multiple services
nself logs postgres hasura auth
# Since 1 hour ago
nself logs --since 1h
# With timestamps
nself logs -f -t hasura
# Last 30 minutes
nself logs --since 30m --until nowList running containers.
Syntax:
nself ps [options]Options:
--all, -a Show all containers (including stopped)
--quiet, -q Only show container IDs
--services Show service namesExamples:
# List running containers
nself ps
# Show all (including stopped)
nself ps --all
# Just container IDs
nself ps --quiet
# Service names only
nself ps --servicesStop and remove containers.
Syntax:
nself down [options]Options:
--volumes, -v Remove volumes
--remove-orphans Remove orphaned containers
--timeout SECONDS Shutdown timeoutExamples:
# Stop and remove containers
nself down
# Also remove volumes (WARNING: deletes data!)
nself down --volumes
# Remove orphaned containers
nself down --remove-orphans
# Quick shutdown
nself down --timeout 0Execute command in a running service.
Syntax:
nself exec [SERVICE] [COMMAND]Options:
--user, -u USER Run as user
--workdir DIR Working directory
--env KEY=VALUE Set environment variable
--detach, -d Detached mode
--interactive, -i Interactive mode
--tty, -t Allocate pseudo-TTYExamples:
# Open PostgreSQL shell
nself exec postgres psql -U postgres
# Run Hasura console command
nself exec hasura hasura-cli console
# Interactive shell
nself exec -it postgres bash
# Run as specific user
nself exec --user postgres postgres psql
# Execute with environment variable
nself exec --env DEBUG=true hasura node index.jsRun database migrations.
Syntax:
nself db:migrate [DIRECTION] [options]Directions:
-
up- Apply migrations (default) -
down- Rollback migrations -
status- Show migration status -
version- Show current version
Options:
--step, -s NUMBER Number of migrations to apply/rollback
--version VERSION Migrate to specific version
--all Apply all pending migrations
--dry-run Show what would be executedExamples:
# Apply all pending migrations
nself db:migrate up
# Rollback last migration
nself db:migrate down
# Rollback 3 migrations
nself db:migrate down --step 3
# Migrate to specific version
nself db:migrate --version 20260101120000
# Show migration status
nself db:migrate status
# Dry run
nself db:migrate up --dry-runCreate new database migration.
Syntax:
nself db:create [NAME] [options]Options:
--sql FILE Use SQL file
--type TYPE Migration type (sql, hasura)
--timestamp Add timestamp to nameExamples:
# Create migration
nself db:create create_users_table
# From SQL file
nself db:create --sql schema.sql add_users
# Hasura migration
nself db:create --type hasura add_permissionsSeed database with data.
Syntax:
nself db:seed [FILE] [options]Options:
--env ENV Environment (dev, staging, prod)
--force Overwrite existing dataExamples:
# Run default seed file
nself db:seed
# Specific seed file
nself db:seed seeds/users.sql
# Force seed (clear existing)
nself db:seed --forceReset database (WARNING: destructive!).
Syntax:
nself db:reset [options]Options:
--force Skip confirmation
--seed Run seeds after resetExamples:
# Reset database (will ask confirmation)
nself db:reset
# Reset and seed
nself db:reset --seed
# Force reset (no confirmation)
nself db:reset --forceBackup database to file.
Syntax:
nself db:dump [FILE] [options]Options:
--format FORMAT Output format (sql, custom, tar)
--compress Compress output
--schema-only Only dump schema
--data-only Only dump dataExamples:
# Dump to default file
nself db:dump
# Dump to specific file
nself db:dump backup.sql
# Compressed backup
nself db:dump backup.sql.gz --compress
# Schema only
nself db:dump schema.sql --schema-onlyRestore database from backup.
Syntax:
nself db:restore [FILE] [options]Options:
--force Drop existing database
--clean Clean before restoreExamples:
# Restore from file
nself db:restore backup.sql
# Force restore (drop existing)
nself db:restore backup.sql --force
# Clean restore
nself db:restore backup.sql --cleanOpen Hasura Console.
Syntax:
nself console [options]Options:
--port PORT Console port (default: 9695)
--no-browser Don't open browserExamples:
# Open console
nself console
# Custom port
nself console --port 9696
# Don't auto-open browser
nself console --no-browserShow all service URLs.
Syntax:
nself urls [options]Options:
--format FORMAT Output format (table, json, list)Examples:
# Show URLs (table format)
nself urls
# JSON format
nself urls --format json
# Simple list
nself urls --format listOutput:
Service URL
────────────────────────────────────────────────
GraphQL API http://api.localhost/v1/graphql
Hasura Console http://localhost:8080/console
Auth API http://auth.localhost/v1/auth
Storage API http://storage.localhost/v1/storage
MinIO Console http://localhost:9001
Email Testing http://localhost:8025
PostgreSQL localhost:5432
Redis localhost:6379
Diagnose common issues.
Syntax:
nself doctor [options]Options:
--fix Attempt to fix issues
--verbose Show detailed diagnosticsExamples:
# Run diagnostics
nself doctor
# Fix issues automatically
nself doctor --fix
# Verbose output
nself doctor --verboseChecks:
- Docker installation
- Docker Compose version
- Port availability
- Disk space
- Memory available
- Service health
- Network connectivity
- Configuration validity
Start development mode with hot reload.
Syntax:
nself dev [options]Options:
--watch Watch for file changes
--reload Auto-reload on changesExamples:
# Start dev mode
nself dev
# With file watching
nself dev --watch
# Auto-reload services
nself dev --reloadManage configuration.
Syntax:
nself config [SUBCOMMAND] [options]Subcommands:
get KEY Get configuration value
set KEY VALUE Set configuration value
list List all configuration
edit Edit configuration file
validate Validate configuration
reset Reset to defaultsExamples:
# List all config
nself config list
# Get specific value
nself config get PROJECT_NAME
# Set value
nself config set REDIS_ENABLED true
# Edit config file
nself config edit
# Validate config
nself config validate
# Reset to defaults
nself config resetManage environment variables.
Syntax:
nself env [SUBCOMMAND]Subcommands:
list List all variables
get KEY Get variable value
set KEY VALUE Set variable value
unset KEY Remove variable
export Export to .env file
import FILE Import from fileExamples:
# List all env vars
nself env list
# Get value
nself env get DATABASE_URL
# Set value
nself env set REDIS_ENABLED true
# Export to file
nself env export > .env.backup
# Import from file
nself env import .env.backupCreate backup of project.
Syntax:
nself backup [options]Options:
--output DIR Output directory
--compress Compress backup
--database-only Only backup database
--config-only Only backup configurationExamples:
# Full backup
nself backup
# Backup to specific directory
nself backup --output backups/
# Compressed backup
nself backup --compress
# Database only
nself backup --database-onlyRestore from backup.
Syntax:
nself restore [BACKUP_FILE] [options]Options:
--force Overwrite existing
--database-only Only restore database
--config-only Only restore configExamples:
# Restore from backup
nself restore backup-2026-02-01.tar.gz
# Force restore
nself restore backup.tar.gz --force
# Database only
nself restore backup.tar.gz --database-onlyClean up Docker resources.
Syntax:
nself clean [options]Options:
--all Remove all resources
--volumes Remove volumes
--images Remove images
--force Skip confirmationExamples:
# Clean stopped containers
nself clean
# Clean everything (WARNING!)
nself clean --all
# Remove volumes
nself clean --volumes
# Force clean
nself clean --all --forceUpgrade nself CLI.
Syntax:
nself upgrade [options]Options:
--version VERSION Upgrade to specific version
--check Only check for updatesExamples:
# Upgrade to latest
nself upgrade
# Check for updates
nself upgrade --check
# Upgrade to specific version
nself upgrade --version v0.4.2Manage Docker networks.
Syntax:
nself network [SUBCOMMAND]Subcommands:
create Create network
remove Remove network
inspect Inspect network
list List networksExamples:
# List networks
nself network list
# Inspect network
nself network inspect
# Recreate network
nself network remove
nself network createManage Docker volumes.
Syntax:
nself volume [SUBCOMMAND]Subcommands:
list List volumes
inspect VOLUME Inspect volume
remove VOLUME Remove volume
prune Remove unused volumesExamples:
# List volumes
nself volume list
# Inspect postgres volume
nself volume inspect postgres_data
# Remove specific volume
nself volume remove redis_data
# Remove unused volumes
nself volume pruneView service metrics.
Syntax:
nself metrics [SERVICE] [options]Options:
--interval SECONDS Update interval (default: 5)
--format FORMAT Output format (table, json)Examples:
# View all metrics
nself metrics
# Specific service
nself metrics postgres
# JSON output
nself metrics --format json
# Update every 2 seconds
nself metrics --interval 2# Project Settings
PROJECT_NAME=my-app
BASE_DOMAIN=localhost
ENV=dev
# Service Ports
POSTGRES_PORT=5432
HASURA_PORT=8080
REDIS_PORT=6379
MINIO_PORT=9000
# Optional Services
REDIS_ENABLED=true
MINIO_ENABLED=true
MAILPIT_ENABLED=true
MEILISEARCH_ENABLED=false
FUNCTIONS_ENABLED=false
MONITORING_ENABLED=false
NSELF_ADMIN_ENABLED=false
# Database
POSTGRES_DB=myapp_dev
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres-dev-password
# Hasura
HASURA_GRAPHQL_ADMIN_SECRET=hasura-admin-secret-dev
HASURA_GRAPHQL_ENABLE_CONSOLE=true
HASURA_GRAPHQL_DEV_MODE=true
# Auth
AUTH_JWT_REFRESH_TOKEN_EXPIRES_IN=2592000
AUTH_JWT_ACCESS_TOKEN_EXPIRES_IN=900
# Storage
MINIO_ROOT_USER=minioadmin
MINIO_ROOT_PASSWORD=minioadmin
# Development
AUTO_FIX=true
COMPOSE_PROJECT_NAME=${PROJECT_NAME}0 Success
1 General error
2 Misuse of shell command
126 Command cannot execute
127 Command not found
130 Script terminated by Ctrl+CAdd to your shell rc file (.bashrc, .zshrc):
# Short aliases
alias ns='nself'
alias nss='nself status'
alias nsl='nself logs -f'
alias nsr='nself restart'
# Quick commands
alias nsup='nself start'
alias nsdown='nself stop'
alias nslogs='nself logs -f --tail 100'# Continuously monitor status
watch -n 2 nself status
# Or use built-in watch
nself status --watch# Create shell function
db() {
nself exec postgres psql -U postgres -d ${PROJECT_NAME}_dev
}
# Usage
db# View logs from multiple services
nself logs -f postgres hasura auth | grep ERROR# Always backup before major changes
nself db:dump backup-before-change.sql
nself db:migrate up- Learn about Services → Services.md
- Configuration Guide → Configuration.md
- Database Migrations → Migrations.md
- Troubleshooting → Troubleshooting.md
Need help? Run nself --help or nself [command] --help for detailed information.