{"id":42125,"library":"ts-redis-orm","title":"ts-redis-orm","description":"A TypeScript ORM for Redis that provides relational database features like multiple indexes, primary keys, unique keys, auto-increment, and aggregate functions (count, sum, min, max, average). Version 1.1.1 supports Redis 3, 4, and 5 via ioredis, but does not work with Redis Cluster. Breaking changes in v1 include all operations returning performance metrics and removal of soft delete and updatedAt/deletedAt columns. Designed for performance, creating ~10,000 entities per second per CPU process.","status":"active","version":"1.1.1","language":"javascript","source_language":"en","source_url":"https://github.com/terence410/ts-redis-orm","tags":["javascript","redis","redis orm","sorted set","ioredis","relational db","typescript"],"install":[{"cmd":"npm install ts-redis-orm","lang":"bash","label":"npm"},{"cmd":"yarn add ts-redis-orm","lang":"bash","label":"yarn"},{"cmd":"pnpm add ts-redis-orm","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Underlying Redis client used for all Redis operations","package":"ioredis","optional":false}],"imports":[{"note":"Use named import; default export is not available.","wrong":"import BaseEntity from 'ts-redis-orm'","symbol":"BaseEntity","correct":"import { BaseEntity } from 'ts-redis-orm'"},{"note":"Works with CommonJS via destructuring, but ESM is preferred.","wrong":"const Entity = require('ts-redis-orm').Entity","symbol":"Entity","correct":"import { Entity } from 'ts-redis-orm'"},{"note":"Decorator for defining columns.","symbol":"Column","correct":"import { Column } from 'ts-redis-orm'"},{"note":"Function export, not a class; note lowercase 'o'.","wrong":"import { RedisOrm } from 'ts-redis-orm'","symbol":"redisOrm","correct":"import { redisOrm } from 'ts-redis-orm'"}],"quickstart":{"code":"import { BaseEntity, Column, Entity } from 'ts-redis-orm';\n\n@Entity({ connection: 'default', table: 'MyEntity' })\nclass MyEntity extends BaseEntity {\n  @Column({ autoIncrement: true })\n  public id: number = 0;\n\n  @Column({ unique: true })\n  public name: string = '';\n\n  @Column({ index: true })\n  public age: number = 0;\n}\n\nasync function main() {\n  await MyEntity.connect();\n  const entity = new MyEntity();\n  entity.name = 'Alice';\n  entity.age = 30;\n  const [saved, perf] = await entity.save();\n  console.log('Saved entity:', saved);\n  console.log('Performance:', perf);\n  const [found] = await MyEntity.find({ where: { name: 'Alice' } });\n  console.log('Found:', found);\n}\n\nmain().catch(console.error);","lang":"typescript","description":"Defines a simple entity with auto-increment id, unique name, and indexed age, then saves and retrieves it."},"warnings":[{"fix":"Destructure the result: const [entity, perf] = await Entity.create({}).save();","message":"All operations now return a performance result tuple [entity, performanceResult] instead of just entity. This changes function signatures for create().save(), find(), update() etc.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Remove any usage of updatedAt, deletedAt columns and softDelete/restore methods from your code.","message":"updatedAt and deletedAt columns have been removed. softDelete() and restore() methods are no longer available.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Use a standalone Redis server or consider alternative ORMs like ioredis-based solutions that support cluster.","message":"This package does NOT work with Redis Cluster due to design limitations. It only works with standalone Redis instances.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Catch RedisOrmSchemaError and call entity.constructor.resync() or use the provided resync method.","message":"Schema errors can occur if entity definitions change after data exists. You need to call resync() to align schema.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Add \"experimentalDecorators\": true and \"emitDecoratorMetadata\": true to your tsconfig.json.","message":"The library uses decorators which require TypeScript's experimentalDecorators and emitDecoratorMetadata to be enabled.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'000':73 '1.1.1':34 '10':72 '3':37 '4':38 '5':40 'aggreg':26 'auto':23 'auto-incr':22 'averag':32 'break':50 'chang':51 'cluster':49 'column':67 'count':28 'cpu':78 'creat':71 'databas':13 'db':88 'delet':64 'design':68 'entiti':74 'featur':14 'function':27 'includ':54 'increment':24 'index':17 'ioredi':42,86 'javascript':80 'key':19,21 'like':15 'max':31 'metric':59 'min':30 'multipl':16 'oper':56 'orm':4,7,83 'per':75,77 'perform':58,70 'primari':18 'process':79 'provid':11 'redi':3,9,36,48,81,82 'relat':12,87 'remov':61 'return':57 'second':76 'set':85 'soft':63 'sort':84 'sum':29 'support':35 'ts':2 'ts-redis-orm':1 'typescript':6,89 'uniqu':20 'updatedat/deletedat':66 'v1':53 'version':33 'via':41 'work':46","created_at":"2026-06-04T18:55:44.581346+00:00","updated_at":"2026-06-04T18:55:44.581346+00:00","problems":[{"fix":"Ensure your class has @Entity decorator and extends BaseEntity.","cause":"Entity class not properly decorated with @Entity or not extending BaseEntity.","error":"Cannot read properties of undefined (reading 'save')"},{"fix":"Call await Entity.resync() to synchronize the schema with the data.","cause":"Entity definition changed (e.g., new column added) while data exists in Redis.","error":"RedisOrmSchemaError: Schema mismatch for table <table>"},{"fix":"Use 'new MyEntity()' to create an instance.","cause":"Using the class as a regular function instead of instantiating with new.","error":"TypeError: Class constructor MyEntity cannot be invoked without 'new'"}],"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/terence410/ts-redis-orm#readme","github":"https://github.com/terence410/ts-redis-orm","docs":null,"changelog":null,"pypi":null,"npm":"ts-redis-orm","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-04","next_check":"2026-09-02","install_tag":null}}