Databases in Node

SQL or NoSQL — and How to Pick

Databases in Node

Survey of the database landscape from a Node perspective.

3 min read Level 1/5 #nodejs#database#sql
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

FamilyExamplesPick when
Relational (SQL)PostgreSQL, MySQL, SQLiteYou have structured data with relationships (users → posts → comments)
Document (NoSQL)MongoDB, DynamoDB, FirestoreFlexible schema, fast iteration, denormalized reads
Key-valueRedisCache, sessions, queues, ephemeral state
SpecializedElasticSearch (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

ApproachExamplePitch
Raw driverpg, mysql2, mongodbClosest to the DB, no magic
Query builderkysely, knexComposable SQL, typed
Lightweight ORMdrizzleMostly SQL + TS types
Full ORMprisma, typeormSchema-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 →