All skills
denoland avatar

/deno-deploy

@2311d69 official
by Denodenoland/skills99 stars
8

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.

Use this Skill: https://skilld.dev/gh/denoland/skills/deno-deploy

This session only. Nothing lands on disk.

referencesFRAMEWORKS.md

≈1.6k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Framework-Specific Deployment

Deno Deploy supports multiple frameworks. The CLI auto-detects your framework and configures the build appropriately.

Framework Detection

Framework Detection Files Build Command Notes
Fresh islands/, fresh.config.ts deno task build Deno-native, island architecture
Astro astro.config.mjs, astro.config.ts npm run build or deno task build Static or SSR
Next.js next.config.js, next.config.mjs npm run build Requires nodeModulesDir: "auto"
Nuxt nuxt.config.ts npm run build Vue SSR framework
Remix remix.config.js npm run build React SSR framework
SolidStart app.config.ts with solid npm run build SolidJS SSR
SvelteKit svelte.config.js npm run build Svelte SSR framework
Lume _config.ts with lume import deno task build Deno-native static site

Framework Presets for deno deploy create

When creating an app with deno deploy create in non-interactive mode, you can specify --framework-preset to auto-configure build commands and runtime settings. The available presets are: Fresh, Next, Remix, Astro, SvelteKit, Nuxt, Lume, SolidStart.

When a preset is specified, you can omit --install-command, --build-command, --pre-deploy-command, and --runtime-mode — they are inferred from the preset.

If you don't specify a preset, the CLI still auto-detects your framework from the project files. Use --do-not-use-detected-build-config to skip auto-detection and specify everything manually.

Detect Framework Script

if [ -d "islands" ] || [ -f "fresh.config.ts" ]; then echo "Framework: Fresh"; \
elif [ -f "astro.config.mjs" ] || [ -f "astro.config.ts" ]; then echo "Framework: Astro"; \
elif [ -f "next.config.js" ] || [ -f "next.config.mjs" ]; then echo "Framework: Next.js"; \
elif [ -f "nuxt.config.ts" ]; then echo "Framework: Nuxt"; \
elif [ -f "remix.config.js" ]; then echo "Framework: Remix"; \
elif [ -f "svelte.config.js" ]; then echo "Framework: SvelteKit"; \
elif [ -f "_config.ts" ]; then echo "Framework: Lume (check imports)"; \
else echo "Framework: Custom/Unknown"; fi

Fresh (Deno-Native)

deno task build
deno deploy --prod

Fresh + PostgreSQL

When a Fresh app uses PostgreSQL (e.g., await initDb() at startup), you must provision the database before the app can successfully warm up. The Fresh auto-detection preset also has a known issue, so use manual build config.

Complete deployment sequence:

# 1. Create the app with --no-wait (warmup will fail without a database — that's expected)
deno deploy create \
  --org <ORG_NAME> --app <APP_NAME> \
  --source local \
  --do-not-use-detected-build-config \
  --install-command "deno install" \
  --build-command "deno task build" \
  --pre-deploy-command "echo ready" \
  --runtime-mode dynamic --entrypoint main.ts \
  --build-timeout 5 --build-memory-limit 1024 --region us \
  --no-wait

# 2. Provision a PostgreSQL database
deno deploy database provision my-db --kind prisma --region us-east-1

# 3. Assign it to the app (this injects DATABASE_URL, PGHOST, etc.)
deno deploy database assign my-db --app <APP_NAME>

# 4. Redeploy — now the database exists, so warmup succeeds
deno deploy --prod

Why this order matters:

  • Fresh + PostgreSQL apps typically call await initDb() in main.ts, which runs during warmup
  • If no database is assigned, the connection fails and the deploy is marked as failed
  • Using --no-wait on the first deploy lets you continue to the database setup without blocking

Why --do-not-use-detected-build-config:

  • The Fresh auto-detection and --framework-preset fresh can fail with an API error
  • Manual build config is more reliable — see Troubleshooting

Astro

# If using npm
npm run build
deno deploy --prod

# If using Deno tasks
deno task build
deno deploy --prod

Next.js

Next.js requires Node.js compatibility mode:

  1. Ensure deno.json has:

    {
      "nodeModulesDir": "auto"
    }
  2. Build and deploy:

    npm install
    npm run build
    deno deploy --prod --allow-node-modules

Nuxt / Remix / SvelteKit / SolidStart

These npm-based frameworks follow a similar pattern:

npm install
npm run build
deno deploy --prod

If you encounter issues with node_modules:

deno deploy --prod --allow-node-modules

Lume (Static Sites)

deno task build
deno deploy --prod

Custom / No Framework

For custom servers or apps without a recognized framework:

  1. Ensure you have an entrypoint (e.g., main.ts, server.ts)
  2. Deploy directly:
    deno deploy --entrypoint main.ts --prod

Static Site Deployment

For static sites (Lume, Vite builds, etc.), you have two options:

Option 1: Direct Directory Deployment

Point Deno Deploy at your built directory. Configure in deno.json:

{
  "deploy": {
    "entrypoint": "main.ts",
    "include": ["_site"]
  }
}

Option 2: Custom Server Wrapper

Only needed if you want custom routing, headers, or logic:

// serve.ts
import { serveDir } from "jsr:@std/http/file-server";

Deno.serve((req) =>
  serveDir(req, {
    fsRoot: "_site",
    quiet: true,
  })
);

Then deploy with:

deno deploy --entrypoint serve.ts --prod

Cloud Integrations

AWS Integration

deno deploy setup-aws --org my-org --app my-app

GCP Integration

deno deploy setup-gcp --org my-org --app my-app

Source: SKILL.md on GitHub

1 warning16d5 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    This skill provides safe and standard reference guidelines and deployment documentation for the Deno Deploy CLI. It covers configuration files, environment variables, command references, and databases without introducing dangerous command scripts, malicious prompt adjustments, obfuscated paths, or external download vulnerabilities.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: LOW · No issues

  • Runlayer7mo

    9/9 files flagged

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 2311d69. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 3 days ago.

Steadyupdated 2 months ago
metadata
{
  "author": "denoland",
  "version": "1.5"
}
  • CLI
  • deno
  • deno-deploy
  • deployment
  • environment-variables
  • kv
  • custom-domains
  • production

README badge

README badge for denoland/skills/deno-deploy

Guides deployment of Deno applications to Deno Deploy using the `deno deploy` CLI (requires Deno >= 2.4.2). Covers app creation, production and preview deploys, environment variables across contexts, KV database provisioning, and the `--tunnel` flag for local development.

Generated from the current SKILL.md.

Does this skill cover the deprecated `deployctl` command?
No. This skill uses only the modern `deno deploy` command (requires Deno >= 2.4.2). The `deployctl` command is deprecated and not covered.
Can I use this skill to deploy to other platforms like Vercel or AWS Lambda?
No. This skill applies only to Deno Deploy. For other platforms, use their platform-specific guidance directly.
What should I do if my app connects to a database at startup?
Create the app with `--no-wait`, provision and assign the database with `deno deploy database` commands, then redeploy so the database exists before warmup.
Do I need to add configuration to deno.json before deploying?
Only if you have an existing app on Deno Deploy. For new apps, `deno deploy create` sets up the config automatically. For subsequent deploys, `deno deploy --prod` uses the stored org and app names.
How do I set different environment variables for production and preview deployments?
Deno Deploy supports separate contexts: Production (live traffic), Development (previews), and Build (during builds). You can set different values for the same variable in each context using the CLI.

Generated from the current SKILL.md. These answers refresh after source changes.