# SvelteKit (/docs/guides/frameworks/sveltekit) > 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. Set up Prisma ORM in a SvelteKit app with create-prisma, from scaffold to rendered data. Location: Guides > Frameworks > SvelteKit ## Introduction [#introduction] This guide shows you how to use Prisma ORM in a SvelteKit app. You scaffold a project where a server load function queries your database, initialize the schema, and see your data render. Every command below was run end to end against a live [Prisma Postgres](https://www.prisma.io/docs/postgres) database. ## Quick start [#quick-start] One command scaffolds the project with Prisma ORM wired in: #### bun ```bash bun create prisma@latest my-app --template svelte --provider postgres --no-deploy ``` #### pnpm ```bash pnpm create prisma@latest my-app --template svelte --provider postgres --no-deploy ``` #### yarn ```bash yarn create prisma@latest my-app --template svelte --provider postgres --no-deploy ``` #### npm ```bash npm create prisma@latest -- my-app --template svelte --provider postgres --no-deploy ``` Answer the prompts, then export `DATABASE_URL` in your shell before running the database scripts. If you do not have a database yet, `npx create-db@latest` prints a Prisma Postgres connection string. ## Prerequisites [#prerequisites] * [Node.js](https://nodejs.org) 22.18 or newer (on the 24 line, 24.11 or newer; 24 recommended) * A PostgreSQL connection string, or nothing at all: `npx create-db@latest` can create a Prisma Postgres database for you ## 1. Scaffold and enter the project [#1-scaffold-and-enter-the-project] #### bun ```bash bun create prisma@latest my-app --template svelte --provider postgres --no-deploy cd my-app ``` #### pnpm ```bash pnpm create prisma@latest my-app --template svelte --provider postgres --no-deploy cd my-app ``` #### yarn ```bash yarn create prisma@latest my-app --template svelte --provider postgres --no-deploy cd my-app ``` #### npm ```bash npm create prisma@latest -- my-app --template svelte --provider postgres --no-deploy cd my-app ``` The scaffold generates the SvelteKit app with Prisma ORM wired in, installs dependencies, and emits the contract your queries are type-checked against. Next, set the database connection. Use your own PostgreSQL connection string, or create a Prisma Postgres database with `npx create-db@latest`; it prints a connection string and a claim URL you can open to keep the database. Export the variable in the shell you work in; the generated scripts read the environment variable, not `.env`: ```bash export DATABASE_URL="" ``` ## 2. Initialize the database [#2-initialize-the-database] #### bun ```bash bun run db:init ``` #### pnpm ```bash pnpm run db:init ``` #### yarn ```bash yarn db:init ``` #### npm ```bash npm run db:init ``` ```text no-copy "summary": "Applied 5 operation(s) across 1 space(s), database signed" ``` If `db:init` stops with `Connection terminated unexpectedly`, a database you just created is still starting; wait a few seconds and run it again. The command is safe to repeat and reports `Applied 0 operation(s)` when there is nothing left to do. `db:init` applies your schema (`src/prisma/contract.prisma`) to the database and signs it. With TypeScript authoring (`--authoring typescript`) the schema is `src/prisma/contract.ts` and the emitted files land in `src/prisma/generated/`. Sample users are seeded automatically the first time the app queries the database. ## 3. Run and verify [#3-run-and-verify] #### bun ```bash bun run dev ``` #### pnpm ```bash pnpm run dev ``` #### yarn ```bash yarn dev ``` #### npm ```bash npm run dev ``` Open [http://localhost:5173](http://localhost:5173). The page lists the seeded users, loaded on the server by the `+page.server.ts` load function. ## Where things live [#where-things-live] * `src/routes/+page.server.ts`: the server `load` function that fetches users * `src/routes/+page.svelte`: the page that renders them * `src/prisma/users.ts`: the `listUsers` query helper the load function imports * `src/prisma/db.ts`: the Prisma ORM client behind that helper Model access is namespace-qualified on PostgreSQL: `db.orm.public.User`. The [Prisma ORM overview](https://www.prisma.io/docs/orm) covers the contract-first model behind it. [Prisma Compute](https://www.prisma.io/docs/compute) does not support SvelteKit 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 SvelteKit's usual hosts through its standard adapters. ## Use with your agent [#use-with-your-agent] To delegate this guide to your coding agent, copy the prompt below and hand it over: ```text Create a new SvelteKit app with Prisma ORM, seed it, and verify the page renders. 1. Scaffold: `npm create prisma@latest -- my-app --template svelte --provider postgres --yes`. Then run `npx prisma@latest init` in `my-app` so the Prisma agent skills are installed and stay current, and use them. Get a database connection string: use the one I give you, or create a Prisma Postgres database with `npx create-db@latest` and show me the claim URL it prints. Export it as `DATABASE_URL` in the shell; the generated scripts read the environment variable, not `.env`. 2. In `my-app`, run `npm run db:init` with `DATABASE_URL` exported. Sample users are seeded automatically on the app's first query; there is no separate seed script. 3. Do not deploy to Prisma Compute; it does not support SvelteKit yet. Start `npm run dev` in the background, wait until it reports ready, verify http://localhost:5173 lists the three seeded users, then stop the dev server, following https://www.prisma.io/docs/guides/frameworks/sveltekit.md. Use the installed Prisma ORM skills. ``` ## Next steps [#next-steps] * Change the schema in `src/prisma/contract.prisma`, then run `npm run contract:emit` and `npm run db:update`. * [Learn the fundamentals](https://www.prisma.io/docs/orm/fundamentals/reading-data): filtering, sorting, pagination, and writes. * [Read the Prisma ORM overview](https://www.prisma.io/docs/orm) for the concepts behind contracts and typed queries. ## Related pages - [`Astro`](https://www.prisma.io/docs/guides/frameworks/astro): Set up Prisma ORM in an Astro app with create-prisma, from scaffold to rendered data, and deploy it to Prisma Compute. - [`Elysia`](https://www.prisma.io/docs/guides/frameworks/elysia): Build an Elysia API on Prisma ORM with the elysia template and deploy it to Prisma Compute. - [`Hono`](https://www.prisma.io/docs/guides/frameworks/hono): Build a Hono API on Prisma ORM with the hono template, add your own routes, and deploy it to Prisma Compute. - [`NestJS`](https://www.prisma.io/docs/guides/frameworks/nestjs): Set up Prisma ORM in a NestJS app with create-prisma, from scaffold to seeded API to a live deploy on Prisma Compute. - [`Next.js`](https://www.prisma.io/docs/guides/frameworks/nextjs): Set up Prisma ORM in a Next.js app with create-prisma, from scaffold to rendered data, and deploy it to Prisma Compute.