How to Build a Static Wikipedia with SQLite, WebAssembly, and JavaScript

This guide walks you through creating a client‑side static Wikipedia by downloading a dump, converting it to a SQLite database compiled to WebAssembly, and building a JavaScript front‑end that can be deployed on any static‑file host.

Programmer DD
Programmer DD
Programmer DD
How to Build a Static Wikipedia with SQLite, WebAssembly, and JavaScript

Wikipedia is a free, collaborative encyclopedia built on wiki technology. This article introduces an open‑source project that lets you create a static, client‑side Wikipedia using CSS, JavaScript, WebAssembly and SQLite.

1. Download a Wikipedia dump

Visit the official dump site, choose the language and date you need, and extract the XML file from the archive.

2. Convert XML to a SQLite database

Install the Node dependencies and run the conversion script:

npm install
cat "/path/to/enwiki.xml" | node ./scripts/xml_to_sqlite.js /path/to/output/folder/en.db

The command creates a .db file, which may require hundreds of gigabytes and several hours.

You can inspect the database with:

./scripts/sqlite3 /path/to/output/folder/en.db

3. Build the front‑end

Compile and serve the application:

npm run build
npm run serve

On macOS replace the system nginx.conf with the provided one if you prefer Nginx.

Adjust db.js so the dev URL points to your local en.db, then run:

npm run dev

4. Deploy

Upload the generated dist/ folder and the db/ files to a static‑file host, enable CORS, and update the URL in db.js.

5. Repeat for additional language dumps

For each new dump repeat steps 1‑4 and add the new database to db.js.

The final interface lets users select a language and search only within the corresponding SQLite database.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

JavaScriptWebAssemblySQLitestatic siteWikipedia
Programmer DD
Written by

Programmer DD

A tinkering programmer and author of "Spring Cloud Microservices in Action"

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.