# Deno (/docs/guides/v8/runtimes/deno)

> For the complete Prisma documentation index, see [llms.txt](https://www.prisma.io/docs/llms.txt). A markdown version of any docs page is available by appending `.md` to its URL.

Run Prisma 8 on Deno, including the import-extension and permission differences that matter.

Location: Guides > v8 (RC) > Runtimes > Deno

## Introduction [#introduction]

In this guide, you scaffold a Prisma 8 project for Deno, initialize and seed a PostgreSQL database, and run your first typed query. Deno runs TypeScript natively and installs npm packages on demand, so the flow is close to the [Bun guide](https://www.prisma.io/docs/guides/v8/runtimes/bun) with two Deno-specific differences this guide calls out: explicit import extensions and permission flags.

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

## Prerequisites [#prerequisites]

* [Deno](https://deno.com/) 2.0 or later (`deno --version`)
* A PostgreSQL connection string, or nothing at all: the scaffold can create a [Prisma Postgres](https://www.prisma.io/docs/postgres) database for you

## Use with your agent [#use-with-your-agent]

Prefer to delegate this guide? Copy the prompt and hand it to your coding agent:

```text
Create a new Prisma 8 project on Deno, seed it, and run a first typed query.

1. Scaffold: `deno run -A npm:create-prisma@next create my-deno-app --template minimal --provider postgres --package-manager deno --prisma-postgres --yes` (or pass `--database-url "<url>"` instead of `--prisma-postgres` if I give you a connection string).
2. In `my-deno-app`, run `deno install`, then `deno run -A --env-file=.env npm:@prisma/cli@next contract emit` and `deno run -A --env-file=.env npm:@prisma/cli@next db init`.
3. Run `deno task db:seed`. If seeding fails with `Cannot read properties of undefined (reading 'where')`, change `db.orm.User` to `db.orm.public.User` in `src/prisma/seed.ts`, `src/prisma/users.ts`, and `src/index.ts`, then rerun.
4. Replace `src/index.ts` with a script that creates a user and reads all users back, following https://www.prisma.io/docs/guides/v8/runtimes/deno.md. Keep the `.ts` extension on relative imports. Verify `deno task dev` prints the created user and the user count.
5. Do not deploy to Prisma Compute; it does not support Deno yet.

Use the installed Prisma 8 skills.
```

## 1. Scaffold the project [#1-scaffold-the-project]

`create-prisma` supports Deno as a package manager choice:

```bash
deno run -A npm:create-prisma@next create my-deno-app --template minimal --provider postgres --package-manager deno
```

Pick Prisma Postgres at the database prompt to have a database created for you, or paste your own `DATABASE_URL`. The generated `package.json` scripts wrap every command in `deno run -A --env-file=.env`, so environment variables load without a dotenv import.

```bash
cd my-deno-app
deno install
```

## 2. Emit the contract and initialize the database [#2-emit-the-contract-and-initialize-the-database]

```bash
deno run -A --env-file=.env npm:@prisma/cli@next contract emit
deno run -A --env-file=.env npm:@prisma/cli@next db init
```

The first command compiles `src/prisma/contract.prisma` into the contract your queries are type-checked against and prints a JSON summary with `"ok": true` and the emitted file paths. The second creates the tables and signs the database; it exits quietly on success.

The `-A` flag grants the permissions the CLI needs (network for the database, filesystem for the generated files). To scope permissions tighter, start from `--allow-net --allow-read --allow-write --allow-env` and adjust to your setup.

## 3. Seed the database [#3-seed-the-database]

The scaffold wires a seed script to a Deno task:

```bash
deno task db:seed
```

```text no-copy
Seeded 3 users.
```

> [!NOTE]
> Seeing `Cannot read properties of undefined (reading 'where')`? The current template still generates the older unqualified query form. Update `db.orm.User` to `db.orm.public.User` in `src/prisma/seed.ts`, `src/prisma/users.ts`, and `src/index.ts`, then rerun `deno task db:seed`.

## 4. Write your first query [#4-write-your-first-query]

Replace `src/index.ts`. Two things to notice: Deno requires the `.ts` extension on relative imports, and model access is namespace-qualified on PostgreSQL (`db.orm.public.User`):

```ts title="src/index.ts"
import { db } from "./prisma/db.ts";

// Create a user, then read every user back
const user = await db.orm.public.User.create({
  email: `grace+${Date.now()}@prisma.io`,
  name: "Grace Hopper",
});
console.log(`created user ${user.email}`);

const users = await db.orm.public.User.select("id", "email", "name").all();
console.log(`there are now ${users.length} users`);

await db.runtime().close();
```

If you see `Module not found "file:///…/src/prisma/db"`, the import is missing its `.ts` extension. Deno does not resolve relative imports without an extension.

## 5. Run it [#5-run-it]

```bash
deno task dev
```

```text no-copy
created user grace+1784893859312@prisma.io
there are now 4 users
```

The count is the three seeded users plus the one this script created.

[Prisma Compute](https://www.prisma.io/docs/compute) does not support Deno deployments yet; see [Deploy your first app](https://www.prisma.io/docs/prisma-compute/deploy) for what is currently supported. In the meantime, the app deploys to Deno's usual hosts, such as Deno Deploy or any server that runs the Deno CLI.

## Common gotchas [#common-gotchas]

> [!WARNING]
> Deno reports `Unsupported compiler options in tsconfig.json` for a few options the scaffold sets for Node compatibility. The warning is harmless: Deno ignores those options and runs the code the same way.

## Prompt your coding agent [#prompt-your-coding-agent]

The scaffold installs [Prisma 8 skills](https://www.prisma.io/docs/ai/tools/skills#available-skills-for-prisma-8) for your coding agent. Prompts that map to this guide:

* "Using the prisma-8 skill, add a Deno task that prints every user created in the last day."
* "Tighten the Deno permissions for this project from -A to an explicit allow list."

## Next steps [#next-steps]

* [Learn the fundamentals](https://www.prisma.io/docs/orm/v8/fundamentals/reading-data): filtering, sorting, pagination, and writes.
* [Read the Prisma 8 overview](https://www.prisma.io/docs/orm/v8) for the concepts behind contracts and typed queries.
* [Use the Bun guide](https://www.prisma.io/docs/guides/v8/runtimes/bun) if you also target Bun; the flow is the same apart from the runtime differences above.

## Related pages

- [`Bun`](https://www.prisma.io/docs/guides/v8/runtimes/bun): Scaffold a Prisma 8 app with Bun, run your first typed query, serve users over HTTP, and deploy to Prisma Compute.