MCPcopy Index your code
hub / github.com/adhamsalama/sqlite-wasm-webrtc

github.com/adhamsalama/sqlite-wasm-webrtc @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
357 symbols 833 edges 13 files 12 documented · 3%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Peer-to-peer collaborative database editing & sharing in the browser. No server required.

This project uses SQLite compiled to WebAssembly in the browser as the database, and provides collaborative funcionalities using WebRTC.

Evey peer has their own SQLite DB in their browser, and SQL statements are sent to peers using WebRTC, providing a private and secure way to share and manipulate data.

Install

npm i

Build

npm run build

Run

node server.js
  • Open a browser browser instance at http://localhost:8080/index.html.
  • Click "Create Room" and enter a room name.
  • Open another browser instance at the same URL.
  • Click "Join Room" and enter the same room name.

Now you and your peers are connected using WebRTC. Every query or file you import will be replicated to your peers.

This has the benefit of being private and secure because the database and the queries run on it are shared between you and you peers only.

I initially used PGLite which has excellent documentation and is very easy to use, but found it too heavy for this use case. SQLite is lighter and more suitable to running a database in the browser.

The docs for running SQLite in a web worker with persistance weren't easy, and I eventually had to add a bit of code to SQLite's WASM glue to make it easier to use.

I copied my existing WebRTC app project and removed unnecessary parts (video/audio/screen sharing), and kept DataChannels. So for more resources about WebRTC you can check my WebRTC repo.

Resources

Core symbols most depended-on inside this repo

toss
called by 105
sqlite3.js
log
called by 95
sqlite3.js
toss3
called by 63
sqlite3.js
rop
called by 21
sqlite3.js
error
called by 21
sqlite3.js
warn
called by 19
sqlite3.js
storeErr
called by 17
sqlite3.js
log
called by 16
sqlite3.js

Shape

Function 292
Method 51
Class 14

Languages

TypeScript100%

Modules by API surface

sqlite3.js287 symbols
sqlite3-opfs-async-proxy.js23 symbols
js/webrtc.ts16 symbols
js/webrtc.js16 symbols
spreadsheet.js4 symbols
csvToSqlite.js3 symbols
async-worker.js3 symbols
sqlite3-worker1-promiser.js2 symbols
main.js2 symbols
randomString.js1 symbols

For agents

$ claude mcp add sqlite-wasm-webrtc \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page