Core CLI Commands

Updated for nself v0.4.8

The nself CLI is the primary interface for managing your backend infrastructure. This guide covers all core commands for project initialization, service management, plugin management, and deployment.

New in v0.4.8: Plugin System

v0.4.8 introduces a powerful plugin system for third-party integrations:

  • Plugin Management: Install, update, and remove plugins from registry
  • Three Launch Plugins: Stripe, GitHub, and Shopify integrations
  • Database Schemas: Plugins create prefixed tables for synced data
  • Webhook Handlers: Real-time event processing with signature verification

Plugin Commands (v0.4.8)

nself plugin NEW

Manage third-party integrations with a unified plugin system.

# List available plugins
nself plugin list                      # All plugins
nself plugin list --installed          # Only installed
nself plugin list --category billing   # Filter by category

# Install plugins
nself plugin install stripe            # Install from registry
nself plugin install stripe@1.2.0      # Install specific version
nself plugin install ./my-plugin       # Install local plugin

# Remove plugins
nself plugin remove stripe             # Remove plugin and data
nself plugin remove stripe --keep-data # Keep database tables

# Update plugins
nself plugin update stripe             # Update specific plugin
nself plugin update --all              # Update all installed
nself plugin updates                   # Check for available updates

# Status
nself plugin status                    # All plugins status
nself plugin status stripe             # Specific plugin health

# Registry
nself plugin refresh                   # Refresh registry cache

Plugin Actions

Each plugin provides its own actions accessible via nself plugin <name> <action>:

# Stripe Plugin
nself plugin stripe sync               # Sync all data from Stripe
nself plugin stripe customers list     # List synced customers
nself plugin stripe subscriptions list # View subscriptions
nself plugin stripe invoices list      # View invoices
nself plugin stripe webhook list       # View webhook events

# GitHub Plugin
nself plugin github sync               # Sync repositories
nself plugin github repos list         # List repositories
nself plugin github issues list        # View issues
nself plugin github prs list           # View pull requests
nself plugin github workflows list     # View GitHub Actions runs

# Shopify Plugin
nself plugin shopify sync              # Sync store data
nself plugin shopify products list     # List products
nself plugin shopify orders list       # View orders
nself plugin shopify customers list    # View customers

Plugin Configuration

Plugins require environment variables for API access. Add to your .env:

# Stripe
STRIPE_API_KEY=sk_test_xxxxx
STRIPE_WEBHOOK_SECRET=whsec_xxxxx

# GitHub
GITHUB_TOKEN=ghp_xxxxx
GITHUB_WEBHOOK_SECRET=xxxxx

# Shopify
SHOPIFY_STORE=your-store
SHOPIFY_ACCESS_TOKEN=shpat_xxxxx

Command Availability Status

Core Commands:

  • nself init - Initialize project
  • nself build - Build project structure
  • nself start - Start services
  • nself stop - Stop services
  • nself restart - Restart services
  • nself status - Service health monitoring
  • nself logs - View service logs
  • nself urls - List all service URLs
  • nself exec - Container command execution
  • nself clean - Clean Docker resources
  • nself doctor - Health checks with auto-fix
  • nself validate - Configuration validation

Management Commands:

  • nself env - Environment management v0.4.7
  • nself deploy - SSH deployment v0.4.3
  • nself staging - Staging commands v0.4.3
  • nself prod - Production hardening
  • nself plugin - Plugin system v0.4.8
  • nself admin - Admin UI management
  • nself db - Database operations
  • nself email - Email configuration
  • nself search - Search engine setup
  • nself ssl - SSL certificate management
  • nself backup - Backup management
  • nself metrics - Monitoring profiles

Environment Commands (v0.4.7)

nself env v0.4.7

Manage multiple deployment environments with separate configurations.

# List environments
nself env list

# Create environments
nself env create dev local           # Create local dev environment
nself env create staging staging     # Create staging environment
nself env create prod prod           # Create production environment

# Switch environments
nself env switch dev
nself env switch staging
nself env switch prod

