Data
ORMs & Type-Safe Query Builders
Choose how application code accesses a database by abstraction depth, query control, schema ownership, migrations, and runtime constraints.
Recommendation
Choose the abstraction boundary before the library.
Four data-access boundaries
More abstraction is useful only when its generated workflow and model ownership fit the queries and deployment environment.
Tool routes
Select the smallest abstraction that makes the team more effective without hiding required database behavior.
You want a guided schema and generated client
Evaluate Prisma ORM.
A declarative schema, generated TypeScript client, and integrated migration workflow can standardize a product team's data layer.
Verify: Complex database-specific SQL, unsupported runtime behavior, or a need for a smaller abstraction surface should move the choice.12
You want typing while staying close to SQL
Evaluate Drizzle ORM.
SQL-like APIs and TypeScript schema definitions suit teams comfortable owning database details.
Verify: Teams needing a more guided generated-client workflow must validate whether the lighter abstraction supplies enough structure.12
You want a thin typed query builder
Evaluate Kysely.
Compile-time query typing with a small surface preserves database-aware SQL control.
Verify: Do not expect it to own entity mapping, relations, schema generation, or an end-to-end migration workflow.123
The codebase is entity-oriented
Evaluate TypeORM.
Class-based entities and repository or data-mapper patterns can fit established Node.js architectures.
Verify: Runtime metadata, relation loading, migrations, complex queries, and abstraction leakage require explicit review.124
Boundary: Raw SQL and direct drivers remain legitimate when query control and database-specific behavior dominate. This Task does not choose the database engine or provider.
What the abstraction owns
Compile-time types alone do not guarantee valid runtime data, efficient SQL, or safe migrations.
- Schema authority
- The database, a declarative model, or TypeScript definitions can each become the practical source of truth.12
- Migration workflow
- Generation, drift, review, rollback, and production deployment differ across ecosystems.12
- Runtime fit
- Drivers, connection pooling, generated binaries, bundling, and edge support can disqualify an otherwise attractive API.12
- Exit cost
- The more application code depends on a library's schema and query model, the larger a later migration becomes.3
Official resources
Use the primary documentation to validate product boundaries, operating behavior, limits, and current commercial terms.
Related tools
Related tasks
Sources
Official documentation supporting the decision routes and their boundaries.
- 1Prisma ORM documentation
Prisma · Accessed Official
- 2Drizzle ORM overview
Drizzle Team · Accessed Official
- 3Kysely documentation
Kysely · Accessed Official
- 4TypeORM getting started
TypeORM · Accessed Official