IndexedDB is one of the storage capabilities introduced into browsers over the years. It’s a key/value store (a noSQL database) considered to be the definitive solution for storing data in browsers.

It’s an asynchronous API, which means that performing costly operations won’t block the UI thread providing a sloppy experience to users. It can store an indefinite amount of data, although once over a certain threshold the user is prompted to give the site higher limits.

It’s supported on all modern browsers.

It supports transactions, versioning and gives good performance. And compared to local storage, we can store much more data into it.

While you can technically create multiple databases per site, you generally create one single database, and inside that database you can create multiple object stores.

A database is private to a domain, so any other site cannot access another website IndexedDB stores.

Each store usually contains a set of things, which can be

  • strings
  • numbers
  • objects
  • arrays
  • dates

For example you might have a store that contains posts, another that contains comments.

A store contains a number of items which have a unique key, which represents the way by which an object can be identified.

You can alter those stores using transactions, by performing add, edit and delete operations, and iterating over the items they contain.

Lessons in this unit:

0: ▶︎ Introduction
1: Loading the idb library
2: Creating a database and a store
3: Adding data into a store
4: Retriving data from a store
5: Deleting data
6: Migrations
7: Unique keys