Dexie.Js
D

Dexie.Js

Dexie.Js

JavaScript
14,458 stars
N/A forks
N/A contributors

README

Project documentation from GitHub

Dexie.js: A Minimalist Wrapper Around IndexedDB That Actually Makes Sense

If you've ever tried to use IndexedDB directly, you know the pain. The API is verbose, callback-heavy, and full of gotchas. You end up writing tons of boilerplate just to save and retrieve a simple object. That's where Dexie.js comes in. It's a thin, promise-based wrapper that makes IndexedDB feel like a modern database you'd actually want to use.

Dexie.js doesn't try to be everything to everyone. It focuses on one thing: making IndexedDB simple, fast, and reliable. And it nails it.

What It Does

Dexie.js is a lightweight JavaScript library that wraps the native IndexedDB API with a clean, Promise-based interface. You define your database schema using a simple syntax, then use familiar methods like add, put, get, update, delete, and filter to work with your data. It handles all the transaction boilerplate, error edge cases, and version upgrading for you.

Under the hood, it maps your schema to IndexedDB object stores and indexes. But you don't need to think about that. You just write code that looks like this:

// Define a database with a "friends" table
const db = new Dexie('MyDatabase');
db.version(1).stores({ friends: '++id, name, age'
}); // Add a friend
await db.friends.add({ name: 'Alice', age: 30 }); // Query by name
const alice = await db.friends.where('name').equals('Alice').first();

That's it. No onupgradeneeded, no onsuccess, no digging through IDBRequest objects.

Why It's Cool

What makes Dexie.js stand out is how much thought went into the developer experience. Here are a few things that really shine:

Promise-based everything. Every operation returns a native Promise. You can use async/await, .then(), or chain them. No callback hell.

Live queries with React integration. Dexie comes with a useLiveQuery hook for React that automatically re-renders your components when the underlying IndexedDB data changes. No manual invalidation or polling. It just works.

Powerful query API without SQL. You get compound queries, sorting, filtering, limit, offset, and full-text search. But you write it with chainable methods like .where('age').above(18).and(item => item.name.startsWith('A')). It feels natural.

Automatic schema migration. When you change your database schema, Dexie handles version upgrades seamlessly. You don't have to write migration scripts unless you want to.

Did you like this issue?

Join our weekly newsletter

Related Projects

Love discovering amazing projects?

Help us continue bringing you the best open-source discoveries every week.

Back to Projects
Last updated: Jun 5, 2026