{"id":44054,"library":"ts-db-helper","title":"ts-db-helper","description":"ts-db-helper is an experimental TypeScript ORM for relational databases, currently at version 0.0.15. It provides a lightweight, model-based abstraction over SQL databases with TypeScript-first design, offering simple CRUD operations and type-safe queries. The package has minimal dependencies and is suitable for small projects or quick prototypes. However, it is in early development (pre-1.0), with no stable release cadence, limited features compared to mature ORMs like TypeORM or Prisma, and lacks comprehensive documentation. Key differentiators include its simplicity and focus on TypeScript type inference, but it may lack production readiness and community support.","status":"active","version":"0.0.15","language":"javascript","source_language":"en","source_url":"https://github.com/margarito/ts-db-helper","tags":["javascript","ORM","TypeScript","rdb","db","database","model","typescript"],"install":[{"cmd":"npm install ts-db-helper","lang":"bash","label":"npm"},{"cmd":"yarn add ts-db-helper","lang":"bash","label":"yarn"},{"cmd":"pnpm add ts-db-helper","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM default import; CJS require requires .default","wrong":"const DB = require('ts-db-helper').default","symbol":"default","correct":"import DB from 'ts-db-helper'"},{"note":"Named export; works in both ESM and CJS","wrong":"const { Model } = require('ts-db-helper')","symbol":"Model","correct":"import { Model } from 'ts-db-helper'"},{"note":"DB is the default export, not a named export","wrong":"import { DB } from 'ts-db-helper'","symbol":"DB","correct":"import DB from 'ts-db-helper'"},{"note":"QueryBuilder is a named export","wrong":"import QueryBuilder from 'ts-db-helper'","symbol":"QueryBuilder","correct":"import { QueryBuilder } from 'ts-db-helper'"}],"quickstart":{"code":"import DB, { Model } from 'ts-db-helper';\n\nconst db = new DB({\n  host: process.env.DB_HOST ?? 'localhost',\n  port: parseInt(process.env.DB_PORT ?? '3306'),\n  user: process.env.DB_USER ?? 'root',\n  password: process.env.DB_PASS ?? '',\n  database: process.env.DB_NAME ?? 'test'\n});\n\nclass User extends Model {\n  static tableName = 'users';\n  id!: number;\n  name!: string;\n  email!: string;\n}\n\nasync function main() {\n  await db.connect();\n  \n  // Create user\n  const user = await User.create({ name: 'John', email: 'john@example.com' });\n  console.log('User created:', user);\n  \n  // Find by id\n  const foundUser = await User.find(user.id);\n  console.log('Found:', foundUser);\n  \n  // Update\n  user.name = 'Jane';\n  await user.save();\n  \n  // Delete\n  await user.delete();\n  \n  await db.close();\n}\n\nmain().catch(console.error);","lang":"typescript","description":"Shows basic setup of DB connection, defining a Model, and performing CRUD operations (create, find, update, delete)."},"warnings":[{"fix":"Consider using mature ORMs like TypeORM, Prisma, or Sequelize for production.","message":"The library is in early stage (v0.0.x). APIs may change without notice. Do not use in production without thorough testing.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Pin exact version and review changelog before updating.","message":"No deprecation notices documented; but pre-1.0 versions may have breaking changes.","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"Use `import DB from 'ts-db-helper'` (no curly braces).","message":"Default export (DB) is used to create a connection instance. Some users mistakenly import { DB } as named export.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Always define static tableName in model subclasses.","message":"Model class requires a static `tableName` property. Forgetting this will cause runtime errors.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Call db.connect() before queries and db.close() after done.","message":"Database connections must be opened and closed explicitly. No connection pooling built-in.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'-1.0':67 '0.0.15':20 'abstract':28 'base':27 'cadenc':72 'communiti':105 'compar':75 'comprehens':85 'crud':39 'current':17 'databas':16,31,112 'db':3,7,111 'depend':50 'design':36 'develop':65 'differenti':88 'document':86 'earli':64 'experiment':11 'featur':74 'first':35 'focus':93 'helper':4,8 'howev':60 'includ':89 'infer':97 'javascript':107 'key':87 'lack':84,101 'lightweight':24 'like':79 'limit':73 'matur':77 'may':100 'minim':49 'model':26,113 'model-bas':25 'offer':37 'oper':40 'orm':13,78,108 'packag':47 'pre':66 'prisma':82 'product':102 'project':56 'prototyp':59 'provid':22 'queri':45 'quick':58 'rdb':110 'readi':103 'relat':15 'releas':71 'safe':44 'simpl':38 'simplic':91 'small':55 'sql':30 'stabl':70 'suitabl':53 'support':106 'ts':2,6 'ts-db-helper':1,5 'type':43,96 'type-saf':42 'typeorm':80 'typescript':12,34,95,109,114 'typescript-first':33 'version':19","created_at":"2026-06-05T17:02:45.096864+00:00","updated_at":"2026-06-05T17:02:45.096864+00:00","problems":[{"fix":"Run `npm install ts-db-helper` and ensure import path is correct.","cause":"Package not installed or import path incorrect.","error":"Cannot find module 'ts-db-helper'"},{"fix":"Use `import DB from 'ts-db-helper'` (default import).","cause":"DB used as a named import instead of default import.","error":"TypeError: db.connect is not a function"},{"fix":"Add `static tableName = 'users'` to the class.","cause":"Static tableName not defined in Model subclass.","error":"Property 'tableName' is missing in class User"},{"fix":"Check DB_HOST, DB_USER, DB_PASS environment variables or config.","cause":"Invalid database credentials.","error":"Error: ER_ACCESS_DENIED_ERROR: Access denied for user 'root'@'localhost'"}],"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/margarito/ts-db-helper#readme","github":"https://github.com/margarito/ts-db-helper","docs":null,"changelog":null,"pypi":null,"npm":"ts-db-helper","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}}