Drizzle foundations
Choose Drizzle with open eyes
Understand what an ORM gives you, what Drizzle deliberately leaves visible, and when plain SQL may still be the better tool.
8 minute lesson
An ORM connects application objects and database rows. The dangerous promise is that you can stop thinking about SQL. You cannot.
Drizzle takes a smaller approach. You define the schema in TypeScript and build typed queries with familiar SQL operations. The database still owns constraints, transactions, indexes, and query plans. That is a feature: when a query becomes slow or wrong, you can reason about the SQL underneath it.
For this course we will build a small notes database with users and notes. SQLite keeps the setup local, while the Drizzle concepts transfer to PostgreSQL, MySQL, D1, and other supported drivers.
My advice is to use Drizzle when you want TypeScript help without hiding the database. Use plain SQL when the query is clearer that way. Drizzle includes an sql template for those cases, so this is not an all-or-nothing choice.
Write down one table and three queries from an application you know. For each query, name what TypeScript can verify and what only the database or a real test can verify.
Lesson completed