Deno
Run a minimal Prisma ORM and PostgreSQL app on Deno.
Introduction
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.
Prerequisites
- Deno 2.6 or later (
deno --version): the scaffold command passes--minimum-dependency-age=0, which earlier releases reject
Use with your agent
To delegate this guide to your coding agent, copy the prompt below and hand it over:
1. Scaffold the project
Run create-prisma through Deno and select the minimal PostgreSQL template:
deno run -A --minimum-dependency-age=0 npm:create-prisma@latest my-deno-app --template minimal --provider postgres --package-manager deno --no-deployThe 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.
cd my-deno-appThe generated project includes:
deno.jsonwith npm compatibility enabled- Deno-native
dev,build, and Prisma tasks inpackage.json - explicit
.tsextensions on relative imports - no Composer or Prisma Compute deployment files
2. Create and initialize the database
Create a temporary Prisma Postgres database and write its connection string to .env:
deno run -A npm:create-db@latest --env .env --ttl 24hThe 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:
deno task db:init3. Run the app
Start the generated HTTP server:
deno task devThen request it from another terminal:
curl http://localhost:3000The response contains the starter users:
{
"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.
4. Understand the generated query
The generated src/prisma/users.ts connects the database, seeds on the first query, and reads from the PostgreSQL public namespace:
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:
deno task contract:emit
deno task db:updateCurrent limitations
- Prisma Compute does not support Deno deployments yet.
- The generated commands use
-Afor 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.
Next steps
- Learn the fundamentals: filtering, sorting, pagination, and writes.
- Read the Prisma ORM overview for contracts, typed queries, and migrations.
- Use the Bun guide if you also target Bun.
