explaingit

phiresky/sql.js-httpvfs

Analysis updated 2026-07-03

3,677TypeScriptAudience · developerComplexity · 3/5Setup · moderate

TLDR

A TypeScript library that lets you host a SQLite database as a static file and run SQL queries on it from the browser by fetching only the needed chunks over HTTP.

Mindmap

mindmap
  root((sql.js-httpvfs))
    What it does
      Query SQLite in browser
      No server needed
      HTTP Range fetching
    How it works
      Fetch only needed chunks
      WebAssembly SQLite
      Runs in Web Worker
    Use cases
      Static data publishing
      GitHub Pages datasets
      Read-only explorers
    Setup
      npm package
      Optimize SQLite file
      Free static hosting
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Publish a searchable dataset on GitHub Pages without a backend by hosting a SQLite file and querying it from JavaScript.

USE CASE 2

Let users filter or search thousands of records in the browser by fetching only the indexed chunks of a static database file.

USE CASE 3

Build a read-only data explorer for statistics or records that loads instantly on free static hosting with no server costs.

What is it built with?

TypeScriptSQLiteWebAssemblyJavaScript

How does it compare?

phiresky/sql.js-httpvfscodeforreal1/compressovarharrie/varharrie.github.io
Stars3,6773,6773,677
LanguageTypeScriptTypeScriptTypeScript
Setup difficultymoderateeasymoderate
Complexity3/51/52/5
Audiencedevelopergeneraldeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 1h+

Requires preparing and optimizing the SQLite file with the right index structure and page size before hosting.

License details not mentioned in the explanation.

In plain English

sql.js-httpvfs is a TypeScript library that lets you host a SQLite database as a static file and query it directly from a web browser, without downloading the entire database file first. SQLite is a common format for storing structured data in a single file. Normally, running queries against it in a browser would require either a server to answer queries or downloading the whole file upfront. This library avoids both by using HTTP Range requests, a standard way of asking a web server to send only a specific portion of a file. When a browser runs a query, the library figures out which parts of the database file are needed to answer it, fetches only those chunks over the network, and runs the query locally using SQLite compiled to run in the browser. For queries that hit good database indexes, this can mean fetching just a few kilobytes rather than the whole file. The library includes logic to speed up fetching when it detects sequential reads. The practical use case is publishing a read-only dataset, such as a collection of records or statistics, on a free static hosting service like GitHub Pages, without needing a backend server or database. A developer prepares the SQLite file, uploads it, and then queries it from JavaScript in the browser. The README includes guidance on optimizing the database before hosting, covering index structure, page size, and splitting large files into chunks. The library works inside a Web Worker and requires WebAssembly support in the browser. The author notes it was built primarily for small personal projects and demonstrations, and that the virtual file system layer has no automated tests. For more production-oriented needs, the README points to related projects that take different approaches to in-browser SQLite. The project is available as an npm package.

Copy-paste prompts

Prompt 1
Show me how to host a SQLite database on GitHub Pages and query it from the browser using sql.js-httpvfs.
Prompt 2
How do I optimize a SQLite file for sql.js-httpvfs so queries only fetch a few kilobytes instead of the whole file?
Prompt 3
Write JavaScript code that uses sql.js-httpvfs to run a SELECT query on a static SQLite file hosted on a CDN.
Prompt 4
What page size and index structure should I use when preparing a SQLite database for sql.js-httpvfs to minimize HTTP requests?

Frequently asked questions

What is sql.js-httpvfs?

A TypeScript library that lets you host a SQLite database as a static file and run SQL queries on it from the browser by fetching only the needed chunks over HTTP.

What language is sql.js-httpvfs written in?

Mainly TypeScript. The stack also includes TypeScript, SQLite, WebAssembly.

What license does sql.js-httpvfs use?

License details not mentioned in the explanation.

How hard is sql.js-httpvfs to set up?

Setup difficulty is rated moderate, with roughly 1h+ to a first successful run.

Who is sql.js-httpvfs for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Scan in gitsafehub Deploy in gitdeployhub phiresky on gitmyhub

Verify against the repo before relying on details.