# Status and info
nself env status                     # Current environment status
nself env info staging               # Detailed environment info

# Compare environments
nself env diff staging prod          # Compare configurations
nself env diff dev staging --values  # Show actual values

# Validate
nself env validate staging           # Validate environment config

# Import/Export
nself env export staging             # Export as tarball
nself env import backup.tar.gz       # Import environment

Deployment Commands (v0.4.7)

nself deploy v0.4.3+

Deploy to any configured environment via SSH.

# Deploy to environment
nself deploy staging                 # Deploy to staging
nself deploy prod                    # Deploy to production

# Preview deployment
nself deploy staging --dry-run       # Preview without executing

# Deployment options
nself deploy staging --force         # Skip confirmation
nself deploy staging --rolling       # Zero-downtime update
nself deploy staging --skip-health   # Skip health checks
nself deploy staging --backend-only  # Exclude frontend apps

# Utilities
nself deploy check-access            # Verify SSH to all environments
nself deploy status                  # View deployment status
nself deploy health staging          # Check deployment health
nself deploy logs                    # View remote logs
nself deploy rollback                # Rollback last deployment

nself staging

# Initialize staging
nself staging init staging.example.com --email admin@example.com

# Deploy to staging (includes frontends by default)
nself staging deploy
nself staging deploy --dry-run

# Staging data management
nself staging seed                   # Load test data
nself staging seed ./seeds/test.sql  # Use specific seed file
nself staging sync db                # Sync database from production
nself staging reset                  # Reset staging environment

# Utilities
nself staging logs [service]         # View staging logs
nself staging shell                  # SSH into staging
nself staging secrets generate       # Generate staging secrets

nself prod

# Initialize production
nself prod init example.com --email admin@example.com

# Security
nself prod check                     # Security audit
nself prod harden                    # Apply hardening measures
nself prod secrets generate          # Generate all secrets
nself prod secrets rotate JWT_SECRET # Rotate specific secret

# SSL
nself prod ssl status                # Check certificate status
nself prod ssl request example.com   # Request Let's Encrypt cert
nself prod ssl renew                 # Renew certificates

# Firewall
nself prod firewall status           # Check firewall
nself prod firewall configure        # Apply recommended rules

Admin UI Commands

nself admin v0.3.9+

Web-based Admin UI management at localhost:3021.

# Admin UI Management
nself admin enable      # Enable web-based admin UI
nself admin disable     # Disable admin UI
nself admin password    # Set admin password
nself admin open        # Open admin UI in browser
nself admin status      # Check admin status
nself admin logs        # View admin container logs
nself admin reset       # Reset to defaults

Core Service Commands

Project Management

# Initialize new nself project
nself init [project-name]
nself init --demo                    # Full demo with all services
nself init --minimal                 # Just core services
nself init --wizard                  # Interactive configuration

# Build configuration
nself build                          # Generate docker-compose.yml
nself build --validate               # Validate before building
nself build --dry-run                # Preview without writing

# Reset project
nself reset                          # Reset with timestamped backup
nself reset --soft                   # Keep database data
nself reset --force                  # Skip confirmation

Service Control

# Start services
nself start                          # Start all services
nself start postgres hasura          # Start specific services
nself start --build                  # Rebuild containers first

# Stop services
nself stop                           # Stop all services
nself stop postgres                  # Stop specific service
nself stop --volumes                 # Also remove volumes

# Restart services
nself restart                        # Restart all
nself restart hasura                 # Restart specific service
nself restart --rolling              # Rolling restart

# Legacy aliases (still supported)
nself up                             # Alias for start
nself down                           # Alias for stop

Monitoring and Logging

# Service status
nself status                         # Show all service health
nself status --resources             # Include resource usage
nself status --verbose               # Detailed information

# View logs
nself logs                           # All services
nself logs postgres                  # Specific service
nself logs -f hasura                 # Follow logs
nself logs --tail 100                # Last 100 lines
nself logs --since 1h                # Last hour

# Service URLs
nself urls                           # List all service URLs

