TypeORM is an ORM for TypeScript and JavaScript (ES5+) that supports both Active Record and Data Mapper patterns. It runs in Node.js, browsers, Cordova, Ionic, React Native, and Electron, and works with MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, SAP Hana, sql.js, and MongoDB. Current stable version is 0.2.x (actively maintained, with frequent releases and a migration to 0.3.x in progress). Key differentiators: supports multiple databases simultaneously, CLIs for migrations and entities, and a rich decorator-based entity definition. Heavily influenced by Hibernate and Doctrine.
npm install typeorm-with-better-sqlite3No compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
This example creates a SQLite database, defines a User entity, saves a record, and retrieves all users using TypeORM's Data Mapper pattern.
Use new DataSource({...}) and call .initialize() instead of createConnection.Access repositories via DataSource instance: dataSource.getRepository(Entity).
Add 'import 'reflect-metadata';' at the very top of your main file.
Set "experimentalDecorators": true and "emitDecoratorMetadata": true in compilerOptions.
Check for null instead of undefined when no entity is found.
Set logging: ['query', 'error'] or use a logging object.
Use 'sqlite' as the type (not 'sqlite3' or 'SQLite').
Add the entity to the entities array in the connection or DataSource config: entities: [User] or entities: ['dist/**/*.entity.js'].
Configure TypeScript to emit CommonJS modules (module: 'commonjs' in tsconfig.json) or use a bundler.
Run 'npm install typeorm' and verify the import path is correct (e.g., 'typeorm').
Install the appropriate driver: 'npm install sql.js' or 'npm install better-sqlite3'.