freecoding.school100% FREE · NO SIGNUP
Await StationISSUE #20 of 26

indexedDB · the browser database

PromissaVSRace Condition Rex
Promissa saysIndexedDB is the browser’s async database for large, structured, queryable data.

When localStorage's string limit isn't enough, IndexedDB stores large amounts of structured data (objects, blobs) with indexes and transactions — fully async. The raw API is verbose (open a database, version it, create object stores, run transactions), so most apps use a wrapper like idb. It powers offline apps and big client-side caches.

Power-ups you unlock

Race Condition Rex attacks — common mistakes

Boss battleRead the open-and-store shape; note where the version upgrade hook goes.

Example code

<!doctype html><html><head><meta charset="utf-8"></head>
<body style="background:#06040d;color:#e6e0ff;font-family:monospace;padding:20px"><pre>const req = indexedDB.open('app', 1);
req.onupgradeneeded = e => e.target.result.createObjectStore('todos', { keyPath: 'id' });
req.onsuccess = e => {
  const db = e.target.result;
  db.transaction('todos','readwrite').objectStore('todos').add({ id:1, text:'learn idb' });
};</pre></body></html>
▶ Open the interactive comic issue
‹ SessionStorage · Tab-ScopedCookies · Document.Cookie ›