Prisma 8 extension
SQLite
SQLite support for Prisma ORM: config, runtime, contract authoring, and migrations in one package.
By PrismaExperimentalSQLite
What it does
The one package a SQLite application installs. It wires the SQL family, the SQLite target, adapter, and driver into defineConfig and the sqlite() runtime, which opens the database file at the path you pass. Same contract, query builder, and migration model as PostgreSQL, so a project can start on a local file and move later.
Configure the database
prisma.config.ts
import { definePrismaConfig } from 'prisma/config';
import { defineConfig as ormConfig } from '@prisma/orm-sqlite/config';
export default definePrismaConfig({
orm: ormConfig({
contract: './src/prisma/contract.prisma',
db: {
connection: './app.db',
},
}),
});Create the client
src/prisma/db.ts
import sqlite from '@prisma/orm-sqlite/runtime';
import type { Contract } from './contract.d';
import contractJson from './contract.json' with { type: 'json' };
export const db = sqlite<Contract>({
contractJson,
path: './app.db',
});