QUICK REFERENCE CARDS - nself-org/cli GitHub Wiki
Printable cheat sheets for common nself operations.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β nself ESSENTIAL COMMANDS β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β INITIALIZATION β
β ββββββββββββββ β
β nself init # Initialize new project β
β nself init --demo # Initialize with demo configβ
β nself build # Generate infrastructure β
β nself start # Start all services β
β nself stop # Stop all services β
β nself restart # Restart all services β
β β
β STATUS & MONITORING β
β ββββββββββββββββ β
β nself status # Service health status β
β nself logs # View all logs β
β nself logs [service] # View specific service logs β
β nself urls # Show all service URLs β
β nself health # Run health checks β
β β
β DATABASE β
β ββββββββ β
β nself db query "SQL" # Execute SQL query β
β nself db migrate apply # Run migrations β
β nself db backup # Create database backup β
β nself db restore [file] # Restore from backup β
β β
β SERVICES β
β ββββββββ β
β nself admin hasura # Open Hasura Console β
β nself admin minio # Open MinIO Console β
β nself monitor # Open monitoring dashboards β
β β
β DEPLOYMENT β
β ββββββββββ β
β nself deploy push [env] # Deploy to environment β
β nself deploy logs [env] # View remote logs β
β nself deploy exec [env] "cmd" # Execute remote command β
β β
β HELP β
β ββββ β
β nself help # Show help β
β nself version # Show version β
β nself doctor # Run diagnostics β
β β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β nself DATABASE OPERATIONS β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β QUERIES β
β βββββββ β
β nself db query "SELECT * FROM users" β
β nself db query "SELECT * FROM users" --output json β
β nself db execute --file schema.sql β
β nself db psql # Interactive shell β
β β
β MIGRATIONS β
β ββββββββββ β
β nself db migrate create [name] # Create migration β
β nself db migrate apply # Apply migrations β
β nself db migrate rollback # Rollback last β
β nself db migrate status # Migration status β
β β
β BACKUPS β
β βββββββ β
β nself backup create [name] # Create backup β
β nself backup list # List backups β
β nself backup restore [name] # Restore backup β
β nself backup clean --older-than 30d # Remove old backups β
β β
β TENANTS β
β βββββββ β
β nself tenant create [name] # Create tenant β
β nself tenant list # List all tenants β
β nself tenant switch [id] # Switch context β
β nself tenant delete [id] # Delete tenant β
β β
β MAINTENANCE β
β βββββββββββ β
β nself db vacuum # Vacuum database β
β nself db analyze # Update statistics β
β nself db reindex # Rebuild indexes β
β nself db size # Show database size β
β β
β UTILITIES β
β βββββββββ β
β nself db dump > backup.sql # Export database β
β nself db import backup.sql # Import database β
β nself db reset --confirm # Reset database β
β nself db seed # Run seed data β
β β
β CONNECTION β
β ββββββββββ β
β Connection String (internal): β
β postgresql://postgres:password@postgres:5432/dbname β
β β
β Connection String (external): β
β postgresql://postgres:password@localhost:5432/dbname β
β β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β nself DEPLOYMENT WORKFLOW β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β INITIAL SETUP β
β βββββββββββββ β
β 1. Create server.json with connection info: β
β { β
β "production": { β
β "host": "your-server.com", β
β "user": "root", β
β "port": 22 β
β } β
β } β
β β
β 2. Test connection: β
β ssh [email protected] β
β β
β FIRST DEPLOYMENT β
β ββββββββββββββββ β
β nself deploy provision --server your-server.com β
β # Installs Docker, Docker Compose, sets up firewall β
β β
β nself deploy push production β
β # Copies files, builds services, starts containers β
β β
β nself deploy exec production "nself db migrate apply" β
β # Run migrations on server β
β β
β SSL SETUP β
β βββββββββ β
β nself deploy exec production \ β
β "nself auth ssl cert --domain yourdomain.com \ β
β --email [email protected]" β
β β
β SUBSEQUENT DEPLOYMENTS β
β ββββββββββββββββββββββ β
β # Make code changes locally β
β git add . β
β git commit -m "Feature: xyz" β
β β
β # Test locally β
β nself build β
β nself start β
β β
β # Deploy to production β
β nself deploy push production β
β β
β # Run migrations if needed β
β nself deploy exec production "nself db migrate apply" β
β β
β # Verify deployment β
β nself deploy exec production "nself health" β
β nself deploy logs production --tail 100 β
β β
β ROLLBACK β
β ββββββββ β
β nself backup restore [backup-name] β
β nself deploy exec production "nself restart" β
β β
β MONITORING β
β ββββββββββ β
β nself deploy exec production "nself status" β
β nself deploy exec production "nself logs --tail 1000" β
β https://grafana.yourdomain.com β
β β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β nself TROUBLESHOOTING GUIDE β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β SERVICES WON'T START β
β ββββββββββββββββββββ β
β 1. Check service status: β
β nself status β
β β
β 2. View detailed logs: β
β nself logs --verbose β
β nself logs [service-name] β
β β
β 3. Check for port conflicts: β
β docker ps -a β
β lsof -i :[port] β
β β
β 4. Restart services: β
β nself stop β
β nself start --fresh β
β β
β DATABASE CONNECTION ERRORS β
β ββββββββββββββββββββββββββ β
β 1. Verify database is running: β
β nself status postgres β
β β
β 2. Test connection: β
β nself db query "SELECT 1" β
β β
β 3. Check credentials in .env: β
β POSTGRES_DB, POSTGRES_USER, POSTGRES_PASSWORD β
β β
β 4. View database logs: β
β nself logs postgres β
β β
β HASURA ERRORS β
β βββββββββββββ β
β 1. Check Hasura logs: β
β nself logs hasura β
β β
β 2. Verify admin secret: β
β HASURA_GRAPHQL_ADMIN_SECRET in .env β
β β
β 3. Reload metadata: β
β nself service hasura metadata reload β
β β
β 4. Check database connection: β
β Visit Hasura Console β Data β View Database β
β β
β SSL/HTTPS ISSUES β
β ββββββββββββββββ β
β 1. Check certificate status: β
β nself auth ssl status β
β β
β 2. Verify nginx config: β
β nself config validate β
β β
β 3. Check nginx logs: β
β nself logs nginx β
β β
β 4. Renew certificate: β
β nself auth ssl renew β
β β
β PERFORMANCE ISSUES β
β ββββββββββββββββββ β
β 1. Run diagnostics: β
β nself doctor β
β β
β 2. Check resource usage: β
β docker stats β
β β
β 3. Analyze slow queries: β
β nself db slow-queries β
β β
β 4. Review metrics: β
β Visit Grafana dashboard β
β β
β OUT OF DISK SPACE β
β βββββββββββββββββ β
β 1. Check disk usage: β
β df -h β
β du -sh /var/lib/docker β
β β
β 2. Clean Docker resources: β
β docker system prune -a β
β β
β 3. Remove old backups: β
β nself backup clean --older-than 30d β
β β
β 4. Clean logs: β
β nself logs --clean --older-than 7d β
β β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β nself SECURITY CHECKLIST β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β BEFORE PRODUCTION β
β βββββββββββββββββ β
β β‘ Changed all default passwords β
β β‘ Generated strong secrets (32+ characters) β
β β‘ SSL/HTTPS enabled β
β β‘ Firewall configured (only ports 80, 443, 22) β
β β‘ Database not exposed to internet β
β β‘ Admin endpoints secured β
β β‘ Rate limiting enabled β
β β‘ CORS configured correctly β
β β‘ Content Security Policy set β
β β‘ Backups automated and tested β
β β
β ENVIRONMENT VARIABLES β
β βββββββββββββββββββββ β
β Critical secrets to change: β
β β
β POSTGRES_PASSWORD β
β Generate: openssl rand -base64 32 β
β β
β HASURA_GRAPHQL_ADMIN_SECRET β
β Generate: openssl rand -base64 32 β
β β
β AUTH_JWT_SECRET β
β Generate: openssl rand -base64 32 β
β β
β MINIO_ROOT_PASSWORD β
β Generate: openssl rand -base64 24 β
β β
β REDIS_PASSWORD β
β Generate: openssl rand -base64 24 β
β β
β FIREWALL RULES β
β ββββββββββββββ β
β nself auth firewall enable β
β nself auth firewall allow 22/tcp # SSH β
β nself auth firewall allow 80/tcp # HTTP β
β nself auth firewall allow 443/tcp # HTTPS β
β nself auth firewall status β
β β
β SSL/TLS β
β βββββββ β
β nself auth ssl cert \ β
β --domain yourdomain.com \ β
β --email [email protected] β
β β
β nself auth ssl renew # Renew certificate β
β nself auth ssl status # Check status β
β β
β SECURITY AUDIT β
β ββββββββββββββ β
β nself auth security audit # Run security scan β
β nself auth security report # Generate report β
β β
β REGULAR MAINTENANCE β
β βββββββββββββββββββ β
β Weekly: β
β - Review access logs β
β - Check for failed login attempts β
β - Verify backups are working β
β β
β Monthly: β
β - Update services (nself update) β
β - Review user permissions β
β - Rotate API keys β
β - Security audit β
β β
β Quarterly: β
β - Review and update firewall rules β
β - Penetration testing β
β - Disaster recovery drill β
β β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β nself CONFIGURATION PATTERNS β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β MINIMAL BLOG β
β ββββββββββββ β
β PROJECT_NAME=blog β
β POSTGRES_DB=blog_db β
β HASURA_GRAPHQL_ADMIN_SECRET=secret β
β AUTH_JWT_SECRET=jwt-secret-32-chars β
β MAILPIT_ENABLED=true β
β β
β Services: postgres, hasura, auth, nginx, mailpit β
β Total Containers: 5 β
β β
β SAAS APPLICATION β
β ββββββββββββββββ β
β PROJECT_NAME=my-saas β
β POSTGRES_DB=saas_db β
β REDIS_ENABLED=true β
β MINIO_ENABLED=true β
β MEILISEARCH_ENABLED=true β
β MONITORING_ENABLED=true β
β β
β # Custom services β
β CS_1=api:nestjs-api:8001 β
β CS_2=worker:bullmq-js:8002 β
β β
β Services: postgres, hasura, auth, redis, minio, β
β meilisearch, nginx, + monitoring (10), β
β + custom (2) β
β Total Containers: 19 β
β β
β E-COMMERCE β
β ββββββββββ β
β PROJECT_NAME=shop β
β REDIS_ENABLED=true # Cart & sessions β
β MINIO_ENABLED=true # Product images β
β MAILPIT_ENABLED=true # Order emails β
β β
β # Custom services β
β CS_1=checkout:nestjs-api:8001 β
β CS_2=inventory:python-api:8002 β
β CS_3=notifications:bullmq-js:8003 β
β β
β REALTIME CHAT β
β βββββββββββββ β
β PROJECT_NAME=chat β
β REDIS_ENABLED=true # Message queue β
β MINIO_ENABLED=true # File uploads β
β MEILISEARCH_ENABLED=true # Message search β
β β
β # Custom services β
β CS_1=websocket:node-ws:8001 β
β β
β ML PLATFORM β
β βββββββββββ β
β PROJECT_NAME=ml-platform β
β MINIO_ENABLED=true # Dataset storage β
β MLFLOW_ENABLED=true # Experiment tracking β
β REDIS_ENABLED=true # Job queue β
β β
β # Custom services β
β CS_1=training:python-api:8001 β
β CS_2=inference:python-api:8002 β
β CS_3=scheduler:bullmq-js:8003 β
β β
β MULTI-TENANT SAAS β
β ββββββββββββββββββ β
β PROJECT_NAME=multi-tenant β
β REDIS_ENABLED=true # Rate limiting β
β MINIO_ENABLED=true # Per-tenant storage β
β MONITORING_ENABLED=true # Per-tenant metrics β
β β
β # Custom services β
β CS_1=api:nestjs-api:8001 β
β CS_2=billing:nestjs-api:8002 β
β CS_3=worker:bullmq-js:8003 β
β β
β # Tenant-specific configuration β
β TENANT_ISOLATION=true β
β TENANT_DB_PREFIX=tenant_ β
β β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- Print in landscape mode
- Use A4 or Letter paper
- Print at 100% scale (no shrinking)
- Use monospace font for code blocks
Print on cardstock or laminate for a desk reference card that will last.
Save as PDF for quick reference on mobile devices.
- Full Documentation: docs.nself.org
- Command Reference: docs/commands/COMMAND-TREE-V1.md
- Examples: Examples
- Tutorials: Tutorials
Version: 0.9.8 Last Updated: January 2026