TypeORM is a Data-Mapper ORM for TypeScript and JavaScript, supporting both Active Record and Data Mapper patterns. The latest stable version is 0.2.19, with active development and a regular release cadence. It supports multiple databases (MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, CockroachDB, sql.js, and MongoDB via MongoDB driver) and platforms (Node.js, Browser, Cordova, React Native, etc.). Key differentiators include full TypeScript support, decorator-based entity definitions, automatic migrations, eager/lazy relations, and cross-database queries. Compared to alternatives like Sequelize or Prisma, TypeORM offers a closer resemblance to traditional ORMs like Hibernate and provides more flexibility in choosing between Active Record and Data Mapper patterns.
npm install innomize-typeormNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates an in-memory SQLite database, defines a User entity, and performs basic CRUD operations using the Data Mapper pattern.
Use new DataSource() and initialize() instead of createConnection(). Use AppDataSource.getRepository() instead of getConnection().getRepository().
Enable 'experimentalDecorators' and 'emitDecoratorMetadata' in tsconfig.json.
Install the required database driver: npm install mongodb for MongoDB, or mysql2 for MySQL.
Add subscribers and migrations as arrays in the DataSource options object.
Run 'npm install reflect-metadata' and add 'import "reflect-metadata"' at the top of your main file.
Run 'npm install typeorm'. Ensure tsconfig.json includes 'node_modules/@types' in typeRoots.
Add the entity to entities array in DataSource/Connection options and ensure the class has @Entity() decorator.
Install the appropriate driver: npm install mysql2 for MySQL, pg for PostgreSQL, sqlite3 for SQLite.