-
-
Notifications
You must be signed in to change notification settings - Fork 2
v0.4.4
Release Date: January 20, 2026 Focus: Database Tools
Comprehensive database management release introducing the unified nself db command with all database operations consolidated under one clean interface.
- DBML Schema Workflow: Design at dbdiagram.io, import to SQL, seed automatically
-
Schema Templates: Start with
basic,ecommerce,saas, orblogtemplates -
One-Command Setup:
nself db schema applydoes import → migrate → mock → seed - Environment-Aware Safety: Production-safe operations with automatic guards
- Mock Data Generation: Deterministic, shareable mock data with configurable seeds
- Type Generation: Generate TypeScript, Go, Python types from your schema
-
Database Inspection: Performance analysis tools like Supabase's
inspect db
All database operations are now consolidated under a single command with intuitive subcommands:
nself db <subcommand> [options]| Subcommand | Description |
|---|---|
migrate |
Database migrations (up, down, create, status, fresh, repair) |
seed |
Environment-aware data seeding |
mock |
Deterministic mock data generation |
backup |
Backup management and scheduling |
restore |
Restore from backups |
schema |
Schema tools (diff, diagram, indexes) |
types |
Generate TypeScript/Go/Python types |
shell |
Interactive PostgreSQL shell |
query |
Execute SQL queries |
inspect |
Database analysis and performance insights |
data |
Data export/import/anonymize |
optimize |
Database maintenance (vacuum, analyze) |
reset |
Reset database to clean state |
The recommended way to design your database:
nself db schema scaffold basic # Users, profiles, posts
nself db schema scaffold ecommerce # Products, orders, cart
nself db schema scaffold saas # Organizations, members, projects
nself db schema scaffold blog # Posts, categories, commentsEdit schema.dbml directly or design visually at dbdiagram.io:
Table users {
id serial [pk]
email varchar(255) [not null, unique]
display_name varchar(100)
role varchar(20) [default: 'user']
created_at timestamptz [default: `NOW()`]
}
nself db schema apply schema.dbmlThis single command:
- Imports DBML → Creates SQL migration
- Runs migration → Creates tables
- Generates mock data → Populates tables (local/staging)
- Seeds users → Creates sample accounts
-
admin@example.com(admin role) -
user@example.com(user role) -
demo@example.com(viewer role)
nself db schema import schema.dbml # DBML → SQL migration
nself db migrate up # Run migrations
nself db mock auto # Auto-generate mock data
nself db seed users # Seed usersFull migration lifecycle with rollback support:
nself db migrate status # Check migration status
nself db migrate up # Run pending migrations
nself db migrate down # Rollback last migration
nself db migrate create NAME # Create new migration
nself db migrate fresh # Drop all & re-run (non-prod only)Different behavior based on environment:
| Environment | Behavior |
|---|---|
| Local | 20 mock users, password "password123" |
| Staging | 100 mock users for load testing |
| Production | Only explicit users from config |
nself db seed users # Seed users for current environmentConfigure production users via environment variable:
NSELF_PROD_USERS='admin@company.com:Admin User:admin'Same seed produces identical data across your entire team:
nself db mock --seed 12345 # Reproducible data
nself db mock preview # Preview before generating
nself db mock config # Show configurationPerformance analysis tools (like Supabase inspect db):
nself db inspect # Overview of all tables
nself db inspect size # Table sizes
nself db inspect cache # Cache hit ratios
nself db inspect index # Index usage analysis
nself db inspect bloat # Table bloat analysis
nself db inspect slow # Slow query analysis# Design & Import (NEW)
nself db schema scaffold basic # Create schema from template
nself db schema import file.dbml # Convert DBML to SQL migration
nself db schema apply file.dbml # Full workflow in one command
# Inspect & Export
nself db schema # Show current schema
nself db schema diff staging # Compare with another environment
nself db schema diagram # Generate DBML from database
nself db schema export # Export as SQL
# Optimization
nself db schema indexes # Analyze and suggest indexesGenerate typed interfaces from your database:
nself db types typescript # Generate TypeScript interfaces
nself db types go # Generate Go structs
nself db types python # Generate Python dataclassesnself db backup # Create full backup
nself db backup --compress # Compressed backup
nself db backup list # List all backups
nself db backup schedule # Schedule automated backups
nself db restore # Restore latest backup
nself db restore backup.sql # Restore specific backupnself db data export users # Export table as CSV
nself db data import users.csv # Import data
nself db data anonymize # Anonymize PII dataDestructive operations are blocked in production:
nself db migrate freshnself db mocknself db reset
Operations requiring confirmation in production:
nself db restorenself db migrate down
Set environment via:
ENV=production nself db migrate up
# or in .env file-
src/cli/db.sh- Comprehensive database command (1688 lines)
-
src/lib/database/core.sh- Shared database utilities
-
docs/commands/DB.md- Complete documentation
| Variable | Default | Description |
|---|---|---|
NSELF_MIGRATIONS_DIR |
nself/migrations |
Migrations directory |
NSELF_SEEDS_DIR |
nself/seeds |
Seeds directory |
NSELF_BACKUPS_DIR |
_backups |
Backup storage |
NSELF_MOCK_SEED |
Random | Mock data seed |
NSELF_MOCK_COUNT |
100 |
Default row count |
NSELF_TYPES_DIR |
types |
Generated types output |
NSELF_PROD_USERS |
- | Production users config |
After running nself db commands:
nself/
├── migrations/ # SQL migration files
├── seeds/
│ ├── common/ # Always runs
│ ├── local/ # Development only
│ ├── staging/ # Staging only
│ └── production/ # Production only
├── mock/
│ └── config.json # Mock data configuration
└── config/
└── prod-users.json # Production users (optional)
_backups/ # Database backups
types/ # Generated type files
No breaking changes. The new nself db command is additive.
If you were using standalone backup/restore scripts, they still work but we recommend migrating to:
-
nself db backupinstead ofnself backup -
nself db restoreinstead ofnself restore
# Create and apply schema in one workflow
nself db schema scaffold basic # Create schema.dbml
nself db schema apply schema.dbml # Import → migrate → mock → seed
# You're done! Database is ready with:
# - Your schema
# - Mock data
# - Sample users (admin@example.com, user@example.com)# Migrations
nself db migrate up # Run pending migrations
nself db migrate create NAME # Create new migration
# Mock Data
nself db mock auto # Auto-generate from schema
nself db mock --seed 12345 # Reproducible data
# Types
nself db types # Generate TypeScript types
# Backup
nself db backup # Create backup
nself db backup --compress # Compressed backup
# Shell
nself db shell # Interactive psql
nself db shell --readonly # Read-only shell
# Inspection
nself db inspect # Overview
nself db inspect size # Table sizesv0.4.5 - Provider Support
- Deploy to AWS, GCP, Azure, DigitalOcean, Hetzner, and more
- One-command provisioning:
nself provision hetzner - Cost estimation and comparison
Full Changelog: v0.4.3...v0.4.4
ɳSelf CLI v1.0.9. MIT licensed. Docs CC BY 4.0.
GitHub · Issues · Discussions · nself.org · nself.org/docs
Getting Started
Commands
- Commands, Overview
- Lifecycle: cmd-init · cmd-build · cmd-start · cmd-stop · cmd-restart · cmd-dev
- Monitoring: cmd-status · cmd-logs · cmd-health · cmd-urls · cmd-doctor · cmd-monitor · cmd-alerts · cmd-sentry · cmd-watchdog
- Data: cmd-db · cmd-backup · cmd-dr · cmd-queue · cmd-webhooks
- Config: cmd-config · cmd-service · cmd-env · cmd-promote
- Networking: cmd-ssl · cmd-trust · cmd-dns-setup
- Security: cmd-access · cmd-security · cmd-secrets
- Tenancy: cmd-tenant · cmd-billing
- Plugins: cmd-plugin · cmd-license · cmd-dogfood (extracted, CLI-R11) · cmd-k8s (extracted, CLI-R11) · cmd-encryption (extracted, CLI-R11) · cmd-waf (extracted, CLI-R11) · cmd-federation (extracted, CLI-R11) · cmd-mail (extracted, CLI-R11) · cmd-dlq (extracted, CLI-R11)
- AI: cmd-ai · cmd-claw · cmd-model
- Templates: cmd-template
- Utilities: cmd-exec · cmd-clean · cmd-reset · cmd-update · cmd-upgrade · cmd-version · cmd-admin · cmd-migrate · cmd-migrate-firebase · cmd-migrate-supabase · cmd-completion
Features
- Features, Overview
- Feature-Auth
- Feature-Storage
- Feature-Search
- Feature-Functions
- Feature-Email
- Feature-Monitoring
- Feature-Plugins
- Feature-nClaw, AI Assistant
- Feature-nChat, Messaging
- Feature-nTV, Media Player
- Feature-nFamily, Family Social
- Feature-nCloud, Managed Hosting
- Feature-Memory-Rooms, Knowledge Organization
- Feature-Agent-Dashboard, Agent Metrics
- Feature-Image-Generation, AI Image Generation
Configuration
- Configuration, Overview
- Config-Env-Vars
- Config-Postgres
- Config-Hasura
- Config-Auth
- Config-Nginx
- Config-Optional-Services
- Config-Custom-Services
- Config-System
Plugins (87 + 10 monitoring)
Free (25)
- plugin-backup
- plugin-content-acquisition
- plugin-content-progress
- plugin-cron
- plugin-donorbox
- plugin-feature-flags
- plugin-github
- plugin-github-runner
- plugin-invitations
- plugin-jobs
- plugin-link-preview
- plugin-mdns
- plugin-mlflow
- plugin-monitoring
- plugin-notifications
- plugin-notify
- plugin-paypal
- plugin-search
- plugin-shopify
- plugin-stripe
- plugin-subtitle-manager
- plugin-tokens
- plugin-torrent-manager
- plugin-vpn
- plugin-webhooks
Pro (62)
- plugin-access-controls
- plugin-activity-feed
- plugin-admin-api
- plugin-nself-ai-gateway
- plugin-nself-ai-mcp
- plugin-nself-ai-mcp
- plugin-analytics
- plugin-auth
- plugin-backup-pro
- plugin-bots
- plugin-browser
- plugin-calendar
- plugin-cdn
- plugin-chat
- plugin-claw
- plugin-claw-budget
- plugin-claw-news
- plugin-claw-web
- plugin-cloudflare
- plugin-cms
- plugin-compliance
- plugin-cron-pro
- plugin-ddns
- plugin-devices
- plugin-documents
- plugin-donorbox-pro
- plugin-entitlements
- plugin-epg
- plugin-file-processing
- plugin-game-metadata
- plugin-geocoding
- plugin-geolocation
- plugin-google
- plugin-home
- plugin-idme
- plugin-knowledge-base
- plugin-linkedin
- plugin-livekit
- plugin-media-processing
- plugin-meetings
- plugin-moderation
- plugin-mux
- plugin-notify-pro
- plugin-object-storage
- plugin-observability
- plugin-paypal-pro
- plugin-photos
- plugin-podcast
- plugin-post
- plugin-realtime
- plugin-recording
- plugin-retro-gaming
- plugin-rom-discovery
- plugin-shopify-pro
- plugin-social
- plugin-sports
- plugin-stream-gateway
- plugin-streaming
- plugin-stripe-pro
- plugin-support
- plugin-tmdb
- plugin-voice
- plugin-web3
- plugin-workflows
Planned (26)
plugin-auditplugin-blogplugin-checkoutplugin-commerceplugin-drmplugin-exportplugin-flowplugin-importplugin-ldapplugin-mailgunplugin-mediaplugin-oauth-providersplugin-pagesplugin-postmarkplugin-rate-limitplugin-reportsplugin-samlplugin-schedulerplugin-sendgridplugin-ssoplugin-subscriptionplugin-thumbplugin-transcoderplugin-twilioplugin-wafplugin-watermark
Guides
- Guide-Production-Deployment
- Guide-SSL-Setup
- Guide-Multi-Tenancy
- Guide-Security-Hardening
- Guide-Monitoring-Setup
- Guide-Backup-Restore
- Guide-Custom-Services
- Guide-Migration-from-v1
Architecture
Reference
- API-Reference
- error-codes, Error Codes
Licensing
Security
Brand
Operations
- operations/release-cascade, Release Cascade
- operations/self-healing, Self-Healing Schema
- operations/redis-tuning, Redis Pool Tuning
- operations/meilisearch-warmup, MeiliSearch Warm-Up
- operations/jwt-rotation, JWT Key Rotation
- operations/windows-wsl2-setup, Windows / WSL2 Setup
- operations/gemini-oauth-reauth, Gemini OAuth Reauth
Contributing
Admin
- USER-ACTION-QUEUE, Pending Admin Actions
All commands (52)
- A: cmd-access · cmd-account · cmd-admin
- B: cmd-backup · cmd-build · cmd-bundle
- C: cmd-ci · cmd-clean · cmd-completion · cmd-config
- D: cmd-db · cmd-deploy · cmd-dev · cmd-doctor
- E: cmd-env · cmd-exec
- F: cmd-functions
- G: cmd-generate
- H: cmd-health · cmd-help-topics
- I: cmd-init · cmd-install
- L: cmd-license · cmd-login · cmd-logout · cmd-logs
- M: cmd-man · cmd-mcp · cmd-migrate
- O: cmd-oauth · cmd-ops
- P: cmd-plugin · cmd-promote
- R: cmd-remove · cmd-reset · cmd-restart · cmd-runner
- S: cmd-secrets · cmd-security · cmd-self-heal · cmd-server · cmd-service · cmd-start · cmd-status · cmd-stop
- T: cmd-telemetry · cmd-template · cmd-trust
- U: cmd-update · cmd-urls
- V: cmd-verify-sbom · cmd-version