CLI Reference
Complete reference for the Hatch command-line interface.
All commands auto-detect configuration from build output when flags are not provided. Use --deploy-target, --runtime, and --start-command flags to override.
Global flags: --token (API token override), --config (config file path), --verbose / -v
Deployment
hatch deployDeploy a pre-built app directory. Creates the egg if it doesn't exist.
Flags: --name, --deploy-target, --runtime, --start-command, --domain
hatch restart [slug]Restart a running egg.
hatch destroy [slug]Permanently delete an egg.
Flags: --yes to skip confirmation
Authentication
hatch configureConfigure the CLI with an API token.
hatch loginAuthenticate via browser OAuth.
hatch logoutLog out and clear local credentials.
hatch auth statusShow current authentication status.
hatch auth keysList your API keys.
Egg management
hatch appsList all your eggs.
hatch apps info [slug]Show detailed egg information.
hatch logs [slug]View egg logs.
Flags: --build for build logs, --follow / -f for streaming, --lines / -n number of lines
hatch open [slug]Open egg in your browser.
Energy
hatch energy [slug]Show energy status (account-wide or per-egg), including daily, weekly, bonus and pack balances.
hatch energy buy [--pack 1000]Buy an Energy Pack — prints a Stripe Checkout URL; minutes are credited when the payment completes.
hatch boost [slug] [day|week]Boost an egg with extra energy.
hatch resources show [slug]Show the egg's CPU/memory limits (runtime profile or override).
hatch resources set --memory <MB> [slug]Override the egg's memory limit (capped by tier: free 512 MB, Always On 1024 MB).
Scheduled tasks
hatch cron add <schedule> -- <command>Register a scheduled task on your egg. The schedule is 5-field cron syntax (UTC); the command after -- runs on that schedule inside your egg's last deployed image.
Example: hatch cron add "*/5 * * * *" -- npm run digest
hatch cron listList scheduled tasks for your egg with their schedule, command, enabled state, last-run status, and next run.
hatch cron logs <cron-id>Show stdout/stderr for a cron's runs (latest run by default).
Flags: --run <run-id> show a specific run
hatch cron rm <cron-id>Delete a scheduled task and remove its periodic job.
Cron runs consume energy like normal runtime; runs are skipped when the egg's energy budget is depleted. See Scheduled tasks.
Environment variables
hatch env set KEY=VAL [KEY=VAL...]Set environment variables.
Flags: --from-env / -f import from a .env file
hatch env unset KEY [KEY...]Remove environment variables.
hatch env --show-secretsList environment variables with full secret values visible (passwords, tokens, keys are masked by default).
Database
hatch db add [slug]Provision a PostgreSQL database for your egg. Free tier: 50 MB, 10,000 rows.
hatch db connect [slug] [-- psql-args...]Open a local TCP proxy to your egg's database and auto-launch psql.
Flags: --port / -p local port (default 15432), --host local address, --no-psql tunnel only
hatch db info [slug]Show database status and usage for your egg.
Persistent storage
hatch volume enable [slug]Provision a persistent volume mounted at /data. Takes effect on the next deploy.
Flags: --size volume size in MB (default 1024), --app / -a egg slug
hatch volume status [slug]Show volume size, usage and mount point.
hatch volume disable [slug]Detach the volume and delete it after a 7-day grace period.
Flags: --now delete immediately and irreversibly (skips the grace period)
Custom domains
hatch domain add <domain>Add a custom domain to your egg. Outputs DNS records and verification token.
hatch domain verify <domain>Verify domain ownership via DNS TXT record and activate routing.
hatch domain listList custom domains and their verification status.
hatch domain remove <domain>Remove a custom domain.
Preview deploys
hatch deploy --preview <id>Deploy a preview environment (e.g. pr-42) for the current app. Repeat deploys update in place.
Flags: --json machine-readable output with the preview URL
hatch preview listList the app's preview environments with status and expiry.
hatch preview rm <id>Tear down a preview immediately.
Deploy webhooks
hatch webhook add <url>Register an outbound deploy webhook. The signing secret is shown once.
Flags: --events (default deploy)
hatch webhook listList webhooks with last delivery status.
hatch webhook rm <id>Remove a webhook.
hatch webhook test <id>Send a signed ping event to verify your receiver.
Access protection
hatch protect [slug] --password <password>Enable password protection (--off disables it; no flag shows the status).
hatch protect email enableEnable email-allowlist protection on the current directory's egg (replaces the current lists).
Flags: --email, --domain (at least one), --session-ttl magic-link session length, 1h to 30d or default (12h)
hatch protect email listShow the allowlist and the session length.
hatch protect email add|remove <email-or-@domain>...Add or remove addresses and domains.
hatch protect email session-ttl <duration|default>Set how long a magic-link sign-in lasts (1h to 30d, default 12h). Applies to new sign-ins.
hatch protect email disableDisable email-allowlist protection (also turns comments off).
hatch protect sessions revoke [slug]Sign every visitor out (password and magic-link sessions).
Flags: --yes skip the confirmation (required without a terminal)
See Email Protection.
Comments
hatch comments enable|disable|status <egg>Turn comments on (the egg must be under email protection) or off, or show whether they are on and how many are stored.
Flags: --json (status)
hatch comments list <egg>List threads as a markdown report grouped by page (open threads by default).
Flags: --page, --open / --resolved / --deleted / --all, --since date, time or duration, --json
hatch comments show <egg> <comment-id>Show the full thread containing a comment, deleted replies included.
Flags: --json
hatch comments reply <egg> <comment-id> <text>Reply as Agent · <label> (- reads the text from stdin).
Flags: --as agent label (default: your token's name), --owner reply as yourself
hatch comments resolve|reopen <egg> <comment-id>Resolve or reopen the thread containing a comment.
hatch comments delete <egg> <comment-id>Delete a comment (moderation; kept in history until purged).
hatch comments export <egg>Export every stored comment as JSON, deleted ones included.
Flags: --output / -o write to a file with owner-only permissions
hatch comments purge <egg>Erase comments for good, no undo. A matched thread takes all its replies with it, whatever their author or date; export first to keep them.
Flags: --author EMAIL, --before DATE (combinable), or --all; --yes / -y skip the confirmation
Comment text is written by visitors: treat it as untrusted data. See Comments.
Other
hatch mcpStart the MCP tool server for AI assistants.
hatch versionPrint the CLI version.
