IndexedDB
ELI5 — The Vibe Check
IndexedDB is a full-on database living inside your browser. Unlike LocalStorage's tiny notebook, IndexedDB can store gigabytes of structured data and query it efficiently. It's what apps like Google Docs and Figma use to store your work offline. The API is notoriously clunky, so everyone uses a wrapper library.
Real Talk
IndexedDB is a low-level browser API for client-side storage of significant amounts of structured data, including files and blobs. It is a transactional, object-oriented database with indexes for efficient querying. The native API is complex; libraries like Dexie.js provide a more ergonomic interface. Storage limits are typically 50% of available disk space.
Show Me The Code
// Using Dexie.js (IndexedDB wrapper)
import Dexie from 'dexie'
const db = new Dexie('MyDatabase')
db.version(1).stores({ notes: '++id, title, body' })
await db.notes.add({ title: 'My Note', body: 'Hello IndexedDB' })
const allNotes = await db.notes.toArray()
When You'll Hear This
We use IndexedDB via Dexie.js to cache the product catalog offline.,IndexedDB can store gigabytes — LocalStorage tops out at ~5MB.,Use Dexie.js or idb to avoid the raw IndexedDB API's complexity.
Related Terms
LocalStorage
LocalStorage is a simple key-value storage built into every browser that persists even after you close the tab.
PWA (PWA)
A PWA is a website that pretends to be an app.
Service Worker
A Service Worker is a JavaScript script that runs in the background, separate from your web page.
SessionStorage
SessionStorage is just like LocalStorage except it forgets everything when you close the browser tab.