Repository navigation
Leaving nSelf
Export a started project to a new or empty directory:
nself db export --out ./portable-bundle --jsonChoose schemas with --schemas public,app. Omit object files with --no-storage.
The output's parent directory must exist. Export runs on Linux and macOS only (its
tool containers run as your numeric user id); other platforms are refused before any
read. It reads the stack without stopping services or changing source data. It checks
available disk before writing output. The estimate is 3.7 times the selected tables'
relation sizes (1.2 for the archive, 2.5 for the temporary plain-SQL rendering the
secret scan needs) plus object bytes; leave additional room for large metadata and
auth records.
The bundle contains a custom-format PostgreSQL archive, a readable schema dump, table counts and content hashes, portable auth users with bcrypt password hashes, S3 objects, Hasura metadata for selected tables, and configuration key names. The metadata keeps table configuration, relationships, computed fields and permissions. Event triggers (webhook URLs and header values), remote relationships, remote schemas, actions and source connection settings are not exported; recreate them at the destination. Database reads and both dumps share one repeatable-read snapshot, which ends as soon as the dumps and the auth read finish, before objects download. S3 and Hasura have no cross-service transaction: avoid changing objects or metadata during export. An object's size changing between enumeration and download fails the export.
Restore the database with ordinary PostgreSQL tools of the source major or newer.
The archive keeps some objects that point at data export leaves out, and it carries
no CREATE EXTENSION statements (the dump is scoped to schemas). A plain
pg_restore into a vanilla PostgreSQL therefore stops on those items. Use this
recipe instead.
-
Create the database and the extensions the schema uses. List what your schema needs (the source's
SELECT extname FROM pg_extensionis the authority):createdb destination grep -o -w -E 'citext|vector|hstore|ltree|gin_trgm_ops|uuid_generate_v[0-9]+|crypt|gen_salt|digest' \ portable-bundle/db/schema.sql | sort -u # pgcrypto: crypt, gen_salt, digest. uuid-ossp: uuid_generate_v*. pg_trgm: gin_trgm_ops. psql destination -c 'CREATE EXTENSION IF NOT EXISTS pgcrypto' psql destination -c 'CREATE EXTENSION IF NOT EXISTS citext' psql destination -c 'CREATE EXTENSION IF NOT EXISTS "uuid-ossp"' psql destination -c 'CREATE EXTENSION IF NOT EXISTS vector' # only when the schema uses vector
-
Skip the items that reference excluded data: foreign keys into
np_*tables or theauthschema (unless your destination already has a compatibleauth.users), and Hasura event-trigger functions inhdb_catalog, which is not exported.cd portable-bundle # Names of foreign keys whose REFERENCES target is auth or an np_* table. grep -E 'REFERENCES +(auth\.|[A-Za-z0-9_]+\.np_|np_)' db/schema.sql \ | grep -o 'ADD CONSTRAINT [^ ]*' | awk '{print $3}' > skip-names.txt pg_restore -l db/data.dump > full.toc { grep ' FK CONSTRAINT ' full.toc | grep -F -w -f skip-names.txt grep -E ' TRIGGER .*notify_hasura_' full.toc; } > skip.toc grep -v -F -x -f skip.toc full.toc > restore.toc pg_restore --exit-on-error --no-owner --no-privileges -L restore.toc --dbname destination db/data.dump
Review
skip.tocbefore restoring: every line in it is something the destination will not have. Recreate those foreign keys once the referenced tables exist.
Auth users are in auth/users.jsonl. Load these through your destination's supported
user import process, preserving bcrypt hashes where supported. Auth sessions,
refresh tokens, provider tokens and signing keys are not exported. Database dumps
exclude the platform auth schema; application foreign keys into it need a compatible
destination auth schema and users before the post-data section is restored.
Objects are content-addressed files. Use each manifest object's bucket, key and
member to upload it with any S3 client. For example, with the destination's AWS
credentials already configured:
jq -c '.storage.objects[]' portable-bundle/manifest.json | while IFS= read -r object; do
bucket=$(printf '%s' "$object" | jq -r .bucket)
key=$(printf '%s' "$object" | jq -r .key)
member=$(printf '%s' "$object" | jq -r .member)
aws s3 cp "portable-bundle/$member" "s3://$bucket/$key"
doneThe file mapping preserves distinct S3 keys on case-insensitive filesystems. Only object bytes are exported, not S3 ACLs, version history or HTTP metadata.
Plugin tables named np_*, schemas named np_*, nself_ops, hdb_catalog, and
PostgreSQL system schemas are excluded. Export never carries environment values,
database connection settings, remote Hasura sources, remote schemas or actions.
Hasura permissions, relationships and selected functions remain in the metadata
file for review and application to the destination's configured database source.
Output directories are 0700; files are 0600. Export scans every text member, the
manifest and a plain-SQL rendering of the custom archive for resolved secret values
of at least six bytes: values of secret-named keys (from the project cascade,
.nself/compose.env and the process environment), URL userinfo passwords and tokens,
credential-named query parameters, and string fields inside JSON-valued secrets. E526 rejects the entire
bundle and names only the affected member. Bcrypt password hashes in users.jsonl
are permitted. User object files are not scanned: inspect them before sharing.
E525 means insufficient disk; E527 means the output is occupied. Failed exports
leave no new bundle. The scan also looks for each secret as it is printed inside
json, jsonb, array, hstore and composite values, in COPY data and in SQL literals,
and in the spellings an application picks when it writes JSON itself and Postgres
stores it as text (/ written as \/, punctuation written as \u00xx in lower- or
upper-case hex). Not detected: XML entity encoding (&, <), base64 or
any other application-level encoding, encrypted values, and values shorter than the
six-byte minimum. If an app stores a secret in one of those forms, the scan cannot
see it: inspect those columns before sharing.
Interrupting the command (Ctrl-C, SIGTERM, closing the terminal) removes the private
stage directory. A process killed outright (SIGKILL, power loss) can leave an
unscrubbed .nself-export-* directory next to the output; the next export warns
about it on stderr. Remove stale ones with rm -rf <parent>/.nself-export-* when no
export is running. Keep the bundle private: it contains application data and
password hashes even after the secret scan passes.
See Import-Export-Format for the manifest and integrity rules.
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-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
- Shared-Proxy
- Config-Optional-Services
- Config-Custom-Services
- Config-System
Plugins (87 + 10 monitoring)
- Plugin-Overview
- Plugin-Catalog
- Plugin-Install
- Plugin-Licensing
- Plugin-Architecture
- Plugin-Dev-Guide
- Plugin-Migrations-Contract
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-analytics
- plugin-auth
- 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-ddns
- plugin-devices
- plugin-documents
- plugin-entitlements
- 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-object-storage
- plugin-observability
- plugin-photos
- plugin-podcast
- plugin-post
- plugin-realtime
- plugin-retro-gaming
- plugin-rom-discovery
- plugin-social
- plugin-sports
- 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
- Architecture
- Architecture-Guardrails
- Service-Graph
- Compose-Generation
- Nginx-Generation
- Plugin-Architecture
Reference
Machine interface
-
JSON-Output,
--jsonenvelope -
Command-Registry,
nself help --json - Exit-Codes
- error-codes, Error Codes
-
Compat-V15,
NSELF_V15gate
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 (21)
- A: cmd-add · cmd-admin
- B: cmd-backup · cmd-build
- C: cmd-clean · cmd-config
- D: cmd-db · cmd-deploy · cmd-doctor
- E: cmd-exec
- I: cmd-init
- L: cmd-license · cmd-logs
- M: cmd-mcp
- R: cmd-remove · cmd-reset · cmd-restart
- S: cmd-start · cmd-status · cmd-stop
- U: cmd-update