Gathering detailed insights and metrics for dexie
Gathering detailed insights and metrics for dexie
Gathering detailed insights and metrics for dexie
Gathering detailed insights and metrics for dexie
dexie-react-hooks
React hooks for reactive data fetching using Dexie.js
dexie-export-import
Dexie addon that adds export and import capabilities
dexie-observable
Addon to Dexie that makes it possible to observe database changes no matter if they occur on other db instance or other window.
@types/dexie
Stub TypeScript definitions entry for dexie, which provides its own types definitions
npm install dexie
Typescript
Module System
Node Version
NPM Version
99.5
Supply Chain
100
Quality
85.8
Maintenance
100
Vulnerability
100
License
JavaScript (49.97%)
TypeScript (49.15%)
Shell (0.49%)
HTML (0.4%)
Total Downloads
63,792,352
Last Day
22,772
Last Week
523,477
Last Month
2,305,784
Last Year
24,358,281
Apache-2.0 License
13,261 Stars
2,670 Commits
673 Forks
115 Watchers
152 Branches
93 Contributors
Updated on Jun 30, 2025
Minified
Minified + Gzipped
Latest Version
4.0.11
Package Id
dexie@4.0.11
Unpacked Size
2.85 MB
Size
715.31 kB
File Count
22
NPM Version
10.8.2
Node Version
20.16.0
Published on
Jan 15, 2025
Cumulative downloads
Total Downloads
Last Day
0.6%
22,772
Compared to previous day
Last Week
-11.9%
523,477
Compared to previous week
Last Month
2.8%
2,305,784
Compared to previous month
Last Year
49.9%
24,358,281
Compared to previous year
25
Dexie.js is a wrapper library for indexedDB - the standard database in the browser. https://dexie.org.
/$$ /$$ /$$ /$$ /$$
| $$ | $$ | $$ | $$ | $$
| $$ | $$ /$$$$$$ /$$$$$$$| $$ /$$ /$$$$$$ /$$$$$$ | $$$$$$$ /$$$$$$ /$$$$$$$
| $$$$$$$$ |____ $$ /$$_____/| $$ /$$/ |____ $$|_ $$_/ | $$__ $$ /$$__ $$| $$__ $$
| $$__ $$ /$$$$$$$| $$ | $$$$$$/ /$$$$$$$ | $$ | $$ \ $$| $$ \ $$| $$ \ $$
| $$ | $$ /$$__ $$| $$ | $$_ $$ /$$__ $$ | $$ /$$| $$ | $$| $$ | $$| $$ | $$
| $$ | $$| $$$$$$$| $$$$$$$| $$ \ $$| $$$$$$$ | $$$$/| $$ | $$| $$$$$$/| $$ | $$
|__/ |__/ \_______/ \_______/|__/ \__/ \_______/ \___/ |__/ |__/ \______/ |__/ |__/
🌟 Welcome to Dexie Global Hackathon 25! 🌟
📅 Date: February 14 --> April 13, 2025
🕒 Start coding with Dexie Cloud and win prices!
For more information: dexie.org/hackathon
Good luck! 🚀
IndexedDB is the portable database for all browser engines. Dexie.js makes it fun and easy to work with.
But also:
1<!DOCTYPE html> 2<html> 3 <head> 4 <script src="https://unpkg.com/dexie/dist/dexie.js"></script> 5 <script> 6 7 // 8 // Declare Database 9 // 10 const db = new Dexie('FriendDatabase'); 11 db.version(1).stores({ 12 friends: '++id, age' 13 }); 14 15 // 16 // Play with it 17 // 18 db.friends.add({ name: 'Alice', age: 21 }).then(() => { 19 return db.friends 20 .where('age') 21 .below(30) 22 .toArray(); 23 }).then(youngFriends => { 24 alert (`My young friends: ${JSON.stringify(youngFriends)}`); 25 }).catch (e => { 26 alert(`Oops: ${e}`); 27 }); 28 29 </script> 30 </head> 31</html>
Yes, it's that simple. Read the docs to get into the details.
All modern browsers support ES modules and top-level awaits. No transpiler needed. Here's the previous example in a modern flavour:
1<!DOCTYPE html> 2<html> 3 <head> 4 <script type="module"> 5 // Import Dexie 6 import { Dexie } from 'https://unpkg.com/dexie/dist/modern/dexie.mjs'; 7 8 // 9 // Declare Database 10 // 11 const db = new Dexie('FriendDatabase'); 12 db.version(1).stores({ 13 friends: '++id, age' 14 }); 15 16 // 17 // Play with it 18 // 19 try { 20 await db.friends.add({ name: 'Alice', age: 21 }); 21 22 const youngFriends = await db.friends 23 .where('age') 24 .below(30) 25 .toArray(); 26 27 alert(`My young friends: ${JSON.stringify(youngFriends)}`); 28 } catch (e) { 29 alert(`Oops: ${e}`); 30 } 31 </script> 32 </head> 33</html>
Real-world apps are often built using components in various frameworks. Here's a version of Hello World written for React and Typescript. There are also links below this sample to more tutorials for different frameworks...
1import React from 'react'; 2import { Dexie, type EntityTable } from 'dexie'; 3import { useLiveQuery } from 'dexie-react-hooks'; 4 5// Typing for your entities (hint is to move this to its own module) 6export interface Friend { 7 id: number; 8 name: string; 9 age: number; 10} 11 12// Database declaration (move this to its own module also) 13export const db = new Dexie('FriendDatabase') as Dexie & { 14 friends: EntityTable<Friend, 'id'>; 15}; 16db.version(1).stores({ 17 friends: '++id, age', 18}); 19 20// Component: 21export function MyDexieReactComponent() { 22 const youngFriends = useLiveQuery(() => 23 db.friends 24 .where('age') 25 .below(30) 26 .toArray() 27 ); 28 29 return ( 30 <> 31 <h3>My young friends</h3> 32 <ul> 33 {youngFriends?.map((f) => ( 34 <li key={f.id}> 35 Name: {f.name}, Age: {f.age} 36 </li> 37 ))} 38 </ul> 39 <button 40 onClick={() => { 41 db.friends.add({ name: 'Alice', age: 21 }); 42 }} 43 > 44 Add another friend 45 </button> 46 </> 47 ); 48}
Tutorials for React, Svelte, Vue, Angular and vanilla JS
Dexie has kick-ass performance. Its bulk methods take advantage of a lesser-known feature in IndexedDB that makes it possible to store stuff without listening to every onsuccess event. This speeds up the performance to a maximum.
1above(key): Collection; 2aboveOrEqual(key): Collection; 3add(item, key?): Promise; 4and(filter: (x) => boolean): Collection; 5anyOf(keys[]): Collection; 6anyOfIgnoreCase(keys: string[]): Collection; 7below(key): Collection; 8belowOrEqual(key): Collection; 9between(lower, upper, includeLower?, includeUpper?): Collection; 10bulkAdd(items: Array): Promise; 11bulkDelete(keys: Array): Promise; 12bulkPut(items: Array): Promise; 13clear(): Promise; 14count(): Promise; 15delete(key): Promise; 16distinct(): Collection; 17each(callback: (obj) => any): Promise; 18eachKey(callback: (key) => any): Promise; 19eachPrimaryKey(callback: (key) => any): Promise; 20eachUniqueKey(callback: (key) => any): Promise; 21equals(key): Collection; 22equalsIgnoreCase(key): Collection; 23filter(fn: (obj) => boolean): Collection; 24first(): Promise; 25get(key): Promise; 26inAnyRange(ranges): Collection; 27keys(): Promise; 28last(): Promise; 29limit(n: number): Collection; 30modify(changeCallback: (obj: T, ctx:{value: T}) => void): Promise; 31modify(changes: { [keyPath: string]: any } ): Promise; 32noneOf(keys: Array): Collection; 33notEqual(key): Collection; 34offset(n: number): Collection; 35or(indexOrPrimayKey: string): WhereClause; 36orderBy(index: string): Collection; 37primaryKeys(): Promise; 38put(item: T, key?: Key): Promise; 39reverse(): Collection; 40sortBy(keyPath: string): Promise; 41startsWith(key: string): Collection; 42startsWithAnyOf(prefixes: string[]): Collection; 43startsWithAnyOfIgnoreCase(prefixes: string[]): Collection; 44startsWithIgnoreCase(key: string): Collection; 45toArray(): Promise; 46toCollection(): Collection; 47uniqueKeys(): Promise; 48until(filter: (value) => boolean, includeStopEntry?: boolean): Collection; 49update(key: Key, changes: { [keyPath: string]: any }): Promise;
This is a mix of methods from WhereClause, Table and Collection. Dive into the API reference to see the details.
Dexie Cloud is a commercial offering that can be used as an add-on to Dexie.js. It syncs a Dexie database with a server and enables developers to build apps without having to care about backend or database layer else than the frontend code with Dexie.js as the sole database layer.
Source for a sample Dexie Cloud app: Dexie Cloud To-do app
See the sample Dexie Cloud app in action: https://dexie.github.io/Dexie.js/dexie-cloud-todo-app/
https://dexie.org/docs/Samples
https://github.com/dexie/Dexie.js/tree/master/samples
https://dexie.org/docs/Questions-and-Answers
npm install dexie
For those who don't like package managers, here's the download links:
https://unpkg.com/dexie@latest/dist/dexie.min.js
https://unpkg.com/dexie@latest/dist/dexie.min.js.map
https://unpkg.com/dexie@latest/dist/modern/dexie.min.mjs
https://unpkg.com/dexie@latest/dist/modern/dexie.min.mjs.map
https://unpkg.com/dexie@latest/dist/dexie.d.ts
See CONTRIBUTING.md
pnpm install
pnpm run build
pnpm test
pnpm run watch
7.3/10
Summary
Prototype Pollution in Dexie
Affected Versions
>= 4.0.0-alpha.1, <= 4.0.0-alpha.2
Patched Versions
4.0.0-alpha.3
7.3/10
Summary
Prototype Pollution in Dexie
Affected Versions
< 3.2.2
Patched Versions
3.2.2
No security vulnerabilities found.