Web Dev Academy Databases · Prisma & Drizzle Tool 48 / 64
Databases

Prisma & Drizzle

Type-safe query builders for TypeScript. Instead of writing raw SQL strings, you call typed methods — your editor autocompletes columns and the compiler catches mistakes before they hit the database.

Demo 01

Build a query with your mouseSimulation

Pick a model, choose fields, add a filter — and watch a real-looking Prisma or Drizzle query assemble itself, then return typed results from a seeded dataset. This is exactly the shape of code these tools generate.


      
✓ Return type inferred automatically
Demo 02

Autocomplete is the superpowerConcept

Because the schema is described in TypeScript, your editor knows every column and its type. Type a dot and it suggests valid fields — misspell one and it won't compile. No more guessing column names from memory.

user.

Switching user for order in Demo 1 changes the available fields — the builder only ever offers columns that actually exist, just like real autocomplete.

Demo 03

Prisma vs Drizzle — two philosophies

Both give you type safety; they differ in style. Prisma uses its own schema file and a generated client (higher-level, batteries-included). Drizzle stays close to SQL with a thin, SQL-like builder (lighter, more explicit).

Prisma

  • • Own schema.prisma file
  • • Generated client + migrations
  • • Reads like an object graph
  • • Great DX, slightly heavier

Drizzle

  • • Schema is plain TypeScript
  • • SQL-like, minimal abstraction
  • • Tiny, fast, edge-friendly
  • • You stay close to the SQL
Demo 04

What "type-safe" actually saves you

A raw SQL string is opaque to the compiler — a typo in a column name only fails at runtime, in production. A typed query builder turns that into a red squiggle in your editor, today.

// ❌ Raw string — typo found only when it runs
db.query("SELECT nmae FROM users")   // 💥 at runtime

// ✓ Typed — compiler stops you immediately
db.select({ name: users.nmae })           // 🔴 Property 'nmae' does not exist
i
The query builder is an interactive JavaScript simulation. Real Prisma and Drizzle are TypeScript libraries that run in Node.js against a real database and rely on the TypeScript compiler for their type safety — none of which exists in a browser tab. So this page assembles the query strings and returns rows from a seeded in-page dataset to faithfully mimic the real experience; the "typed results" and autocomplete menu are illustrations of what your editor and the compiler give you, not a live type-checker. The shared CSS shell provides the page styling.

↑ All 64 tools