Clone wiki

ydn-db / Home

Javascript database module for Indexeddb, WebDatabase (WebSQL) and WebStorage (localStorage) storage mechanisms supporting version migration, advanced query and transaction.


Beautiful database API for secure, robust, high-performance, maintainable, large-scale javascript web app.


  • Unified data access layer on IndexedDB, WebDatabase and WebStorage storage mechanisms.
  • Support all features of asynchronous IndexedDB API.
  • The implementation of WebSQL supports schema reflection, untyped column key, composite index, multiEntry and IndexedDB-like aborting and implicit commit transaction. localStorage use on-memory AVL tree index for key range query and its performance is in-par with database.
  • Support for on-the-fly database schema generation, IndexedDB-style versioned schema migration and advance schema-centric (auto-version) migration by reflecting on existing schema.
  • Well tested closure library module including 234 unit test functions in addition to qunit end-to-end test to validate library API specification.
  • Advance transaction workflow and managed request (meaning you will never ever see InvalidStateError). Transaction policy can be defined so that each request is atomic, orderred requests (serial transaction) and parallel requests for performance. Additionally explicit isolated transaction can be created using run.
  • Designed for high performance index query (only).
  • Customized log message, improper usage protection and guided error message on dev distribution.
  • Basic support for high level query using SQL.
  • Full text search (via ydn-db-text module).
  • Client-server Synchronization (via ydn-db-sync module).
  • We adopt strict javascript coding pattern for performance and robustness: no global, no eval, no error globbing, parameterized query, all public methods and constructors are strongly type, this is this, coding error throw error.

Projects using YDN-DB

BlueMind enterprise collaboration software use and contribute YDN-DB raw source code Digita tustena offline CRM use compiled YDN-DB library Synclio CRM use YDN-DB library


  1. Synchronization.
  2. Relationship schema.
  3. Efficient join algorithms.
  4. SQL parser, optimiser and physical execution layer base on relational algebra.

Supported browser

Basic features are supported by most browsers. Run unit tests on target browsers.

Basic usage

Import lastest minified JS script (see download section) to your HTML files. This will create single object in the global scope, call ydn.db.Storage.

var db = new ydn.db.Storage('db name');
db.put('store1', {test: 'Hello World!'}, 123);
db.get('store1', 123).done(function(value) {


Bug report

Please file an issue for bug report describing how we could reproduce the problem. Any subtle problem, memory/speed performance issue and missing feature from stand point of IndexedDB API will be considered.

Ask general question in Stackoverflow with ydn-db tag.

Follow update news in Twitter @yathit.


Licensed under the Apache License, Version 2.0