{"id":49814,"library":"ydn.db","title":"YDN-DB","description":"A unified client-side database library for IndexedDB, WebSQL, and localStorage, currently at stable version 1.3.0. It provides a consistent asynchronous API across storage backends, supports schema version migration, advanced queries (including SQL-like and full-text search via additional modules), and transaction workflow management. Key differentiators include support for legacy browsers (IE6+, Chrome 4+, etc.), on-the-fly schema generation, managed requests to avoid InvalidStateError, and high-performance index queries using AVL trees for localStorage. Actively maintained until 2016, now in maintenance mode.","status":"maintenance","version":"1.3.0","language":"javascript","source_language":"en","source_url":"https://github.com/yathit/ydn-db","tags":["javascript","IndexedDB","WebSQL","WebStorage","database"],"install":[{"cmd":"npm install ydn.db","lang":"bash","label":"npm"},{"cmd":"yarn add ydn.db","lang":"bash","label":"yarn"},{"cmd":"pnpm add ydn.db","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Global variable 'ydn' is used via script tag; no npm module. Use global in browser.","wrong":"import Storage from 'ydn.db'","symbol":"ydn.db.Storage","correct":"var db = new ydn.db.Storage('db-name', schema);"},{"note":"Always prefix with 'ydn.db.'.","wrong":"const db = new Storage('db-name');","symbol":"ydn.db.Storage","correct":"const db = new ydn.db.Storage('db-name');"},{"note":"Not available as npm package. Use CDN or download from website.","wrong":"require('ydn-db')","symbol":"ydn.db.Storage","correct":"<script src='ydn.db.min.js'></script>"}],"quickstart":{"code":"// Include ydn.db in HTML: <script src='https://cdn.jsdelivr.net/npm/ydn-db@1.3.0/dist/ydn.db.min.js'></script>\n\nvar schema = {\n  stores: [{\n    name: 'people',\n    indexes: [{ name: 'age' }]\n  }]\n};\nvar db = new ydn.db.Storage('my-db', schema);\n\ndb.put('people', { name: 'Alice', age: 30 }, 'id1');\ndb.get('people', 'id1').done(function(record) {\n  console.log(record);\n});\n\ndb.from('people').where('age', '>=', 25).list(10).done(function(records) {\n  console.log(records);\n});\n\ndb.close();","lang":"javascript","description":"Shows how to open a database with schema, store and retrieve a record, and query using an index."},"warnings":[{"fix":"Use IndexedDB backend by ensuring browser supports IndexedDB; avoid relying on WebSQL.","message":"WebSQL is deprecated in many browsers and will be removed.","severity":"deprecated","affected_versions":">=1.0"},{"fix":"Pass schema as second argument: new ydn.db.Storage('name', schema).","message":"Storage constructor expects a schema object, not a version number like IndexedDB.","severity":"gotcha","affected_versions":">=1.0"},{"fix":"Define compound index, e.g., ['age', 'name'] if ordering by 'name' after filtering by 'age'.","message":"Queries using 'order' require a compound index defined in schema.","severity":"gotcha","affected_versions":">=1.0"},{"fix":"Add 'keyPath' property to index objects in schema.","message":"Version 1.2 changed schema format: 'keyPath' now required for indexes.","severity":"breaking","affected_versions":">=1.2"},{"fix":"Use .done() for success, .fail() for error, not .then() .catch().","message":"Methods return promises (jQuery-style) but not standard Promises; .done() and .fail() used.","severity":"gotcha","affected_versions":">=1.0"}],"env_vars":null,"search_vec":"'1.3.0':20 '2016':88 '4':61 'across':27 'activ':85 'addit':46 'advanc':34 'api':26 'asynchron':25 'avl':81 'avoid':72 'backend':29 'browser':58 'chrome':60 'client':7 'client-sid':6 'consist':24 'current':16 'databas':9,97 'db':3 'differenti':53 'etc':62 'fli':66 'full':42 'full-text':41 'generat':68 'high':76 'high-perform':75 'ie6':59 'includ':36,54 'index':78 'indexeddb':12,94 'invalidstateerror':73 'javascript':93 'key':52 'legaci':57 'librari':10 'like':39 'localstorag':15,84 'maintain':86 'mainten':91 'manag':51,69 'migrat':33 'mode':92 'modul':47 'on-the-fli':63 'perform':77 'provid':22 'queri':35,79 'request':70 'schema':31,67 'search':44 'side':8 'sql':38 'sql-like':37 'stabl':18 'storag':28 'support':30,55 'text':43 'transact':49 'tree':82 'unifi':5 'use':80 'version':19,32 'via':45 'websql':13,95 'webstorag':96 'workflow':50 'ydn':2 'ydn-db':1","created_at":"2026-06-07T17:03:44.138554+00:00","updated_at":"2026-06-07T17:03:44.138554+00:00","problems":[{"fix":"Ensure ydn.db.min.js is included before usage: <script src='ydn.db.min.js'></script>","cause":"Library not loaded or script path incorrect.","error":"Uncaught TypeError: ydn.db is undefined"},{"fix":"Use managed requests: db.run() to wrap operations in transaction, or ensure db is open.","cause":"Attempting to put/get after closing database or during transaction that doesn't allow writes.","error":"InvalidStateError: A mutation operation was attempted on a database that did not allow mutations."},{"fix":"Add 'version' to schema: { version: 1, stores: [...] }","cause":"Missing required 'version' property in schema.","error":"ydn.db.Storage: schema version is not defined"}],"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":"http://dev.yathit.com/ydn-db/index.html","github":"https://github.com/yathit/ydn-db","docs":null,"changelog":null,"pypi":null,"npm":"ydn.db","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database","storage"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}