SQL or NoSQL — and How to Pick
Databases in Node
Survey of the database landscape from a Node perspective.
What you'll learn
- Know the major DB options
- Place ORMs vs raw drivers
- Choose for a typical app
Most Node apps persist data somewhere. Here’s the landscape.
The Big Choice — SQL vs NoSQL
| Family | Examples | Pick when |
|---|---|---|
| Relational (SQL) | PostgreSQL, MySQL, SQLite | You have structured data with relationships (users → posts → comments) |
| Document (NoSQL) | MongoDB, DynamoDB, Firestore | Flexible schema, fast iteration, denormalized reads |
| Key-value | Redis | Cache, sessions, queues, ephemeral state |
| Specialized | ElasticSearch (search), ClickHouse (analytics), Vector DBs (AI) | When the workload calls for it |
For most web apps: Postgres is the safe default. SQLite for single-server apps and prototypes.
Driver vs ORM
| Approach | Example | Pitch |
|---|---|---|
| Raw driver | pg, mysql2, mongodb | Closest to the DB, no magic |
| Query builder | kysely, knex | Composable SQL, typed |
| Lightweight ORM | drizzle | Mostly SQL + TS types |
| Full ORM | prisma, typeorm | Schema-first, migrations, very high-level |
For Node + TypeScript in 2026, Drizzle or Prisma are the two most popular. Both first-class TS, both come with migrations.
What You’ll Use This Chapter
Next lesson: SQLite — zero-setup, perfect for learning. Then Postgres. Then ORMs. Then Redis. Then a survey of Mongo, file uploads, queues, and migrations.
SQLite →