TypeORM

typeorm.io

Feature-rich ORM for TypeScript and JavaScript supporting SQL databases and migrations.

Overview

TypeORM is an Object-Relational Mapping (ORM) library built from the ground up with TypeScript support, providing complete type safety for database models. It supports both DataMapper and ActiveRecord patterns, giving developers flexibility in how they structure their applications.

The library works across multiple platforms including Node.js, browsers, mobile (React Native, Ionic, Cordova), and desktop (Electron), and supports a wide range of databases: PostgreSQL, MySQL, MariaDB, SQLite, MS SQL Server, Oracle, MongoDB, Google Spanner, SAP HANA, and CockroachDB. TypeORM provides a powerful QueryBuilder for complex queries, automatic migration generation, and an elegant, type-safe API for database interactions.

Key features

  • DataMapper and ActiveRecord pattern support
  • TypeScript-first with full type safety
  • Multi-database support (8+ databases)
  • Powerful QueryBuilder with joins and pagination
  • Automatic migration generation
  • Cross-platform compatibility
  • Entity relationships and cascades
  • Query caching and logging
  • Connection pooling and replication
Pros
  • Excellent TypeScript support with decorators
  • Supports more databases than competing JS/TS ORMs
  • Works on multiple platforms (Node, browser, mobile, desktop)
  • Flexible pattern choice (DataMapper or ActiveRecord)
  • Automatic migration generation
  • Comprehensive feature set for enterprise applications
Cons
  • Requires TypeScript configuration (decorators and metadata)
  • Steeper learning curve compared to simpler query builders
  • Additional dependencies needed (reflect-metadata)
  • May be overkill for simple CRUD applications
Use this if
You need a type-safe ORM with broad database support, are building TypeScript applications, or require flexibility between DataMapper and ActiveRecord patterns.
Skip this if
You prefer lightweight query builders, need minimal dependencies, or are building simple applications that don't require a full ORM.

Best for

TypeScript projects requiring type-safe database accessApplications needing multi-database supportBuilding scalable enterprise applicationsCross-platform applications (Node.js, mobile, desktop)Projects using either DataMapper or ActiveRecord patterns

Alternatives

PrismaSequelizeKnex.jsMikroORMDrizzle ORM

Compare TypeORM alternatives

More Library

Compare all
View React Query
React Query

Data-fetching and state management library designed to handle server state in web applications.

View dotenv
dotenv

Zero-dependency module loading environment variables from .env files into Node.js apps.

View Solidjs
Solidjs

JavaScript library designed for building user interfaces with a focus on declarative syntax and efficiency.

View UnoCSS
UnoCSS

Instant on-demand atomic CSS engine — flexible, fast alternative to Tailwind.