{"id":42344,"library":"ydb-orm","title":"ydb-orm","description":"A minimal ORM library for YDB database, designed for rapid development of serverless applications. Current stable version is 2.6.2. Released as needed; key features include lightweight data models, automatic migrations, and compatibility with the Fastify web server framework. Differentiates by providing a simple, Promise-based API and built-in schema synchronization.","status":"active","version":"2.6.2","language":"javascript","source_language":"en","source_url":"https://github.com/goshander/ydb-orm","tags":["javascript","typescript"],"install":[{"cmd":"npm install ydb-orm","lang":"bash","label":"npm"},{"cmd":"yarn add ydb-orm","lang":"bash","label":"yarn"},{"cmd":"pnpm add ydb-orm","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Optional peer dependency for Fastify plugin integration","package":"fastify","optional":true}],"imports":[{"note":"ESM import is recommended; CJS require works but may cause issues with TypeScript types.","wrong":"const Ydb = require('ydb-orm')","symbol":"Ydb","correct":"import { Ydb } from 'ydb-orm'"},{"note":"YdbModel is a named export, not default.","wrong":"import YdbModel from 'ydb-orm'","symbol":"YdbModel","correct":"import { YdbModel } from 'ydb-orm'"},{"note":"CJS destructuring works, but ESM is preferred for tree-shaking.","wrong":"const { YdbDataType } = require('ydb-orm')","symbol":"YdbDataType","correct":"import { YdbDataType } from 'ydb-orm'"}],"quickstart":{"code":"import { Ydb, YdbModel, YdbDataType } from 'ydb-orm';\n\nclass User extends YdbModel {\n  static schema = {\n    id: YdbDataType.ascii,\n    name: YdbDataType.ascii,\n  };\n  id: string;\n  name: string;\n  constructor(fields: Partial<{ id: string; name: string }>) {\n    super(fields);\n    this.id = fields.id || '';\n    this.name = fields.name || '';\n  }\n}\n\nconst connectionString = process.env.YDB_CONNECTION_STRING ?? '';\nconst db = Ydb.init({ connectionString, models: [User] });\n\nexport async function handler() {\n  const user = new User({ name: 'Alice' });\n  await user.save();\n  console.log('User saved:', user.id);\n}","lang":"typescript","description":"Shows defining a model with YdbModel and YdbDataType, initializing Ydb with a connection string, creating and saving a record."},"warnings":[{"fix":"Replace 'endpoint' and 'database' with a single 'connectionString'.","message":"The 'endpoint' and 'database' options in Ydb.init() are deprecated. Use 'connectionString' instead.","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Update authentication options to use 'credential', 'token', or 'meta'.","message":"In version 2.0.0, the authentication configuration changed. 'credential', 'token', 'meta' replaced old auth methods.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Ensure Ydb.init() is called exactly once at application startup.","message":"Ydb.init() must be called before any model operations, but only once per process. Calling it again may cause unexpected behavior.","severity":"gotcha","affected_versions":"all"},{"fix":"Remove explicit Ydb.init() if using fastify-ydb-orm.","message":"When using the Fastify plugin (fastify-ydb-orm), do not call Ydb.init() separately; the plugin handles initialization.","severity":"gotcha","affected_versions":"all"},{"fix":"Set sync: true when registering the plugin if you want automatic schema synchronization.","message":"The 'sync' option in YdbFastify plugin registration is now required for automatic schema migrations. Without it, no migrations occur.","severity":"breaking","affected_versions":">=2.0.0"}],"env_vars":null,"search_vec":"'2.6.2':22 'api':50 'applic':17 'automat':32 'base':49 'built':53 'built-in':52 'compat':35 'current':18 'data':30 'databas':10 'design':11 'develop':14 'differenti':42 'fastifi':38 'featur':27 'framework':41 'includ':28 'javascript':57 'key':26 'librari':7 'lightweight':29 'migrat':33 'minim':5 'model':31 'need':25 'orm':3,6 'promis':48 'promise-bas':47 'provid':44 'rapid':13 'releas':23 'schema':55 'server':40 'serverless':16 'simpl':46 'stabl':19 'synchron':56 'typescript':58 'version':20 'web':39 'ydb':2,9 'ydb-orm':1","created_at":"2026-06-04T18:56:48.331402+00:00","updated_at":"2026-06-04T18:56:48.331402+00:00","problems":[{"fix":"Ensure Ydb.init({...}) is called before any database access.","cause":"Attempting to use Ydb.db or model operations before initializing.","error":"Error: Ydb is not initialized. Call Ydb.init() first."},{"fix":"Use named import: import { YdbModel } from 'ydb-orm'.","cause":"YdbModel not imported correctly (e.g., default import instead of named).","error":"TypeError: Class extends value undefined is not a constructor or null"}],"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/goshander/ydb-orm","github":"https://github.com/goshander/ydb-orm","docs":null,"changelog":null,"pypi":null,"npm":"ydb-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}}