-
-
Notifications
You must be signed in to change notification settings - Fork 2
DEMO_SETUP
The demo setup (nself init --demo) provides a fully-featured Backend-as-a-Service environment with all major components enabled. This configuration showcases the complete capabilities of nself.
# Initialize demo project
nself init --demo
# Build all services
nself build
# Start everything
nself start
# View running services
docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"These form the foundation of every nself deployment:
-
PostgreSQL - Primary database
- Latest v16 with all extensions
- pgvector for AI/ML embeddings
- PostGIS for geospatial data
- Full-text search capabilities
-
Hasura - GraphQL API Engine
- Instant GraphQL APIs
- Real-time subscriptions
- Row-level security
- Remote schema stitching
-
Auth - Authentication Service
- JWT-based authentication
- Email/password login
- Social providers ready
- WebAuthn support
-
Nginx - Reverse Proxy
- SSL termination
- Load balancing
- Route management
- Static file serving
Complete observability stack enabled with MONITORING_ENABLED=true:
- Prometheus - Metrics collection and storage
- Grafana - Visualization and dashboards
- Loki - Log aggregation system
- Promtail - Log shipping agent
- Tempo - Distributed tracing
- Alertmanager - Alert routing
- cAdvisor - Container metrics
- Node Exporter - System metrics
- Postgres Exporter - Database metrics
- Redis Exporter - Cache metrics
-
Redis - In-memory data store
- Session management
- Caching layer
- Pub/Sub messaging
- Job queue backend
-
MinIO - S3-compatible storage
- File uploads
- Backup storage
- ML model artifacts
- Static assets
-
Storage API - File management service
- Upload handling
- Image transformations
- Access control
- CDN integration
-
MailPit - Email testing
- Catches all emails
- Web UI for viewing
- API for testing
- No emails sent externally
-
MeiliSearch - Full-text search
- Typo-tolerant search
- Faceted search
- Multi-language support
- Instant results
-
nself Admin - Management UI
- Service monitoring
- Configuration management
- Database administration
- Log viewing
Demo includes four diverse custom services to showcase different architectures:
-
express_api - REST API Service
- Express.js framework
- RESTful endpoints
- JWT authentication
- PostgreSQL integration
- Template:
express-js - Port: 8001
- Route:
https://api.<domain>
-
bullmq_worker - Background Job Processor
- BullMQ queue processing
- Redis-backed jobs
- Retry logic
- Dead letter queue
- Template:
bullmq-js - Port: 8002
- Internal service (no public route)
-
go_grpc - High-Performance gRPC Service
- Go implementation
- Protocol buffers
- Bi-directional streaming
- Service mesh ready
- Template:
grpc - Port: 8003
- Route:
https://grpc.<domain>
-
python_api - ML/Data API
- FastAPI framework
- Async/await support
- OpenAPI documentation
- ML model serving
- Template:
fastapi - Port: 8004
- Route:
https://ml-api.<domain>
The demo .env includes:
# Custom Backend Services
CUSTOM_SERVICES=express-api,bullmq-worker,go-grpc,python-api
CS_1=express_api:express-js:8001
CS_2=bullmq_worker:bullmq-js:8002
CS_3=go_grpc:grpc:8003
CS_4=python_api:fastapi:8004
# Service-specific configuration
CS_1_MEMORY=512M
CS_1_CPU=0.5
CS_1_ROUTE=api
CS_1_HEALTHCHECK=/health
CS_2_MEMORY=256M
CS_2_CPU=0.25
CS_2_QUEUE_NAME=demo-jobs
CS_3_MEMORY=256M
CS_3_CPU=0.5
CS_3_REPLICAS=2
CS_3_ROUTE=grpc
CS_4_MEMORY=512M
CS_4_CPU=0.5
CS_4_ROUTE=ml-apigraph TB
subgraph "External Access"
User[User/Browser]
end
subgraph "Required Services"
Nginx[Nginx :443]
PostgreSQL[(PostgreSQL :5432)]
Hasura[Hasura :8080]
Auth[Auth :4000]
end
subgraph "Custom Services"
API[express_api :8001]
Worker[bullmq_worker :8002]
GRPC[go_grpc :8003]
ML[python_api :8004]
end
subgraph "Optional Services"
Redis[(Redis :6379)]
MinIO[MinIO :9000]
Search[MeiliSearch :7700]
Admin[nself Admin :3021]
end
subgraph "Monitoring"
Prometheus[Prometheus :9090]
Grafana[Grafana :3006]
Loki[Loki :3100]
end
User --> Nginx
Nginx --> Hasura
Nginx --> Auth
Nginx --> API
Nginx --> GRPC
Nginx --> ML
Nginx --> Admin
Nginx --> Grafana
Hasura --> PostgreSQL
Auth --> PostgreSQL
API --> PostgreSQL
API --> Redis
Worker --> Redis
ML --> MinIO
Prometheus --> API
Prometheus --> Worker
Loki --> Promtail[Promtail]
Promtail --> API
Promtail --> Worker
After starting the demo, services are available at:
- GraphQL Playground:
https://api.local.nself.org - Authentication:
https://auth.local.nself.org
- REST API:
https://api.local.nself.org - gRPC Service:
https://grpc.local.nself.org - ML API:
https://ml-api.local.nself.org - API Documentation:
https://ml-api.local.nself.org/docs
- nself Admin:
https://admin.local.nself.org - Grafana:
https://grafana.local.nself.org - Prometheus:
https://prometheus.local.nself.org - Alertmanager:
https://alertmanager.local.nself.org
- Mail UI:
https://mail.local.nself.org - Search UI:
https://search.local.nself.org - MinIO Console:
https://storage-console.local.nself.org
- CPU: 4 cores
- RAM: 8GB
- Disk: 20GB
- Network: Local development
- CPU: ~2-3 cores utilized
- RAM: ~4-6GB active
- Disk: ~5GB after pulling images
- Network: Minimal (local only)
| Service Category | CPU | Memory | Storage |
|---|---|---|---|
| Core (4) | 1.5 cores | 2GB | 2GB |
| Monitoring (10) | 2 cores | 3GB | 5GB |
| Optional (6) | 1 core | 1.5GB | 3GB |
| Custom (4) | 1.5 cores | 1.5GB | 1GB |
| Total | 6 cores | 8GB | 11GB |
# Test Express API
curl https://api.local.nself.org/health
# Test Python ML API
curl https://ml-api.local.nself.org/predict \
-H "Content-Type: application/json" \
-d '{"data": [1, 2, 3, 4, 5]}'
# GraphQL Query via Hasura
curl https://api.local.nself.org/v1/graphql \
-H "Content-Type: application/json" \
-H "x-hasura-admin-secret: demo-admin-secret" \
-d '{"query": "{ users { id email } }"}'// Submit job to BullMQ worker
const Queue = require('bull');
const demoQueue = new Queue('demo-jobs', {
redis: {
host: 'redis',
port: 6379,
password: 'demo-redis-password'
}
});
await demoQueue.add('process-data', {
userId: 123,
action: 'generate-report'
});// Upload to MinIO via Storage API
const formData = new FormData();
formData.append('file', fileInput.files[0]);
fetch('https://storage.local.nself.org/upload', {
method: 'POST',
body: formData,
headers: {
'Authorization': 'Bearer <token>'
}
});The demo includes Grafana dashboards for:
- System Overview - All services at a glance
- Container Metrics - CPU, memory, network per container
- PostgreSQL Performance - Query performance, connections
- Redis Metrics - Hit rate, memory usage
- API Performance - Request rates, latencies
- Custom Service Metrics - Business metrics
All services automatically ship logs to Loki:
# View logs in Grafana
# Navigate to: https://grafana.local.nself.org
# Go to Explore → Select Loki
# Query: {container="express_api"} |= "error"Tempo collects traces from all services:
# Services automatically instrumented
# View traces in Grafana
# Useful for debugging request flowAfter nself build, customize your services:
# Edit Express API
vim services/express_api/src/index.js
# Edit Python API
vim services/python_api/main.py
# Changes persist - won't be overwritten
nself build # Safe to run again# Add to .env
CS_5=websocket_server:socketio-js:8005
CS_6=temporal_worker:temporal-js:8006
# Rebuild
nself build
# Restart
nself restart# Edit docker-compose.yml
# Under service definition:
deploy:
replicas: 3
# Apply changes
nself restart# Check status
nself status
# View logs
nself logs <service-name>
# Common issues:
# - Port conflicts
# - Database connection
# - Missing environment variables# Check resource usage
docker stats
# View Grafana dashboards
# https://grafana.local.nself.org
# Scale down monitoring if needed
MONITORING_ENABLED=false nself restart# Access PostgreSQL
nself db connect
# Check connections
SELECT * FROM pg_stat_activity;
# Reset database
nself db reset-
Development
- Use demo for learning and testing
- Customize services incrementally
- Monitor resource usage
-
Before Production
- Change all passwords
- Disable unnecessary services
- Configure proper domains
- Set up backups
-
Resource Optimization
- Disable monitoring in development
- Use Redis for session storage
- Implement caching strategies
- Optimize database queries
-
Explore Services
- Access each service URL
- Try the API endpoints
- View monitoring dashboards
-
Customize
- Modify custom services
- Add your business logic
- Configure integrations
-
Learn
- Study the generated code
- Understand service communication
- Review monitoring data
-
Build
- Create your own services
- Implement your use case
- Deploy to production
ɳ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