QUICK REFERENCE - nself-org/cli GitHub Wiki
One-page reference for all nself tutorials with common commands and patterns.
| Tutorial | Time | Command |
|---|---|---|
| SaaS | 15 min | nself init --template saas |
| B2B | 20 min | nself init --template b2b |
| Marketplace | 25 min | nself init --template marketplace |
| Agency | 20 min | nself init --template agency |
| Stripe | 30 min | nself plugin install stripe |
| Domains | 15 min | nself whitelabel domain add |
# Install nself
curl -sSL https://install.nself.org | bash
# Create project
mkdir myapp && cd myapp
nself init
# Build and start
nself build
nself start
# Check status
nself status
nself urls# Apply schema
nself db schema apply schema.dbml
# Run migration
nself db migrate up
# Database shell
nself db shell
# Run query
nself db query "SELECT * FROM users"
# Backup
nself db backup# Install plugin
nself plugin install stripe
# Configure in .env
STRIPE_API_KEY=sk_test_PLACEHOLDER
STRIPE_PUBLISHABLE_KEY=pk_test_xxxxx
# Sync data
nself plugin stripe sync
# View customers
nself plugin stripe customers list
# View subscriptions
nself plugin stripe subscriptions list# Add domain
nself whitelabel domain add app.myapp.com
# Verify domain
nself whitelabel domain verify app.myapp.com
# Generate SSL
nself ssl generate myapp.com --letsencrypt
# Check SSL
nself ssl check myapp.com
# Enable auto-renewal
nself ssl enable-auto-renew myapp.com# Initialize
nself whitelabel init
# Create brand
nself whitelabel branding create "My Brand"
# Set colors
nself whitelabel branding set-colors \
--primary #0066cc \
--secondary #00cc66
# Upload logo
nself whitelabel logo upload ./logo.png --type main
# Customize email
nself whitelabel email edit welcomemutation CreateOrganization {
insert_organizations_one(object: {
name: "Acme Corp"
slug: "acme"
status: "active"
}) {
id
name
}
}mutation CreateSubscription {
insert_subscriptions_one(object: {
user_id: "user-id"
stripe_subscription_id: "sub_xxxxx"
plan: "pro"
status: "active"
price_amount: 2999
}) {
id
}
}mutation TrackUsage {
insert_usage_one(object: {
organization_id: "org-id"
metric_name: "api_calls"
quantity: 1000
}) {
id
}
}query Dashboard($userId: uuid!) {
organizations(where: {members: {user_id: {_eq: $userId}}}) {
id
name
subscription {
plan
status
}
}
}PROJECT_NAME=myapp
ENV=dev
BASE_DOMAIN=local.nself.org
# Database
POSTGRES_DB=myapp_db
POSTGRES_USER=postgres
POSTGRES_PASSWORD=secure-password
# Hasura
HASURA_GRAPHQL_ADMIN_SECRET=admin-secret
HASURA_GRAPHQL_JWT_SECRET=jwt-secretSTRIPE_API_KEY=sk_test_PLACEHOLDER
STRIPE_PUBLISHABLE_KEY=pk_test_xxxxx
STRIPE_WEBHOOK_SECRET=whsec_xxxxx# Enable optional services
REDIS_ENABLED=true
MINIO_ENABLED=true
MONITORING_ENABLED=true
NSELF_ADMIN_ENABLED=true
# Enable email
MAILPIT_ENABLED=true
# Enable search
MEILISEARCH_ENABLED=trueTENANT_ISOLATION_ENABLED=true
TENANT_COLUMN_NAME=organization_idType Name Value TTL
A @ your-server-ip 300
A * your-server-ip 300
Type Name Value TTL
A api your-server-ip 300
A auth your-server-ip 300
A admin your-server-ip 300
Type Name Value TTL
A * your-server-ip 300
Type Name Value TTL
TXT _nself-verify "verification-token" 300
4242 4242 4242 4242 # Visa
5555 5555 5555 4444 # Mastercard
4000 0000 0000 0002 # Declined
4000 0000 0000 9995 # Insufficient funds
Expiry: Any future date (12/34) CVC: Any 3 digits (123)
# View running containers
docker ps
# View all containers
docker ps -a
# View logs
docker logs <container-name>
# Follow logs
docker logs -f <container-name>
# Restart container
docker restart <container-name>
# Stop all
docker stop $(docker ps -q)
# Clean up
docker system prune -anself doctor
nself logs
nself restartlsof -i :5432 # Check port
AUTO_FIX=true nself buildnself db query "SELECT 1" # Test connection
nself restart postgresnself ssl check myapp.com
nself ssl renew myapp.comnself plugin stripe sync --verbose
nself plugin stripe webhook listdig app.myapp.com A
nslookup app.myapp.com
# Wait for propagation (5 min - 48 hours)project/
โโโ .env # Main config
โโโ .env.secrets # Sensitive data
โโโ schema.dbml # Database schema
โโโ docker-compose.yml # Generated
โโโ nginx/
โ โโโ nginx.conf
โ โโโ sites/
โ โโโ *.conf
โโโ postgres/
โ โโโ init/
โ โโโ migrations/
โโโ ssl/
โ โโโ cert.pem
โ โโโ key.pem
โโโ branding/ # White-label
โ โโโ config.json
โ โโโ logos/
โ โโโ themes/
โโโ nself/
โโโ migrations/
โโโ seeds/
โโโ backups/
https://api.local.nself.org (GraphQL)
https://auth.local.nself.org (Auth)
https://admin.local.nself.org (Admin)
https://api.myapp.com (GraphQL)
https://auth.myapp.com (Auth)
https://admin.myapp.com (Admin)
| Task | Time |
|---|---|
| Install nself | 2 min |
| Create project | 3 min |
| Build & start | 2 min (+ 2-5 min first time) |
| Apply schema | 2 min |
| Configure Stripe | 5 min |
| Add custom domain | 10 min (+ DNS propagation) |
| Deploy to production | 5-10 min |
- Docs: https://docs.nself.org
- GitHub: https://github.com/nself-org/cli
- Discord: https://discord.gg/nself
- Email: [email protected]
Print this page for quick reference while following tutorials!