TypeORM
By the TypeORM open-source community
TypeORM is an open-source Object-Relational Mapping (ORM) library for TypeScript and JavaScript that lets developers work with relational and some NoSQL databases using decorated classes instead of raw SQL.
Definition
TypeORM is an open-source Object-Relational Mapping (ORM) library for TypeScript and JavaScript that lets developers work with relational and some NoSQL databases using decorated classes instead of raw SQL.
Overview
TypeORM brings a class-based, decorator-driven modeling style to Node.js and TypeScript applications, similar in spirit to Hibernate in the Java world or Entity Framework in .NET. Developers define entities as TypeScript classes annotated with decorators like `@Entity`, `@Column`, and `@ManyToOne`, and TypeORM generates the corresponding tables and SQL queries, supporting both the Active Record pattern (methods live on the entity) and the Data Mapper pattern (separate repository classes) depending on team preference. It supports migrations, either hand-written or generated from entity diffs, that can be run through its CLI to evolve schema safely rather than relying on `synchronize: true` auto-sync — a convenience feature intended for development only, since it can silently apply destructive changes in production. TypeORM works across PostgreSQL, MySQL, SQLite, Microsoft SQL Server, Oracle, and MongoDB, making it a flexible default choice in Express.js and NestJS backends. Within the JavaScript ecosystem, TypeORM competes with alternatives such as Sequelize (JavaScript-first, less TypeScript-native) and newer entrants like Prisma and Drizzle ORM, which favor a more type-safe, query-builder-centric API over decorators. TypeORM's decorator approach tends to feel most familiar to developers coming from strongly object-oriented backgrounds, while its query builder still allows dropping down to close-to-SQL control when needed.
Key Features
- Decorator-based entity definitions (@Entity, @Column, @OneToMany, etc.)
- Supports both Active Record and Data Mapper (repository) patterns
- Migration generation and CLI for versioned schema changes
- Query builder for complex queries beyond basic repository methods
- Relations, eager/lazy loading, cascading, and transactions
- Multi-database support including PostgreSQL, MySQL, SQLite, and MongoDB
- Deep integration with NestJS and other Node.js frameworks
- Connection pooling and caching options for performance tuning