Skip to main content
Prisma Documentation Docs

Search documentation

Type to search this documentation.

On this pageOverview

Deno (/docs/guides/runtimes/deno)

For the complete Prisma documentation index, see llms.txt. A markdown version of any docs page is available by appending .md to its URL.

Run a minimal Prisma ORM and PostgreSQL app on Deno.

Location: Guides > Runtimes > Deno

In this guide, you scaffold a minimal Prisma ORM app for Deno, initialize a PostgreSQL database, and run the generated typed query. The app uses Deno-native tasks and explicit .ts extensions for relative imports.

Every command below was run end to end against a live Prisma Postgres database.

  • Deno 2.6 or later (deno --version): the scaffold command passes --minimum-dependency-age=0, which earlier releases reject

To delegate this guide to your coding agent, copy the prompt below and hand it over:

text
Create and verify a minimal Prisma ORM app on Deno.

1. Run `deno run -A --minimum-dependency-age=0 npm:create-prisma@latest my-deno-app --template minimal --provider postgres --package-manager deno --no-deploy --yes`.
2. Enter `my-deno-app`. Run `deno run -A npm:create-db@latest --env .env --ttl 24h` and show me the claim URL so I can keep the temporary database.
3. Run `deno task db:init`, then start `deno task dev` in the background.
4. Request `http://localhost:3000` and verify that it returns Alice, Bob, and Carol. The first request seeds these users automatically; do not add or run a separate seed command.
5. Do not deploy to Prisma Compute because it does not support Deno.

Use the generated tasks instead of invoking a Prisma CLI package directly.

Run create-prisma through Deno and select the minimal PostgreSQL template:

Bash
deno run -A --minimum-dependency-age=0 npm:create-prisma@latest my-deno-app --template minimal --provider postgres --package-manager deno --no-deploy

The command creates the app, installs its npm dependencies through Deno, and emits the Prisma contract artifacts. Deno 2.9 skips npm packages published in the previous 24 hours by default, so without --minimum-dependency-age=0 a newly published create-prisma release resolves to an older version. Deno support is currently limited to the minimal PostgreSQL template.

Bash
cd my-deno-app

The generated project includes:

  • deno.json with npm compatibility enabled
  • Deno-native dev, build, and Prisma tasks in package.json
  • explicit .ts extensions on relative imports
  • no Composer or Prisma Compute deployment files

Create a temporary Prisma Postgres database and write its connection string to .env:

Bash
deno run -A npm:create-db@latest --env .env --ttl 24h

The command prints a claim URL. Open it within 24 hours to keep the database, or replace DATABASE_URL in .env with your own PostgreSQL connection string.

Apply the starter contract and sign the database:

Bash
deno task db:init

Start the generated HTTP server:

Bash
deno task dev

Then request it from another terminal:

Bash
curl http://localhost:3000

The response contains the starter users:

no-copy
{
  "users": [
    { "id": "1", "email": "alice@prisma.io", "username": "alice", "name": "Alice", "createdAt": "2026-07-24T10:55:54.156Z" },
    { "id": "2", "email": "bob@prisma.io", "username": "bob", "name": "Bob", "createdAt": "2026-07-24T10:55:54.192Z" },
    { "id": "3", "email": "carol@prisma.io", "username": "carol", "name": "Carol", "createdAt": "2026-07-24T10:55:54.228Z" }
  ]
}

The first request runs src/prisma/seed.ts through the generated query helper. Seeding is idempotent, so later requests read the same rows without creating duplicates. There is no separate seed command.

The generated src/prisma/users.ts connects the database, seeds on the first query, and reads from the PostgreSQL public namespace:

src/prisma/users.ts
import { db } from "./db.ts";
import { seed } from "./seed.ts";

export async function listUsers(limit = 10) {
  await seed();

  const users = await db.orm.public.User
    .select("id", "email", "username", "name", "createdAt")
    .limit(limit)
    .all();

  return users.map((user) => ({
    id: String(user.id),
    email: user.email,
    username: user.username ?? null,
    name: user.name ?? null,
    createdAt: user.createdAt,
  }));
}

Deno requires the .ts extension on these relative imports. The generated files already include it.

After changing src/prisma/contract.prisma, regenerate the typed artifacts and update the database:

Bash
deno task contract:emit
deno task db:update
  • Prisma Compute does not support Deno deployments yet.
  • The generated commands use -A for the filesystem, environment, and network permissions required during setup and local development. You can replace it with a narrower allow list for your application after setup.
  • Bun: Scaffold a Prisma ORM app with Bun, run your first typed query, serve users over HTTP, and deploy to Prisma Compute.
Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu