JavaScript › Browser Storage & Web APIs

What is IndexedDB and how does it differ from a simple key-value store?

Intermediate

Answer

IndexedDB is a low-level, transactional NoSQL database built into the browser. It supports structured objects, indexes for fast querying by property, and versioned schema upgrades — well beyond a flat key-value store like localStorage.
const request = indexedDB.open('AppDB', 1);
request.onupgradeneeded = (e) => {
  const db = e.target.result;
  db.createObjectStore('notes', { keyPath: 'id' });
};
Real-world example Building an offline-first note-taking app that needs to query notes by date or tag.

Common follow-ups: Why does IndexedDB use events and transactions instead of simple async/await natively?