idb

A tiny, promise-based wrapper around IndexedDB that keeps the native API but drops the event-listener boilerplate.

Library
npm
v8.0.3
7,416 stars
ISC

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
40 /100 Fair
Development Activity 0
Maintenance 0
Community 60
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
83 /100 Excellent
Architecture 85
Code Quality 80
Innovation 88
Learning Curve 85

idb is a ~1.19kB (brotli’d) library by Jake Archibald that mirrors the browser’s IndexedDB API almost exactly, but returns promises instead of firing success/error events. Every method that would normally hand back an IDBRequest resolves or rejects instead, so IndexedDB code can be written with plain async/await rather than nested callbacks.

On top of the promise conversion, idb adds small usability layers: shortcut methods for common single-store operations (get, put, delete, getAll, and their index-scoped equivalents), a tx.done promise and tx.store accessor on transactions, and async-iterator support for cursors so stores and indexes can be looped over with for-await-of. Full TypeScript typings, including a generic DBSchema for typed stores and indexes, ship with the package, and zero runtime dependencies keep it safe to drop into any bundler-based or CDN-based project.

What You Get

  • openDB() and deleteDB() as promise-returning replacements for indexedDB.open/deleteDatabase, with upgrade/blocked/blocking/terminated callbacks
  • Shortcut methods on the database object (get, put, add, delete, clear, getAll, getAllKeys, count) and their *FromIndex equivalents, so single-store operations skip explicit transaction creation
  • tx.done (a promise that resolves when a transaction commits) and tx.store (the sole object store in a single-store transaction), removing common transaction-lifetime bugs
  • Async-iterator support for cursors — for await (const cursor of store) — via a separate with-async-ittr entry point to keep the core bundle small
  • wrap()/unwrap() escape hatches to convert between native IndexedDB objects and idb’s enhanced versions when interoperating with other code
  • Full TypeScript definitions, including a generic DBSchema type for compile-time-checked store names, key paths, and index names

Common Use Cases

  • Offline-first web apps that need structured client-side storage beyond what localStorage or a simple key-value store can offer
  • PWA caching layers that persist API responses, user data, or media alongside the Cache API
  • Building a typed local database schema (stores, indexes, versioned migrations) for a browser application without adopting a heavier ORM
  • Replacing hand-rolled IndexedDB promise wrappers with a small, well-tested, zero-dependency library

Under The Hood

Architecture — idb’s core is a Proxy-based transform in src/wrap-idb-value.ts. The wrap() function checks whether a value is an IDBRequest (in which case it’s promisified directly via promisifyRequest) or one of the proxyable IDB types (IDBDatabase, IDBObjectStore, IDBIndex, IDBCursor, IDBTransaction), in which case it returns a Proxy wrapping that value with idbProxyTraps. The traps intercept property gets to recursively wrap() whatever is returned (so nested calls like db.transaction(…).objectStore(…).get(…) stay wrapped end-to-end), special-case tx.done and tx.store, and unwrap ‘this’ before calling into native methods to avoid ILLEGAL INVOCATION errors. Two WeakMaps (transformCache, reverseTransformCache) cache the wrapped/unwrapped pairs so repeated access to the same object returns the same Proxy (preserving object equality) and so unwrap() can reverse the mapping. src/entry.ts builds openDB/deleteDB on top of this, attaching upgradeneeded/blocked/blocking/terminated listeners to the underlying IDBOpenDBRequest. src/database-extras.ts layers the get/put/delete-style shortcut methods on top of the wrapped database, and src/async-iterators.ts adds Symbol.asyncIterator to cursors/stores/indexes by repeatedly calling continue() and yielding each wrapped cursor.

Tech Stack — The library is 97% TypeScript with zero runtime dependencies, targeting modern browsers only (no IE) and relying on the DOM lib’s IndexedDB type definitions. It’s built with Rollup 4 (@rollup/plugin-typescript, @rollup/plugin-node-resolve, @rollup/plugin-terser) into three consumable outputs declared via package.json’s exports map: an ESM build (build/index.js), a CJS build (build/index.cjs), and a UMD build served directly off jsdelivr for script-tag use. A custom size-report script (lib/size-report.mjs) runs after every build to track the brotli’d bundle size, and the project uses pnpm for dependency management.

Used by 19 apps in this directory

TypeScript
82%
Other

AFFiNE

Collaboration · Note Taking · Productivity

73,040

Write, draw, and plan in one infinite canvas — the open-source alternative to Notion and Miro that keeps your data yours.

View details
91
Repo Health
87
Technical
67
Dependency
Built with
TypeScript 82%
Rust 11%
Updated 5 days ago
Ruby
50%
Other

Chatwoot

Customer Support

37,254

Open-source omnichannel customer support platform with AI-powered agents, live chat, and self-hosting — a full Intercom and Zendesk alternative.

View details
95
Repo Health
78
Technical
69
Dependency
Built with
Ruby 50%
Vue 25%
JavaScript 22%
Updated 5 days ago
Python
47%
MIT

Docs

CMS · File Storage

16,868

Open-source collaborative knowledge platform with real-time editing, AI writing tools, and full self-hosting control — built by the French and German governments.

View details
88
Repo Health
81
Technical
68
Dependency
Built with
Python 47%
TypeScript 45%
Updated 4 days ago
TypeScript
64%
Other

Epicenter

Developer Tools · Knowledge Management · Note Taking

4,808

A local-first monorepo led by Whispering, an open-source speech-to-text app, built on an MIT toolkit that turns your data into plain Markdown and SQLite files you own instead of a database you rent.

View details
88
Repo Health
90
Technical
64
Dependency
Built with
TypeScript 64%
HTML 13%
Svelte 13%
Updated 5 days ago
TypeScript
48%
AGPL 3.0

Grafana

Analytics · Monitoring

76,962

The open-source observability platform that unifies metrics, logs, and traces from any data source into dynamic, queryable dashboards.

View details
95
Repo Health
91
Technical
63
Dependency
Built with
TypeScript 48%
Go 46%
Updated 4 days ago
TypeScript
55%
Other

Jaaz

AI Agents · AI Design Tools

6,670

Open-source AI creative agent that turns visual sketches and canvas gestures into images and videos — no text prompts required.

View details
48
Repo Health
59
Technical
71
Dependency
Built with
TypeScript 55%
Python 34%
JavaScript 10%
Updated 7 months ago
Ruby
59%
AGPL 3.0

Mastodon

Social Media

50,335

Run your own federated social network on the open ActivityPub standard with no ads, no algorithms, and no corporate control over your community.

View details
95
Repo Health
81
Technical
70
Dependency
Built with
Ruby 59%
TypeScript 24%
Updated 4 days ago
Rust
71%
Apache 2.0

mesh-llm

AI Agents · AI Development

3,463

Mesh LLM pools GPUs and memory across every machine you own into one OpenAI-compatible API, so agents tap distributed compute instead of a single GPU box or a metered cloud bill.

View details
84
Repo Health
91
Technical
69
Dependency
Built with
Rust 71%
TypeScript 13%
Python 10%
Updated 4 days ago
TypeScript
96%
Apache 2.0

Next AI Draw.io

AI Design Tools · Design Tools · Developer Tools

36,063

Turn natural language into professional draw.io diagrams with AI, cloud icons, and an MCP server for your IDE.

View details
78
Repo Health
80
Technical
68
Dependency
Built with
TypeScript 96%
Updated 5 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers