-
-
Notifications
You must be signed in to change notification settings - Fork 2
cmd federation
Manage GraphQL Federation for multi-service nSelf deployments (opt-in, requires
NSELF_FEDERATION=true).
nself federation <subcommand> [flags]nself federation manages the Apollo Router supergraph that federates Hasura and plugin subgraphs into a single unified GraphQL API. Federation is disabled by default. Enable it by setting NSELF_FEDERATION=true in your .env and running nself build.
When federation is enabled, nself build collects all installed plugins with graphql.enabled: true, adds Hasura as the core subgraph, composes a supergraph schema via rover supergraph compose, and injects Apollo Router (Custom Service slot CS_7, port 4000) into docker-compose.yml. All /v1/graphql traffic routes through Apollo Router instead of directly to Hasura.
The composed supergraph schema and router configuration are written to .nself/federation/. The supergraph.yaml and router.yaml files in that directory are managed by nSelf and regenerated on each build.
| Subcommand | Description |
|---|---|
compose |
Re-compose supergraph schema from installed plugin subgraphs |
status |
Show subgraph health and schema composition status |
introspect |
Print the full supergraph schema to stdout |
| Flag | Short | Type | Default | Description |
|---|---|---|---|---|
--json |
– |
bool | false | Output status as JSON |
No flags.
No flags.
Plugins declare federation participation in their plugin.yaml manifest via a graphql block:
graphql:
enabled: true
subgraph_name: ai # unique lowercase name in the supergraph
subgraph_url: http://127.0.0.1:${PORT}/graphql
schema_path: schema.graphql # optional static SDL for rover compose
entities:
- type: User
key: idsubgraph_name must be a valid GraphQL SDL name ([a-z][a-z0-9_]*). subgraph_url may use ${PORT}, which is interpolated from the plugin's declared port at build time. Either schema_path or subgraph_url must be non-empty for rover supergraph compose to succeed.
Hasura is always included as a subgraph; its URL is derived from HASURA_PORT in your .env.
# Enable federation and rebuild
NSELF_FEDERATION=true nself build# Re-compose after installing a plugin that exposes a subgraph
nself federation compose# Check all subgraph health
nself federation status# Check subgraph health in JSON format
nself federation status --json# Inspect the composed supergraph schema
nself federation introspect# Pipe the schema into a diff tool to detect drift
nself federation introspect > supergraph-new.graphql
diff supergraph-old.graphql supergraph-new.graphql# Rebuild the stack after a composition change
nself federation compose && nself start- cmd-build.md — rebuild docker-compose and nginx configs after federation changes
- cmd-plugin.md — install plugins that expose GraphQL subgraphs
- cmd-status.md — view the running state of your nSelf install
- cmd-doctor.md — verify environment and configuration health
- cmd-db.md — manage the Postgres database backing the federated schema
ɳSelf CLI v1.0.9. MIT licensed. Docs CC BY 4.0.
GitHub · Issues · Discussions · nself.org · docs.nself.org
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-watchdog · cmd-dogfood
- 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-security · cmd-secrets · cmd-waf
- Tenancy: cmd-tenant · cmd-billing
- Plugins: cmd-plugin · cmd-license
- 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-ɳClaw, AI Assistant
- Feature-ɳChat, Messaging
- Feature-ɳTV, Media Player
- Feature-ɳFamily, Family Social
- Feature-ɳCloud, 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-ai
- 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
- 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