The W3C Indexed Database API working draft defines an method by which a developer may operate on a set of indexable object stores persisted in a client’s web browser environment. Values in an object store or index may be associated with a developer-specified primary/secondary key, or alternatively keys may be automatically generated based upon the value inserted. Left-, right-, full-, and un-bounded cursors are supported in both the forward and reverse direction. Each connection supports up to one active transaction across any set of open object stores (as is elucidated by the working draft).

The working draft exists as a incremental improvement over previous specifications (e.g. web storage) in that robust indexes and duplicate keys are supported. Indeed, an object store may have an arbitrary number of such indexes, each manually or automatically populated according to a developer’s needs. This API allows for advanced data scenarios on the client that were until now quite difficult (or not possible).

Unfortunately, there currently exists no reference implementation for this working draft. This project serves to fill this need, and exists as a browser plug-in that implements the API defined by the working draft.

Project Goals

My goals for any satisfactory solution include:

Implementing the Indexed Database API working draft with as much fidelity as is possible,

Producing a solution that is, insofar as is feasible, cross-browser compatible and platform agnostic,

Separating browser interoperation concerns from the underlying database technology such that new persistence logic may be easily introduced, and

Ensuring that the persistence layer has no direct dependencies upon the browser interoperation logic, so that the database persistence may be promoted or leveraged in outside projects (by being directly incorporated into a browser, for example).

Sample Code

By way of example, a client might leverage the Indexed Database API to perform client-side data persistence that reads: