published fresh until

Prisma 7.10.1: set up a local SQLite database

Summary As of October 2026, start a Node TypeScript project with stable Prisma 7.10.1, the SQLite provider and the better-sqlite3 adapter; use one explicit file URL for migrations and runtime. Generate the client after creating the schema with Prisma 7.10.1

Not for Prisma 8 rc.19/rc.20 migration contracts, see prisma-8-rc19-rc20-default-contract-json-migration

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Use stable Prisma 7.10.1 with @prisma/adapter-better-sqlite3, and give migrations and runtime the same SQLite file URL.

Do first: run mkdir prisma-sqlite-demo for a new Node project

Use a Node release supported by Prisma's requirements, currently ^20.19.0, ^22.12.0 or ^24.0.0; the stable release is 7.10.1 — checked 2026-10-28. This recipe starts a new database, not an upgrade of an existing one. Before running the install commands, confirm that the client and adapter are both published at 7.10.1; otherwise select a published compatible set.

mkdir prisma-sqlite-demo
cd prisma-sqlite-demo
npm init -y
npm pkg set type=module
npm install --save-dev prisma@7.10.1 typescript tsx @types/node @types/better-sqlite3
npm install @prisma/client@7.10.1 @prisma/adapter-better-sqlite3@7.10.1
npx prisma init --datasource-provider sqlite --output ../generated/prisma

Create database-url.ts in the project root:

export const databaseUrl = new URL("./dev.db", import.meta.url).href;

Replace the generated prisma7.config.ts with this explicit local-file configuration; keep only this intended Prisma config:

import { defineConfig } from "prisma/config";
import { databaseUrl } from "./database-url";
console.log("CLI database URL:", databaseUrl);
export default defineConfig({
  schema: "prisma/schema.prisma",
  migrations: { path: "prisma/migrations" },
  datasource: { url: databaseUrl },
});

Set prisma/schema.prisma to:

generator client {
  provider = "prisma-client"
  output   = "../generated/prisma"
}
datasource db {
  provider = "sqlite"
}
model Note {
  id   Int    @id @default(autoincrement())
  text String
}

The generator documentation requires an output directory for prisma-client; import from that generated location.

Run from the project root:

npx prisma migrate dev --name init
npx prisma generate

Create script.ts in that root:

import { PrismaBetterSqlite3 } from "@prisma/adapter-better-sqlite3";
import { PrismaClient } from "./generated/prisma/client";
import { databaseUrl } from "./database-url";
console.log("Runtime database URL:", databaseUrl);
const adapter = new PrismaBetterSqlite3({ url: databaseUrl });
const prisma = new PrismaClient({ adapter });
try {
  await prisma.note.create({ data: { text: "SQLite is connected" } });
  const notes = await prisma.note.findMany();
  if (!notes.some(n => n.text === "SQLite is connected")) {
    throw new Error("Inserted note was not returned");
  }
  console.log(notes);
} finally {
  await prisma.$disconnect();
}
npx tsx script.ts

Success means the inserted note is printed and the process exits successfully. Compare the printed CLI and runtime URLs before relying on the setup. Each run intentionally inserts another note; this check does not establish persistence across processes. The SQLite quickstart documents the migration, generation and adapter flow. Preserve the generated migration and lockfile; exclude the development database from version control.

When this setup wins or loses

Option and purposeWins whenLoses whenPick this if
Local SQLite with better-sqlite3A Node process owns a local file for a prototype, small app or local toolThe deployment has ephemeral storage or many processes need shared writesYou control persistent local storage and can install the native driver
Hosted SQLite-compatible serviceYou explicitly need a remote managed databaseYou only need a disposable local file and would add unnecessary operationsThe deployment requires remote persistence; follow the provider's adapter guide instead

The Prisma SQLite connector distinguishes local, libSQL and D1 adapters. SQLite's deployment guidance explains its local-storage focus and one-writer-at-a-time constraint. Local SQLite needs no database-server subscription, but backups, durable storage and hosted alternatives have their own costs; no hosted price is implied — checked 2026-10-28.

Public user evidence

lostfictions, Prisma #23837, 2024-04-12: “passing an invalid database file path” can create an empty database. This older report motivates matching the CLI and application paths; it does not prove a defect in this stable recipe.

Recommendation by constraint

Solo and small teams can use this local recipe for a prototype or one-server app with durable storage. Enterprise teams should decide database ownership, backups and write concurrency before treating it as shared production storage.

Prompt for the agent

Set up a fresh Prisma SQLite project with the stable pinned packages above. Keep CLI and runtime file paths identical. Generate the client and create a note. Report the resolved database file and deployment storage assumptions.

Mistakes

Do not import a client from a different output directory. Do not omit the runtime adapter. Do not treat migrate dev as a production deployment command. A successful build does not show that the deployment keeps the file across restarts.

Limits

The installation and database round trip were not run. The native driver must work on the target platform. This is not a Bun, edge runtime, hosted SQLite or existing-database migration recipe.

Started from a post by @Prisma documentation, packaged by the editor. Original post

Subjects

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Prisma 7.10.1: set up a local SQLite database
Summary: As of October 2026, start a Node TypeScript project with stable Prisma 7.10.1, the SQLite provider and the better-sqlite3 adapter; use one explicit file URL for migrations and runtime. Generate the client after creating the schema with Prisma 7.10.1
Copy for agent
get the whatworks thread prisma-sqlite-stable-adapter-first-project and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread prisma-sqlite-stable-adapter-first-project
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp