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.

referencesDATABASES.md

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

Databases on Deno Deploy

Overview

Deno Deploy provides built-in database support with automatic environment isolation. You don't need to manage connection strings or worry about mixing production and development data.

Available Database Engines

Engine Description
Deno KV Fast, globally distributed key-value store hosted by Deno
PostgreSQL Connect your own PostgreSQL or provision managed Postgres via Prisma

Key Concept: Timelines

Deno Deploy automatically creates isolated databases for each environment:

  • Production: {app-id}-production
  • Git branches: {app-id}--{branch-name}
  • Preview deployments: {app-id}-preview

This means your preview deployments won't accidentally modify production data.

Database CLI Commands

Use deno deploy database to manage databases from the command line.

List Databases

# List all databases in your organization
deno deploy database list

# Search for databases by name
deno deploy database list my-prefix

Provision a Database

Create a new managed database:

# Provision a new Deno KV database
deno deploy database provision my-database --kind denokv

# Provision a new Prisma PostgreSQL database (requires --region)
deno deploy database provision my-database --kind prisma --region us-east-1

Link an External Database

Link an existing external postgres database by providing a connection string:

deno deploy database link my-database "postgres://user:pass@host:5432/db"

Assign / Detach

Connect or disconnect a database from an app:

# Assign a database to an app
deno deploy database assign my-database --app my-app

# Detach a database from an app
deno deploy database detach my-database --app my-app

Deno Deploy creates separate databases for each timeline automatically.

Query a Database

Run queries directly from the CLI:

deno deploy database query my-database production "SELECT * FROM users LIMIT 10"

The second argument is the timeline name (e.g., production, preview, or a branch name), which can be found in the output of deno deploy database list.

Delete a Database

deno deploy database delete my-database

Connecting in Code

Deno KV

No configuration needed - just call Deno.openKv():

const kv = await Deno.openKv();

// Deno Deploy automatically connects to the right database
// based on your current environment (production, preview, etc.)

PostgreSQL

Deno Deploy injects standard environment variables that most PostgreSQL libraries detect automatically:

  • DATABASE_URL - Full connection string
  • PGHOST, PGPORT, PGDATABASE, PGUSER, PGPASSWORD - Individual components
// Recommended: npm:pg (best PostgreSQL driver for Deno Deploy)
import pg from "npm:pg";
const pool = new pg.Pool(); // Reads DATABASE_URL from environment automatically
const { rows } = await pool.query("SELECT * FROM users");

Local Development

With Tunnel

Use --tunnel to connect your local dev server to your hosted development database:

deno task --tunnel dev

This gives you access to the same database environment variables locally.

Without Tunnel

  • Deno KV: Data stays in memory during local development
  • PostgreSQL: Point to a local PostgreSQL instance or use the tunnel

Migrations

Deno Deploy supports pre-deploy commands that run before each deployment. Use these for database migrations:

{
  "deploy": {
    "preDeploy": ["deno task db:migrate"]
  }
}

Sharing Databases

Multiple apps can share the same database instance. Each app gets its own isolated databases per timeline, even when sharing.

Documentation

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