
TypeORM
A TypeScript/JavaScript library that maps database tables to code objects for Node.js apps.
- Stars
- 36.7k
- Forks
- 6.7k
- Licence
- MIT
- Language
- TypeScript
- Last update
- 8 days ago
- Type
- Library
What it is
TypeORM is an ORM (object-relational mapper), a library that lets you work with database tables as classes and objects in TypeScript or JavaScript instead of writing raw SQL for every operation. It supports several databases, including PostgreSQL, MySQL, MariaDB, SQLite, SQL Server, and Oracle, and the README also lists MongoDB. It supports both the Active Record and Data Mapper styles.
- Define entities as classes with decorators and let TypeORM create the matching tables
- Save, find, and remove records through a repository object
- Build complex queries with the QueryBuilder, including joins and pagination
- Generate and run database migrations as the schema changes
Great for
- Node.js or TypeScript developers building apps backed by a relational database
- Teams that want one data layer that can switch between several database types
- Developers who want to choose between Active Record and Data Mapper styles
- Projects that need migrations, relations, and transactions handled by a library
Not ideal for
- People who prefer writing raw SQL directly, since TypeORM adds an abstraction layer to learn
- Non-JavaScript projects, because the library is written for TypeScript and JavaScript runtimes
- Beginners with no database background, who should learn basic SQL concepts first
How to get it
- 1
Install with a package manager
You'll need: Node.js · TypeScript or JavaScript project · A supported database such as PostgreSQL, MySQL, or SQLite
Clone the repository
git clone https://github.com/typeorm/typeorm - 2
Run it
- Install the typeorm package in a Node.js project using your package manager
- Define an entity class using the @Entity and @Column decorators
- Create a data source pointing to your database
- Use a repository to save and query records
- 3
Get the most out of it
- Use the QueryBuilder for complex queries involving joins and pagination
- Use migrations to manage schema changes over time
- Try the listed extensions, such as typeorm-model-generator for generating models from an existing database
- Start from the official example repositories for Express, Electron, or React Native
Downloads
Strengths
- Supports many databases with one API, according to the README
- Offers both Active Record and Data Mapper patterns
- Has a large community, with about 36,600 GitHub stars and an MIT license
Trade-offs
- The README is truncated, so detailed behavior and version compatibility are not fully covered here
- Supporting many databases and patterns adds size and complexity to learn
- Large projects may need careful configuration of migrations and multiple data sources
How it compares
| Project | Stars | Type | Level | Updated | Best for |
|---|---|---|---|---|---|
| typeorm (this) | 36.7k | Library | intermediate | 8 days ago | Node.js or TypeScript developers building apps backed by a relational database |
| sequelize | 30.3k | Library | intermediate | 5 days ago | Node.js backend developers who use a relational SQL database |
| kysely | 14.3k | Library | intermediate | 4 days ago | TypeScript developers who want SQL control without losing compile-time type checks |
| sqlc | 18.4k | Dev tool | intermediate | 4 days ago | Go developers who prefer writing plain SQL over using an ORM |
| usql | 10.2k | CLI | beginner | 4 days ago | Developers who use several different databases and want one tool for all of them |
| knex | 20.3k | Library | intermediate | 4 months ago | Node.js developers who need to talk to a SQL database from application code |
Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.