localForage
Offline browser storage library with a simple localStorage-like API backed by IndexedDB or WebSQL.
Repository Health
Technical Analysis
localForage improves the offline storage experience of web apps by offering a localStorage-like API backed by asynchronous storage engines — IndexedDB or WebSQL, whichever the browser supports — instead of synchronous, string-only localStorage. It automatically stores values of any type (arrays, objects, blobs, and more) without manual JSON serialization, and falls back to localStorage itself in browsers lacking IndexedDB or WebSQL support.
The library exposes a dual callback/Promise API so it fits either Node-style callback code or modern async/await usage, and it can be extended with custom driver implementations beyond the three built-in storage backends. It ships as a dependency-free single file suitable for a plain <script> tag as well as an npm package for bundler-based projects.
What You Get
- A
localStorage-compatible API (getItem,setItem,removeItem,clear,length,key,keys,iterate) backed by IndexedDB or WebSQL - Automatic driver selection with fallback ordering (IndexedDB → WebSQL → localStorage) and manual driver override via
setDriver() - Native storage of non-string values (objects, arrays, Blobs, ArrayBuffers) without manual JSON encoding
- A dual callback/Promise API, allowing use with
async/awaitor traditional Node-style callbacks - Multiple named instances via
createInstance()for isolated stores within the same origin - An extensible driver API for adding custom storage backends beyond the three built in
Common Use Cases
- Persisting offline-first web app state so it survives page reloads and works without a network connection
- Caching API responses or computed data client-side to reduce redundant network requests
- Storing structured user data (objects, arrays) in the browser without hand-rolling JSON.stringify/parse around localStorage
- Building Progressive Web Apps that need reliable storage across browsers with inconsistent IndexedDB/WebSQL support
- Migrating simple
localStorage-based code to asynchronous storage with minimal API changes
Under The Hood
Architecture - The core src/localforage.js module defines the public API and driver-registration system, delegating actual reads/writes to one of three driver implementations under src/drivers/ (indexeddb.js, websql.js, localstorage.js). At initialization, localForage probes the environment for IndexedDB support, falling back through WebSQL to plain localStorage, and exposes defineDriver() so third-party storage backends can be registered using the same interface. createInstance() produces independent, differently namespaced localForage objects so multiple stores can coexist without key collisions.
Tech Stack - Written in plain JavaScript with no runtime dependencies, built via a Grunt-based pipeline (Gruntfile.js) into both an unbundled dist/localforage.js for direct <script> inclusion and a CommonJS build for npm/bundler consumption. TypeScript typings are maintained separately under typings/ with a dedicated typing-tests suite to catch definition regressions.
Code Quality - The test/ directory includes cross-environment suites for iframes, web workers, service workers, and multiple module-loading styles (require, Browserify, polyfill), reflecting the project’s focus on consistent behavior across the many contexts a browser storage library must run in. However, the repository shows low recent commit activity and infrequent releases (last npm release 2021), so newer browser storage APIs or edge cases may not be actively tracked.
API Design - The API is deliberately a drop-in match for localStorage’s method names and semantics, which keeps the learning curve minimal for anyone who has used browser storage before; the main addition is asynchronicity (callbacks/Promises) and automatic handling of non-string values. This close mirroring is also a constraint — the API surface stays intentionally narrow (no transactions, no querying beyond iterate()), trading power for familiarity.
Used by 16 apps in this directory
Onlook
AI Design Tools · Design Tools
An open-source, AI-first visual editor that lets designers and developers build, style, and deploy React apps directly in code — no handoff required.
QRev
AI Agents · CRM
Open source AI-first sales platform that replaces Salesforce with autonomous agents handling prospecting, outreach, and lead management at scale.
React Cosmos
Developer Tools
An open-source sandbox for developing and testing React and React Native UI components in isolation, with pluggable bundler support for Vite and Webpack.
Rocket.Chat
Team Chat
The secure, self-hosted team communications platform for organizations that cannot compromise on data sovereignty.
Screenity
Productivity · Video Editors
Free, privacy-first Chrome screen recorder with real-time annotation, AI camera blur, and a built-in video editor — no sign-in or limits required.
SillyTavern
AI Assistants
The power-user LLM frontend that unifies dozens of AI backends with a rich scripting engine, immersive Visual Novel mode, and a thriving extension ecosystem.
Twake Drive
Collaboration · File Storage
Open-source, self-hosted file manager with collaborative drives, AI-powered summarization, and OnlyOffice document editing for teams who want full data sovereignty.