A TypeORM driver for InterSystems IRIS database, providing seamless integration between TypeORM and IRIS databases.
This driver enables you to use TypeORM with InterSystems IRIS databases, supporting both traditional SQL operations and IRIS-specific features. It includes connection pooling for high-performance applications.
npm install typeorm-irisimport{IRISDataSource,IRISConnectionOptions}from"typeorm-iris"constdataSourceOptions: IRISConnectionOptions={name: "iris",type: "iris",host: "localhost",port: 1972,username: "_SYSTEM",password: "SYS",namespace: "USER",logging: true,dropSchema: true,}exportfunctioncreateDataSource(options: any): IRISDataSource{// @ts-ignoreconstdataSource=newIRISDataSource({ ...dataSourceOptions, ...options})returndataSource}import{Column,Entity}from"typeorm"import{PrimaryColumn}from"typeorm"import{Generated}from"typeorm"
@Entity("sample01_post")exportclassPost{
@PrimaryColumn()
@Generated()id: number
@Column()title: string
@Column()text: string
@Column({nullable: false})likesCount: number}import"reflect-metadata"import{Post}from"./entity/Post"import{createDataSource}from"../datasource"asyncfunctionmain(){constdataSource=createDataSource({logging: true,synchronize: true,entities: [Postasany],})try{awaitdataSource.initialize()}catch(error){console.log("Cannot connect: ",error)return}constpost=newPost()post.text="Hello how are you?"post.title="hello"post.likesCount=100constpostRepository=dataSource.getRepository(Post)try{awaitpostRepository.save(post)console.log("Post has been saved: ",post)}catch(error){console.log("Cannot save. Error: ",error)}awaitdataSource.destroy()}voidmain()interfaceIRISConnectionOptions{type: "iris"host?: stringport?: numberusername?: stringpassword?: stringnamespace?: stringsharedmemory?: boolean// Default: false (required for 2025.2+)poolSize?: number// Default: 5connectTimeout?: number// Default: 10 secondsentities?: EntitySchema[]// Entity definitionssynchronize?: boolean// Auto-create tableslogging?: boolean// Enable query logging}The driver includes built-in connection pooling to prevent memory leaks:
import{IRISConnectionPool}from"typeorm-iris"constpool=newIRISConnectionPool({host: "localhost",port: 1972,ns: "USER",user: "_SYSTEM",pwd: "SYS",sharedmemory: false,},5,)// Max 5 connections// Get connection from poolconstconnection=awaitpool.getConnection()try{// Use connectionconstiris=connection.createIris()// ... database operations}finally{// Always release connection back to poolpool.releaseConnection(connection)}// Clean shutdownawaitpool.closeAll()The repository includes several example files:
sample/- TypeORM entity examples
The driver supports all standard SQL data types plus IRIS-specific types:
| TypeORM Type | IRIS Type | Notes |
|---|---|---|
integer | INTEGER | Auto-increment supported |
varchar | VARCHAR | Default length: 255 |
text | TEXT | Large text fields |
datetime | DATETIME | Timestamps |
boolean | BIT | True/false values |
decimal | DECIMAL | Precision and scale |
uniqueidentifier | UUID | GUID support |
npm run buildStart IRIS
docker compose up -d iris
npm testOptionally tests can run with testcontainers, image needs to be passed as envionment variable
export IRIS_IMAGE=containers.intersystems.com/intersystems/iris-community:latest-previewnpm run typecheck# Basic demo
node build/compiled/sample1-simple-entity/app.js
node build/compiled/sample2-one-to-one/app.js
node build/compiled/sample3-many-to-one/app.js
node build/compiled/sample4-many-to-many/app.js
node build/compiled/sample16-indexes/app.js
- Node.js 20+
- InterSystems IRIS 2025.1+
- TypeORM 0.3+
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Submit a pull request
MIT License - see LICENSE file for details.