# Container access
nself exec postgres psql -U postgres # Execute command
nself exec -it hasura bash           # Interactive shell

Database Commands

nself db v0.3.9+

# Interactive database menu
nself db                             # Opens interactive menu

# Database operations
nself db shell                       # PostgreSQL shell
nself db query "SELECT 1"            # Execute SQL
nself db tables                      # List tables
nself db schema                      # Show schema

# Migrations
nself db migrate                     # Run migrations
nself db migrate --status            # Migration status
nself db migrate --rollback          # Rollback last

# Seeding
nself db seed                        # Run seed files
nself db seed ./seeds/test.sql       # Specific seed file

# Backup
nself db backup                      # Create backup
nself db restore backup.sql          # Restore backup

Service Configuration Commands

Email Configuration

# Interactive email setup
nself email setup                    # Wizard for 16+ providers

# Email testing
nself email                          # Show current config
nself email check                    # SMTP pre-flight test
nself email test                     # Send test email

Search Engine Configuration

# Search engine setup
nself search                         # Show current config
nself search enable postgres         # Built-in PostgreSQL FTS
nself search enable meilisearch      # MeiliSearch
nself search enable typesense        # Typesense
nself search enable elasticsearch    # Elasticsearch
nself search enable opensearch       # OpenSearch
nself search enable sonic            # Sonic (minimal memory)
nself search test                    # Test connectivity

Metrics Configuration

# Monitoring profiles
nself metrics enable minimal         # 4 services (~500MB)
nself metrics enable standard        # 7 services (~1GB)
nself metrics enable full            # 10 services (~2GB)
nself metrics enable auto            # Auto-detect
nself metrics status                 # Show current profile

# Monitoring dashboards
nself monitor                        # Open Grafana
nself monitor grafana                # Grafana
nself monitor prometheus             # Prometheus
nself monitor alerts                 # Alertmanager
nself monitor services               # CLI service view
nself monitor resources              # CLI resource view

SSL Commands

nself ssl / nself trust v0.3.5+

# SSL certificate management
nself ssl bootstrap                  # Initial SSL setup
nself ssl status                     # Certificate status
nself ssl renew                      # Renew certificates

# Trust management
nself trust                          # Install CA in system
nself trust status                   # Check trust status

Backup Commands

nself backup v0.3.8+

# Backup management
nself backup create                  # Create full backup
nself backup create --name "pre-deploy"
nself backup list                    # List backups
nself backup restore "backup-name"   # Restore backup

# Rollback
nself rollback                       # Rollback last change
nself rollback --to "2026-01-24"

Utility Commands

# Health and diagnostics
nself doctor                         # Health checks with auto-fix
nself validate                       # Configuration validation

# Cleanup
nself clean                          # Clean images and cache
nself clean -a                       # Clean all resources
nself clean -c -i -v                 # Containers, images, volumes

# Updates
nself update                         # Update CLI
nself update --check                 # Check for updates
nself version                        # Show version
nself help                           # Show help

Global Options

# Global flags available for all commands
nself [command] [flags]

--verbose, -v    # Enable verbose output
--quiet, -q      # Suppress output
--help, -h       # Show help information
--version        # Show version information
--env            # Specify environment

Command Help

Use nself [command] --help to get detailed help for any command, including examples and all available options.

Development Workflow

# Start development environment
nself init my-app
cd my-app
nself env switch dev
nself build
nself start

# Make changes, rebuild and restart
nself build && nself restart hasura

# View logs while developing
nself logs -f hasura

# Clean up when done
nself stop

Production Deployment Workflow

# 1. Create and configure environments
nself env create prod prod
nself prod init example.com --email admin@example.com

# 2. Generate secrets
nself prod secrets generate

# 3. Harden production
nself prod harden
nself prod check

# 4. Deploy
nself build
nself deploy prod --dry-run    # Preview first
nself deploy prod              # Deploy

# 5. Verify
nself deploy health prod

Next Steps

The nself CLI is designed to be intuitive and powerful. Master these core commands to efficiently manage your backend infrastructure.