{"id":42159,"library":"typecql","title":"TypeCQL","description":"TypeCQL is an ORM for CQL databases like Cassandra and ScyllaDB, currently at version 1.1.17. It provides a built-in mapper with custom columns and options, an excellent type system (TypeScript 5+), query optimization, support for multiple connections, advanced methods, automatic loading of tables and columns, a migration tool, and transactions. It works with both NestJS and plain TypeScript Node.js. Key differentiators include its advanced type inference and seamless integration with NestJS, making it a strong alternative to other CQL ORMs like cassandra-driver's mapper or express-cassandra.","status":"active","version":"1.1.17","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","cql","CQL","ORM","Cassandra","ScyllaDB","NestJS","typescript"],"install":[{"cmd":"npm install typecql","lang":"bash","label":"npm"},{"cmd":"yarn add typecql","lang":"bash","label":"yarn"},{"cmd":"pnpm add typecql","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Default export is not available; use named import for Connection.","wrong":"","symbol":"Connection","correct":"import { Connection } from 'typecql'"},{"note":"ESM import is preferred; CommonJS require also works but may lack TypeScript types.","wrong":"const Entity = require('typecql').Entity","symbol":"Entity","correct":"import { Entity } from 'typecql'"},{"note":"Case-sensitive: 'Table' with capital T, not 'table'.","wrong":"import { table } from 'typecql'","symbol":"Table","correct":"import { Table } from 'typecql'"}],"quickstart":{"code":"import { Connection, Entity, Table } from 'typecql';\n\n@Entity({ keyspace: 'my_keyspace', table: 'users' })\nclass User {\n  @Table.PartitionKey()\n  id: string;\n\n  @Table.Column()\n  name: string;\n\n  @Table.Column()\n  email: string;\n}\n\nasync function main() {\n  const conn = new Connection({\n    contactPoints: ['127.0.0.1:9042'],\n    localDataCenter: 'datacenter1',\n    credentials: { username: 'cassandra', password: 'cassandra' },\n  });\n\n  await conn.connect();\n\n  const user = new User();\n  user.id = '1';\n  user.name = 'Alice';\n  user.email = 'alice@example.com';\n\n  await conn.save(user);\n\n  const retrieved = await conn.findOne(User, { id: '1' });\n  console.log(retrieved);\n\n  await conn.close();\n}\n\nmain().catch(console.error);","lang":"typescript","description":"Defines a User entity and demonstrates connecting to a Cassandra cluster, saving a new user, and retrieving it by primary key."},"warnings":[{"fix":"Ensure your Cassandra or ScyllaDB cluster is running and accessible from the configured contact points.","message":"TypeCQL requires a running Cassandra or ScyllaDB instance; connection errors are common if the database is not reachable.","severity":"gotcha","affected_versions":"all"},{"fix":"Update Connection configuration: replace { hosts: [...] } with { contactPoints: [...] }.","message":"In version 1.0.0, the Connection constructor changed from accepting an object with 'hosts' to 'contactPoints'. Old code using 'hosts' will break.","severity":"breaking","affected_versions":"<1.0.0"},{"fix":"Replace 'findOne' with 'findFirst' in your code.","message":"The method 'findOne' is deprecated in favor of 'findFirst' since version 1.1.0.","severity":"deprecated","affected_versions":">=1.1.0"},{"fix":"Add the following to tsconfig.json: \"experimentalDecorators\": true, \"emitDecoratorMetadata\": true.","message":"TypeCQL uses TypeScript decorators which require 'experimentalDecorators' and 'emitDecoratorMetadata' to be enabled in tsconfig.json.","severity":"gotcha","affected_versions":"all"},{"fix":"Check the return type of save() and use SaveResult.entity to get the saved entity.","message":"Starting from version 1.2.0 (future), the 'save' method will no longer return the entity but a SaveResult object. You must adapt code that expects the entity back.","severity":"breaking","affected_versions":">=1.2.0"}],"env_vars":null,"search_vec":"'1.1.17':16 '5':34 'advanc':41,67 'altern':79 'automat':43 'built':21 'built-in':20 'cassandra':10,86,93,98 'cassandra-driv':85 'column':26,48 'connect':40 'cql':7,82,95,96 'current':13 'custom':25 'databas':8 'differenti':64 'driver':87 'excel':30 'express':92 'express-cassandra':91 'includ':65 'infer':69 'integr':72 'javascript':94 'key':63 'like':9,84 'load':44 'make':75 'mapper':23,89 'method':42 'migrat':50 'multipl':39 'nestj':58,74,100 'node.js':62 'optim':36 'option':28 'orm':5,83,97 'plain':60 'provid':18 'queri':35 'scylladb':12,99 'seamless':71 'strong':78 'support':37 'system':32 'tabl':46 'tool':51 'transact':53 'type':31,68 'typecql':1,2 'typescript':33,61,101 'version':15 'work':55","created_at":"2026-06-04T18:55:54.294490+00:00","updated_at":"2026-06-04T18:55:54.294490+00:00","problems":[{"fix":"Install typecql: npm install typecql. Ensure you are using the correct import: import { ... } from 'typecql'.","cause":"Missing installation or incorrect import path.","error":"Cannot find module 'typecql' or its corresponding type declarations."},{"fix":"Use import: import { Connection } from 'typecql' and then instantiate with new Connection(...).","cause":"Using CommonJS require without calling new.","error":"TypeError: Class constructor Connection cannot be invoked without 'new'"},{"fix":"Set \"experimentalDecorators\": true in tsconfig.json.","cause":"Decorators require TypeScript compiler options.","error":"experimentalDecorators not enabled"}],"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":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":"typecql","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}}