-
-
Notifications
You must be signed in to change notification settings - Fork 2
HASURA
Deprecated.
nself hasurahas moved tonself db hasura.# Old (deprecated — removed in v1.0.0) nself hasura console nself hasura metadata apply # New nself db hasura console nself db hasura metadata apply
Version: v0.9.9
Status: Deprecated — use nself db hasura
Hasura GraphQL management commands for metadata operations and console access. These commands are now part of nself db hasura since Hasura management is database-adjacent (metadata tracks schema, permissions, and relationships). This page is kept for reference — see DB.md for the current documentation.
nself db hasura <subcommand> [options]| Subcommand | Description |
|---|---|
metadata apply |
Apply metadata to Hasura |
metadata export |
Export metadata from Hasura |
metadata reload |
Reload metadata cache |
console |
Open Hasura Console |
help |
Show help information |
For metadata apply, metadata export, and console commands with CLI features:
# Install globally
npm install -g hasura-cli
# Verify installation
hasura versionNote: The metadata reload command uses curl and doesn't require Hasura CLI.
Apply local metadata to Hasura instance.
nself db hasura metadata applyRequirements:
- Hasura CLI installed
-
HASURA_GRAPHQL_ADMIN_SECRETset in environment - Metadata files in
hasura/metadata/directory
What it does:
- Reads
HASURA_GRAPHQL_ADMIN_SECRETfrom environment - Determines Hasura endpoint from config
- Auto-generates
hasura/config.yamlif missing (see Config File Auto-Generation below) - Applies metadata from local directory using
--projectand--endpointflags
Example:
nself db hasura metadata applyExport metadata from Hasura instance to local files.
nself db hasura metadata exportRequirements:
- Hasura CLI installed
-
HASURA_GRAPHQL_ADMIN_SECRETset in environment
What it does:
- Connects to Hasura instance
- Exports all metadata (tables, relationships, permissions, etc.)
- Saves to
hasura/metadata/directory
Example:
nself db hasura metadata exportReload Hasura metadata cache without restarting.
nself db hasura metadata reloadRequirements:
-
HASURA_GRAPHQL_ADMIN_SECRETset in environment - Hasura service running
What it does:
- Sends API request to Hasura
- Triggers metadata cache reload
- No service restart required
Example:
nself db hasura metadata reloadUse cases:
- After database schema changes
- After modifying tracked tables
- To refresh stale metadata cache
Open Hasura Console in browser.
nself db hasura consoleWith Hasura CLI:
- Opens Hasura CLI console (with migration tracking)
- Automatically authenticates with admin secret
- Changes are tracked in metadata files
Without Hasura CLI:
- Prints URL to web console
- Manual navigation required
Examples:
# Open console
nself db hasura console
# Or access directly at
# http://localhost:8080/consoleThe Hasura CLI v2 requires a config.yaml file even when --endpoint and --admin-secret are passed as flags. It uses config.yaml to locate the metadata_directory.
nself db hasura metadata apply, metadata export, and console all call ensure_hasura_config before running any Hasura CLI command. This function:
- Checks for
HASURA_PROJECT_DIRenv var, then falls back to looking forhasura/in the current directory - Creates
hasura/config.yamlif the directory exists but the file is missing - Never overwrites an existing
config.yaml
The generated file sets metadata_directory: metadata and the Hasura endpoint. The admin secret is intentionally NOT written to the file — it is passed as --admin-secret on the CLI invocation so no secret lands on disk.
If your hasura directory is not at hasura/ relative to where you run nself commands, set HASURA_PROJECT_DIR=<path> in your .env.
nself build also runs this step, so after a build the file will always be present before you run any hasura commands.
The command automatically reads:
| Variable | Description | Default |
|---|---|---|
HASURA_GRAPHQL_ENDPOINT |
Hasura API endpoint | http://localhost:8080 |
HASURA_PORT |
Hasura port | 8080 |
HASURA_GRAPHQL_ADMIN_SECRET |
Admin secret for authentication | (required) |
HASURA_PROJECT_DIR |
Path to hasura project directory (contains config.yaml and metadata/) | hasura |
HASURA_PORT=8080
HASURA_GRAPHQL_ADMIN_SECRET=your-secret-key-here
HASURA_GRAPHQL_ENDPOINT=http://localhost:8080# 1. Make changes in Hasura Console
nself db hasura console
# 2. Export metadata after changes
nself db hasura metadata export
# 3. Commit metadata to git
git add hasura/metadata/
git commit -m "Add users table and permissions"
# 4. Apply to another environment
nself db hasura metadata apply# After running database migration
nself db migrate
# Reload Hasura metadata
nself db hasura metadata reload# Export current state
nself db hasura metadata export
# Clear and reapply
nself db hasura metadata applyhasura/
└── metadata/
├── actions.graphql
├── actions.yaml
├── allow_list.yaml
├── cron_triggers.yaml
├── databases/
│ └── default/
│ └── tables/
│ ├── public_users.yaml
│ └── public_posts.yaml
├── query_collections.yaml
├── remote_schemas.yaml
└── version.yaml
- Metadata commands read from cascading environment files
- Admin secret is required for all operations
- Console access requires Hasura service to be running
- Metadata files should be version controlled
- Always test metadata changes in staging first
# Error: HASURA_GRAPHQL_ADMIN_SECRET not set
# Solution: Set in environment
echo "HASURA_GRAPHQL_ADMIN_SECRET=your-secret" >> .env
nself restart hasura# Error: Hasura CLI not found
# Solution: Install CLI
npm install -g hasura-cli
# Or access console directly
nself urls | grep hasura
# Open console URL in browser# Check Hasura is running
nself status hasura
# Check endpoint
nself config env | grep HASURA
# Restart service
nself restart hasura# Export current metadata first
nself db hasura metadata export
# Check for conflicts
diff -r hasura/metadata/ /path/to/backup/
# Apply with verbose output
hasura metadata apply --endpoint http://localhost:8080 --admin-secret $HASURA_GRAPHQL_ADMIN_SECRETDocumentation: https://hasura.io/docs/latest/graphql/core/migrations/index.html
Category: Core Services
ɳ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-sentry · 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
- nself-ai-gateway
- nself-ai-cc
- 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
- 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