{"id":42870,"library":"innomize-typeorm","title":"TypeORM","description":"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.","status":"active","version":"0.2.19","language":"javascript","source_language":"en","source_url":"https://github.com/typeorm/typeorm","tags":["javascript"],"install":[{"cmd":"npm install innomize-typeorm","lang":"bash","label":"npm"},{"cmd":"yarn add innomize-typeorm","lang":"bash","label":"yarn"},{"cmd":"pnpm add innomize-typeorm","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required for decorator metadata reflection used by @Entity, @Column, etc.","package":"reflect-metadata","optional":false},{"reason":"Required when using AWS Aurora Serverless Data API","package":"typeorm-aurora-data-api-driver","optional":true}],"imports":[{"note":"Use named import for decorators; incorrect require usage may cause issues with decorators.","wrong":"const Entity = require('typeorm').Entity","symbol":"Entity","correct":"import { Entity } from 'typeorm'"},{"note":"Must be a named import, not default.","wrong":"import PrimaryGeneratedColumn from 'typeorm'","symbol":"PrimaryGeneratedColumn","correct":"import { PrimaryGeneratedColumn } from 'typeorm'"},{"note":"Named import required.","wrong":"import Column from 'typeorm'","symbol":"Column","correct":"import { Column } from 'typeorm'"},{"note":"Named import for functions.","wrong":"import getConnection from 'typeorm'","symbol":"getConnection","correct":"import { getConnection } from 'typeorm'"},{"note":"In browser context, use { createConnection } from 'typeorm' still works; separate browser entry points are deprecated.","wrong":"import { createConnection } from 'typeorm/browser'","symbol":"createConnection","correct":"import { createConnection } from 'typeorm'"}],"quickstart":{"code":"import { createConnection, Entity, PrimaryGeneratedColumn, Column, getConnection } from 'typeorm';\n\n@Entity()\nclass User {\n    @PrimaryGeneratedColumn()\n    id: number;\n\n    @Column()\n    firstName: string;\n\n    @Column()\n    lastName: string;\n}\n\nasync function main() {\n    const connection = await createConnection({\n        type: 'sqlite',\n        database: ':memory:',\n        entities: [User],\n        synchronize: true,\n        logging: false,\n    });\n\n    const user = new User();\n    user.firstName = 'John';\n    user.lastName = 'Doe';\n\n    const repository = connection.getRepository(User);\n    await repository.save(user);\n\n    const users = await repository.find();\n    console.log(users);\n\n    await connection.close();\n}\n\nmain().catch(err => console.error(err));","lang":"typescript","description":"Creates an in-memory SQLite database, defines a User entity, and performs basic CRUD operations using the Data Mapper pattern."},"warnings":[{"fix":"Use new DataSource() and initialize() instead of createConnection(). Use AppDataSource.getRepository() instead of getConnection().getRepository().","message":"TypeORM 0.3.x changed the connection API: createConnection() returns a DataSource, and getConnection() is removed.","severity":"breaking","affected_versions":">=0.3.0"},{"fix":"Enable 'experimentalDecorators' and 'emitDecoratorMetadata' in tsconfig.json.","message":"Decorators like @Entity and @Column are experimental and require TypeScript's experimentalDecorators setting.","severity":"deprecated","affected_versions":"*"},{"fix":"Install the required database driver: npm install mongodb for MongoDB, or mysql2 for MySQL.","message":"Some drivers (e.g., MongoDB) require additional package like 'mongodb' as a peer dependency.","severity":"gotcha","affected_versions":"*"},{"fix":"Add subscribers and migrations as arrays in the DataSource options object.","message":"In version 0.3.0, the way to register subscribers and migrations changed; they must be added to DataSource options.","severity":"breaking","affected_versions":">=0.3.0"}],"env_vars":null,"search_vec":"'0.2.19':26 'activ':15,28,106 'altern':84 'automat':73 'base':70 'browser':57 'cadenc':34 'choos':104 'closer':92 'cockroachdb':47 'compar':82 'cordova':58 'cross':79 'cross-databas':78 'data':6,18,109 'data-mapp':5 'databas':38,80 'decor':69 'decorator-bas':68 'definit':72 'develop':29 'differenti':63 'driver':53 'eager/lazy':75 'entiti':71 'etc':61 'flexibl':102 'full':65 'hibern':98 'includ':64 'javascript':12,112 'key':62 'latest':22 'like':85,97 'mapper':7,19,110 'mariadb':41 'migrat':74 'mongodb':50,52 'ms':43 'multipl':37 'mysql':39 'nativ':60 'node.js':56 'offer':90 'oracl':46 'orm':8,96 'pattern':20,111 'platform':55 'postgresql':40 'prisma':88 'provid':100 'queri':81 'react':59 'record':16,107 'regular':32 'relat':76 'releas':33 'resembl':93 'sequel':86 'server':45 'sql':44 'sql.js':48 'sqlite':42 'stabl':23 'support':13,36,67 'tradit':95 'typeorm':1,2,89 'typescript':10,66 'version':24 'via':51","created_at":"2026-06-05T16:57:04.278615+00:00","updated_at":"2026-06-05T16:57:04.278615+00:00","problems":[{"fix":"Run 'npm install reflect-metadata' and add 'import \"reflect-metadata\"' at the top of your main file.","cause":"reflect-metadata is not installed or imported at the top of the entry file.","error":"Missing required dependency: reflect-metadata. Please install it."},{"fix":"Run 'npm install typeorm'. Ensure tsconfig.json includes 'node_modules/@types' in typeRoots.","cause":"TypeORM is not installed or TypeScript cannot find type definitions.","error":"Cannot find module 'typeorm' or its corresponding type declarations."},{"fix":"Add the entity to entities array in DataSource/Connection options and ensure the class has @Entity() decorator.","cause":"Entity class is not registered in DataSource options or missing @Entity() decorator.","error":"Entity metadata for entity '' was not found. Check if you specified correct entity classes."},{"fix":"Install the appropriate driver: npm install mysql2 for MySQL, pg for PostgreSQL, sqlite3 for SQLite.","cause":"Database driver package is missing.","error":"Driver not found. Please install the correct database driver: mysql2, pg, sqlite3, etc."}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/typeorm/typeorm#readme","github":"https://github.com/typeorm/typeorm","docs":null,"changelog":null,"pypi":null,"npm":"innomize-typeorm","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-05","next_check":"2026-09-03","install_tag":null}}