Bringing True SQLite to the Browser with OPFS 🚀

Published: (December 21, 2025 at 10:47 AM EST)
1 min read
Source: Dev.to

Source: Dev.to

Cover image for Bringing True SQLite to the Browser with OPFS 🚀

The Problem

For years, we’ve emulated SQL on top of localStorage (5 MB limit) or used IndexedDB (painful API). Modern web apps need more power.

The Solution: web-sqlite-js

web-sqlite-js is a lightweight wrapper around SQLite WASM and the Origin Private File System (OPFS). It gives you a persistent, high‑performance database that lives right in the browser.

Key Features

  • True SQLite – Full support for JOINs, Transactions, and Triggers.
  • Persistent – Data is saved to the browser’s file system (OPFS).
  • Non‑Blocking – Runs in a Web Worker to keep your UI at 60 fps.
  • Type‑Safe – First‑class TypeScript support.

Quick Start

npm install web-sqlite-js
import openDB from "web-sqlite-js";

const db = await openDB("my-app.sqlite3");

// Standard SQL
await db.exec("CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT)");
await db.exec("INSERT INTO users (name) VALUES (?)", ["Alice"]);

// Complex Queries
const users = await db.query("SELECT * FROM users ORDER BY name ASC");

await db.close();

Check it out on GitHub:

Tags: javascript typescript webdev sqlite

Back to Blog

Related posts

Read more »

Bare-metal frontend

Bare-metal frontend Introduction Modern frontend applications have become very rich, complex and sophisticated. They are not just simple UIs polling data. They...