Why Drizzle?

When your app talks to a database, it uses a language called SQL — structured queries like SELECT * FROM users WHERE id = 1. SQL works, but writing it by hand inside your JavaScript code is awkward. You lose autocomplete, you get no type checking, and a typo in a column name only shows up when your app crashes.

An ORM (Object-Relational Mapper) sits between your code and the database. Instead of writing raw SQL strings, you write JavaScript — and the ORM translates it into SQL for you.

?Why SQLite?

What Drizzle gives you

Drizzle is a TypeScript-first ORM. That means your editor knows your database structure and can help you write correct queries:

// Instead of: "SELECT * FROM forms WHERE id = ?"
const form = await db.query.forms.findFirst({
  where: eq(forms.id, formId),
})

If you rename a column in your schema, every query that references it lights up with an error — before your app ever runs. That's the kind of safety net that saves hours of debugging.

Schema as code

With Drizzle, your database structure is defined in regular TypeScript files. A table looks like this:

export const forms = sqliteTable('forms', {
  id: integer().primaryKey({ autoIncrement: true }),
  title: text().notNull(),
})

This file is your source of truth. When you change it, Drizzle generates a migration — a small SQL script that updates your database to match. No manual SQL writing, no guessing what changed.

Why not Prisma?

Prisma is the other popular ORM in the Node.js world. It's a good tool, but there are trade-offs:

Schema language. Prisma uses its own .prisma file format instead of TypeScript. That's one more language your AI has to context-switch between. Drizzle schemas are just TypeScript — same language as the rest of your app.

SQL-shaped queries. Drizzle's query API closely mirrors how SQL actually works. If you ever need to read the generated SQL or write something custom, the mental model carries over. Prisma's API is more abstracted — convenient until you need something it doesn't support, then you're writing raw SQL anyway.

Lightweight. Drizzle has no code generation step and no separate engine process. Prisma runs a Rust-based query engine as a sidecar — one more thing to install, debug, and deploy. Drizzle is just a library you import.

AI writes it well

Because Drizzle schemas and queries are plain TypeScript, AI tools handle them reliably. There's no special file format to get wrong, no generated client to keep in sync. Your AI reads the schema, understands the structure, and writes queries that match — the same way it would write any other TypeScript code.