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 deploy

Deploy 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 configure

Configure the CLI with an API token.

hatch login

Authenticate via browser OAuth.

hatch logout

Log out and clear local credentials.

hatch auth status

Show current authentication status.

hatch auth keys

List your API keys.

Egg management

hatch apps

List 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 list

List 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-secrets

List 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 list

List 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 list

List 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 list

List 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.

Other

hatch mcp

Start the MCP tool server for AI assistants.

hatch version

Print the CLI version.

Hatch mascot