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.
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.dbThe 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.db3. Build the front‑end
Compile and serve the application:
npm run build npm run serveOn 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 dev4. 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.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Programmer DD
A tinkering programmer and author of "Spring Cloud Microservices in Action"
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
