TypeORM maps objects to relational and document databases from Node.js, browsers, and mobile shells. It supports TypeScript and JavaScript with both Data Mapper and Active Record styles.
Overview
TypeORM is an object-relational mapper aimed at applications that use databases from small schemas to multi-database enterprise setups. It runs in Node.js and also in browser, Cordova, Ionic, React Native, NativeScript, Expo, and Electron environments.
The library advertises support for many engines, including PostgreSQL, MySQL and MariaDB, SQLite, Microsoft SQL Server, Oracle, MongoDB, Google Spanner, SAP HANA, CockroachDB, and related drivers. You can choose Data Mapper or Active Record patterns when modeling entities and writing domain logic.
Feature areas include entities and columns, associations with eager and lazy loading, transactions, migrations with auto-generation, connection pooling, replication, multiple database instances, and a QueryBuilder for joins and pagination. Hooks, listeners, subscribers, caching, and streaming raw results are also part of the surface.
Schema can be declared in models or separate configuration files. The project ships a CLI and supports both ESM and CommonJS module formats for generated code.
Key features
- Data Mapper and Active Record patterns
- Broad SQL and MongoDB support
- Migrations and schema management
- QueryBuilder with joins and pagination
- Relations, cascades, and transactions
- Connection pooling and replication
- TypeScript-first entity definitions
- Command-line tooling
Use cases
- Node.js APIs backed by SQL databases
- Cross-platform apps sharing one ORM layer
- Projects needing migration workflows
- Teams preferring decorator-based entities
- Applications spanning multiple database types