npx skills add ...
npx skills add denoland/skills --skill deno-deploy
npx skills add denoland/skills --skill deno-deploy
Use when deploying Deno apps to production, asking about Deno Deploy, or working with `deno deploy` CLI commands. Covers deployment workflows, environment variables, KV database access, custom domains, the --tunnel flag for local development, and the `deno deploy` command reference.
This skill provides guidance for deploying applications to Deno Deploy.
This skill applies only to Deno Deploy questions. Follow these rules:
--tunnel flag.deno deploy commands, Deno KV, or Deno Deploy environment
variable configuration in responses about other platforms or local-only
scripts.deno deploy, NOT deployctlAlways use the deno deploy command. Do NOT use deployctl.
deployctl is for Deno Deploy Classic (deprecated)deno deploy is the modern, integrated command built into the Deno CLIdeno deploy subcommand was introduced in
Deno 2.4Always run --help before guessing at flags. The deno deploy subcommand
has many flags, and they change between versions. When you're unsure what a
command accepts:
This takes seconds and prevents repeated trial-and-error failures. Never assume a flag exists — check first.
Always show the core deploy command first — then explain diagnostic steps.
When a user asks "how do I deploy?", lead with the actual command
(deno deploy --prod) before covering pre-flight checks and configuration.
Before running any deploy commands, find where the Deno app is located:
All deploy commands must run from the app directory.
Check Deno version and existing configuration:
Before deploying, check if the app connects to a database or external service at
startup (e.g., top-level await initDb() in main.ts). If it does, the deploy
will fail during warmup because the database doesn't exist yet.
If the app has startup database dependencies, follow this order:
Create the app with --no-wait so a warmup failure doesn't block you:
Provision and assign the database:
Redeploy (now the database exists, warmup will succeed):
If the app has no startup dependencies, skip this step and deploy normally below.
If deploy.org AND deploy.app exist in deno.json:
If NO deploy config exists:
Apps must be created before they can be deployed to. You cannot run
deno deploy --prod until an app exists.
IMPORTANT: Ask the user first - Do they have an existing app on Deno Deploy, or do they need to create a new one?
If they have an existing app, add the config directly to deno.json:
The org name is in the Deno Deploy console URL (e.g.,
console.deno.com/your-org-name). Once this config is in place, subsequent
deploys just need deno deploy --prod.
If they need to create a new app:
The CLI needs an organization name. Find it at https://console.deno.com - the
org is in the URL path (e.g., console.deno.com/your-org-name).
Interactive creation (opens a browser — only works when a human is at the keyboard):
Non-interactive creation (use when an AI agent is performing the deploy, or in CI/CD):
The create command also does the initial deploy. After it completes, deno.json
is updated with deploy.org and deploy.app automatically. From that point on,
subsequent deploys only need:
After completion, verify the config was saved:
When an AI agent is performing the deployment, always use the non-interactive flow with explicit flags. The interactive flow requires browser windows and terminal prompts that agents cannot navigate.
Preview deployments create a unique URL for testing without affecting production.
Set the entrypoint in your deno.json (this is used by deno deploy create
during app creation):
Note: --entrypoint is a flag on deno deploy create, not on deno deploy
itself.
These flags are available on deno deploy create (and apply during the initial
deploy):
| Flag | Purpose |
|---|---|
--allow-node-modules | Include node_modules directory in upload |
--no-wait | Skip waiting for the build to complete |
When any flag beyond --org is provided, deno deploy create runs in
non-interactive mode — all required flags must be specified. This is the
recommended approach for AI agents and CI/CD pipelines.
| Flag | Description |
|---|---|
--org <name> | Organization name |
--app <name> | Application name (becomes your URL: <app>.deno.dev) |
--source <local|github> | Deploy from local files or a GitHub repo |
--build-timeout <minutes> | Build timeout: 5, 10, 15, 20, 25, or 30 |
--build-memory-limit <MB> | Memory limit: 1024, 2048, 3072, or 4096 |
--region <region> | Deployment region: us, eu, or global |
When using --source github, you also need:
| Flag | Description |
|---|---|
--owner <name> | GitHub repository owner |
--repo <name> | GitHub repository name |
| Flag | Description |
|---|---|
--app-directory <path> | Path to app directory (for monorepos) |
--framework-preset <preset> | Framework preset (see Frameworks) |
--install-command <cmd> | Custom install command |
--build-command <cmd> | Custom build command |
--pre-deploy-command <cmd> | Command to run before deploy |
--do-not-use-detected-build-config | Skip auto-detection of framework config |
The CLI auto-detects your framework and build configuration. If a framework is
detected, you can skip --install-command, --build-command,
--pre-deploy-command, and --runtime-mode — they'll be inferred from the
preset. Use --do-not-use-detected-build-config to override detection. When
using this flag, all three build commands (--install-command,
--build-command, --pre-deploy-command) plus --runtime-mode become
required — omitting any of them causes exit code 2.
You must pick a runtime mode with --runtime-mode <dynamic|static> (unless a
framework preset handles it).
Dynamic mode (for apps with a server):
| Flag | Description |
|---|---|
--entrypoint <path> | Entry file (required for dynamic mode) |
--arguments <args> | Arguments passed to entrypoint (repeatable) |
--working-directory <cwd> | Working directory for the process |
Static mode (for static sites):
| Flag | Description |
|---|---|
--static-dir <dir> | Directory to serve static files from (required) |
--single-page-app | Serve index.html for routes that don't match a file |
| Flag | Description |
|---|---|
--dry-run | Validate everything without actually creating the app |
--no-wait | Don't wait for the build to complete |
--allow-node-modules | Include node_modules in the upload |
Simple Deno server:
Fresh app (framework auto-detected):
Next.js from GitHub:
Static site:
Deno Deploy has three "contexts" - logical environments where your code runs, each with its own set of variables:
| Context | Purpose |
|---|---|
| Production | Live traffic on your production URL |
| Development | Preview deployments and branch URLs |
| Build | Only available during the build process |
You can set different values for the same variable in each context. For example, you might use a test database URL in Development and the real one in Production.
These are automatically available in your code:
| Variable | Description |
|---|---|
DENO_DEPLOY | Always 1 when running on Deno Deploy |
DENO_DEPLOYMENT_ID | Unique ID for the current deployment |
DENO_DEPLOY_ORG_ID | Your organization's ID |
DENO_DEPLOY_APP_ID | Your application's ID |
CI | Set to 1 during builds only |
DENO_, LD_, or OTEL_Deno Deploy provides built-in database support with automatic environment isolation. Each environment (production, preview, branch) gets its own isolated database automatically.
| Engine | Use Case |
|---|---|
| Deno KV | Key-value storage, simple data, counters, sessions |
| PostgreSQL | Relational data, complex queries, existing Postgres apps |
No configuration needed - just use the built-in API:
Deno Deploy automatically connects to the correct database based on your environment.
For PostgreSQL, Deno Deploy injects environment variables (DATABASE_URL,
PGHOST, etc.) that most libraries detect automatically:
Use the deno deploy database command to provision and manage databases:
For detailed CLI commands, see Databases.
Use --tunnel to connect to your hosted development database locally:
See Databases and Deno KV for detailed documentation.
The tunnel feature lets you expose your local development server to the internet. This is useful for:
Add the --tunnel flag when running your app:
The first time you run this, it will:
You can use --tunnel with your existing tasks in deno.json:
This runs your dev task with the tunnel enabled.
Beyond just forwarding requests, the tunnel also:
context:local)| Command | Purpose |
|---|---|
deno deploy --prod | Deploy to production (app must exist first) |
deno deploy | Preview deployment |
deno deploy create --org <name> | Create new app (interactive) |
deno deploy create --org <name> --app <name> ... | Create new app (non-interactive, see full flags above) |
deno deploy create ... --no-wait | Create app without waiting for build to complete |
deno deploy create ... --allow-node-modules | Create app including node_modules |
deno deploy env add <var> <value> | Add plain text environment variable |
deno deploy env add <var> <value> --secret | Add secret environment variable |
deno deploy env list | List environment variables |
deno deploy env update-value <var> <value> | Update variable value (keeps contexts/secret status) |
deno deploy env update-contexts <var> <contexts...> | Update which contexts a variable applies to |
deno deploy env delete <var> | Delete environment variable |
deno deploy env load <file> | Load variables from .env file (defaults to secret) |
deno deploy env load <file> --non-secrets <keys...> | Load .env file, marking specific keys as non-secrets |
deno deploy database provision <name> --kind <type> | Provision a new database |
deno deploy database assign <name> --app <app> | Assign database to an app |
deno deploy logs | View deployment logs |
deno run --tunnel -A <file> | Start local tunnel |
deno task --tunnel <task> | Run task with tunnel |
Deno Deploy runs in one or many regions (globally distributed). Keep in mind:
deno deploy env, not .env files
at runtime# Check Deno version (must be >= 2.4.2)
deno --version | head -1
# Check for existing deploy config
grep -E '"org"|"app"' deno.json deno.jsonc 2>/dev/null || echo "NO_DEPLOY_CONFIG"