Drizzle foundations

Create the notes project

Set up a small TypeScript project with the current Drizzle 1.0 packages, Node SQLite, environment loading, and a repeatable command.

8 minute lesson

~~~

Let’s get a real database running first. We will use Node’s built-in SQLite driver, so there is no database server to install.

The current Drizzle 1.0 documentation may publish packages under the rc tag until the stable release. Use the versions shown in the official getting-started page and keep drizzle-orm and drizzle-kit on the same release line.

mkdir drizzle-notes
cd drizzle-notes
npm init -y
npm i drizzle-orm@rc dotenv
npm i -D drizzle-kit@rc tsx typescript @types/node

Create src/db, then add DB_FILE_NAME=notes.sqlite to .env. Keep the database file and .env out of Git. We will commit the schema and migrations instead, because those files describe how another developer can recreate the database.

If Drizzle 1.0 is stable when you take this course, the official page may omit @rc. Follow the current install command rather than forcing an old tag from a screenshot or tutorial.

Install the packages and save the exact versions from npm ls drizzle-orm drizzle-kit. Add a deliberate TypeScript error to your entry file and prove the project catches it before continuing.

Lesson completed

Take this course offline

Get every free book and course as PDF and EPUB files.

Get the download library →