typeorm /typeorm
TypeScript & JavaScript ORM for Node.js — supports PostgreSQL, MySQL, MariaDB, SQLite, SQL Server, Oracle, and more.
★ 36,672⑂ 6,695👁 335⑃ 4,283● 8,707▤ 48
-1
日增长
+0
周增长
36,672
stars
6,695
forks
335
watchers
4,283
prs
8,707
issues
48
releases
README
TypeORM is an ORM that can run in Node.js, Browser, Cordova, Ionic, React Native, NativeScript, Expo, and Electron platforms and can be used with TypeScript and JavaScript (ES2023). Its goal is to always support the latest JavaScript features and provide additional features that help you to develop any kind of application that uses databases - from small applications with a few tables to large-scale enterprise applications with multiple databases.
TypeORM supports more databases than any other JS/TS ORM: Google Spanner, Microsoft SqlServer, MySQL/MariaDB, MongoDB, Oracle, Postgres, SAP HANA and SQLite, as well as derived databases and different drivers.
TypeORM supports both Active Record and Data Mapper patterns, unlike all other JavaScript ORMs currently in existence, which means you can write high-quality, loosely coupled, scalable, maintainable applications in the most productive way.
TypeORM is highly influenced by other ORMs, such as Hibernate,
Doctrine and Entity Framework.
Features
- Supports both DataMapper and ActiveRecord (your choice).
- Entities and columns.
- Database-specific column types.
- Entity manager.
- Repositories and custom repositories.
- Clean object-relational model.
- Associations (relations).
- Eager and lazy relations.
- Unidirectional, bidirectional, and self-referenced relations.
- Supports multiple inheritance patterns.
- Cascades.
- Indices.
- Transactions.
- Migrations and automatic migrations generation.
- Connection pooling.
- Replication.
- Using multiple database instances.
- Working with multiple database types.
- Cross-database and cross-schema queries.
- Elegant-syntax, flexible and powerful QueryBuilder.
- Left and inner joins.
- Proper pagination for queries using joins.
- Query caching.
- Streaming raw results.
- Logging.
- Listeners and subscribers (hooks).
- Supports closure table pattern.
- Schema declaration in models or separate configuration files.
- Supports MySQL / MariaDB / Postgres / CockroachDB / SQLite / Microsoft SQL Server / Oracle / SAP Hana / sql.js.
- Supports MongoDB NoSQL database.
- Works in Node.js / Browser / Ionic / Cordova / React Native / NativeScript / Expo / Electron platforms.
- TypeScript and JavaScript support.
- ESM and CommonJS support.
- Produced code is performant, flexible, clean, and maintainable.
- Follows all possible best practices.
- CLI.
And more...
With TypeORM, your models look like this:
typescript
import { Entity, PrimaryGeneratedColumn, Column } from "typeorm"
@Entity()
export class User {
@PrimaryGeneratedColumn()
id: number
@Column()
firstName: string
@Column()
lastName: string
@Column()
age: number
}
And your domain logic looks like this:
typescript
const userRepository = MyDataSource.getRepository(User)
const user = new User()
user.firstName = "Timber"
user.lastName = "Saw"
user.age = 25
await userRepository.save(user)
const allUsers = await userRepository.find()
const firstUser = await userRepository.fiTop issues
#3857Performance of query with many `relations`102 comments · 2019-03-20#3357Migration generation drops and creates columns instead of altering resulting in data loss96 comments · 2019-01-03#296select additional computed columns61 comments · 2017-02-18#5694findOne with relations does two queries.50 comments · 2020-03-16#1601Support for scopes/global filters49 comments · 2018-02-16#541Allow to order columns47 comments · 2017-06-14#3095Using .save for one-to-many relationship always tries to insert instead of update.41 comments · 2018-11-11#2215Inserting id (primary column) from code.40 comments · 2018-05-25
Discussions
#13064Open-source verification stack for AI-assisted TypeORM & TypeScript apps (92-rule security scanner, headless Playwright QA & 72-rule UI linter)0 comments · 2026-11-14#13016It is so anoying timestamp to order migrations files.1 comments · 2026-10-28#12998why use NEWSEQUENTIALID() rather than NEWID() in sqlserver?1 comments · 2026-10-23#12799Unit-test gaps in OrmUtils boundaries, ConnectionOptionsReader, and the codemod CLI1 comments · 2026-08-24#12794v1 removed the CustomRepository* error classes — agents still catch them0 comments · 2026-08-20#12736Thank you maintainers! + Holu framework integration0 comments · 2026-07-25#12733Typeorm cannot run playwright test12 comments · 2026-07-24#12537ActiveRecord and transactions1 comments · 2026-05-23
Latest release
1.1.3 1.1.3 2026-11-12What's Changed fix: release SQL Server query locks after subscriber errors by @IbrahimHafez1 in https://github.com/typeorm/typeorm/pull/12939 ci: unblock releases and skip the sonar scan on dependabot pull requests by @michaelbromley in https://github.com/typeorm/typeorm/pull/12948 chore(deps): bump SonarSource/sonarqube-scan-action from 8.2.2 to 8.3.0 in the github-actions-third-party group across 1 directory by @dependabot[bot] in https://github.com/typeorm/typeorm/pull/12947 fix(mssql): place table lock hint inside nested join parentheses by @lazerg in https://github.com/typeorm/typ