Code runs inside the DB
Deploy a WebAssembly module; OriginDB runs it in a wasmtime sandbox with epoch CPU deadlines and a memory limiter.
OriginDB is an open-source realtime database where your application logic lives inside the engine — as sandboxed WebAssembly reducers. Every write is transactional, logged to a durable WAL, and streamed to each client over a SQL-filtered changefeed.
A client calls a reducer. Your WebAssembly code runs in a wasmtime sandbox against a staged overlay, commits atomically, hits the WAL, and emits exactly one changefeed event — delivered only to subscribers whose WHERE clause matches.
A client invokes a function you deployed. Args arrive as JSON; the host freezes the clock for determinism.
Staged writes apply through one transaction, or roll back entirely on a trap or abort. Durable before you hear “ok”.
Each commit emits one ordered event. Subscribers get only rows matching their SQL — no client sees the firehose.
A small, readable engine — the whole thing is roughly 15k lines — with the primitives a realtime app actually needs.
Deploy a WebAssembly module; OriginDB runs it in a wasmtime sandbox with epoch CPU deadlines and a memory limiter.
Subscribe with SELECT … WHERE … and receive only matching changes, in order. The predicate runs server-side.
A writer thread batches commits behind one fdatasync. Power-loss safe; throughput rises with concurrency.
Redeploy a new version and the rules change instantly — no migration, no downtime, against a running world.
Reducer writes stage in an overlay and apply as one atomic commit, or the entire call rolls back. No partial state.
Query and subscribe with real SQL — WHERE, comparisons, LIKE, and boolean logic over your tables.
First-class SDKs for AssemblyScript and C#, with Rust and C++ in the tree.
The WAL is the canonical world. Replay on boot rebuilds exactly the set of acknowledged commits — fast, compact binary.
Each demo's entire simulation is a reducer. The browser is a pure subscriber — it renders what the changefeed streams and holds no authority of its own.
A shared realtime wall — live cursors, pinned notes, an activity tape. Every twitch travels through a reducer, a commit, the WAL, and a filtered changefeed before it lands.
Open live boardAn agar-style arena whose authoritative tick is a WASM reducer. Server-authoritative rewards mean a hot-swap re-values the whole arena instantly.
Play cube.ioA 60 Hz physics sumo whose whole simulation is a reducer, ticked natively across cores. Roll, ram, and shove rivals off the rim — hundreds of players per server.
Play Marble ClashA persistent region-control RTS — thousands of tiles, region-sharded ticks, and area-of-interest subscriptions so each client streams only the map it can see.
Play TerritoriesFrom the repo's benchmark suite on a dev Mac — deliberately the worst realistic case (F_FULLFSYNC ≈ 21 ms). On Linux with fdatasync, the absolute figures climb.
# build, then run the server
$ origindb_server -d ./data -p 8787 -g 50051
✓ listening — ws :8787 grpc :50051
# deploy your reducer module
$ origindb deploy chat chat.wasm 1.0.0
# call it — the write commits and streams
$ origindb call chat sendMsg '["general","hi"]'// a browser is a pure subscriber
const ws = new WebSocket("ws://localhost:8787");
ws.onopen = () => ws.send(JSON.stringify({
type: "sql_subscribe",
sql: "SELECT * FROM msgs WHERE room='general'"
}));
// initial snapshot + live matching commits
ws.onmessage = (e) => render(JSON.parse(e.data));OriginDB is MIT-licensed and self-hosted. No seats, no metered egress, no proprietary runtime between you and your data. Read the source, run it on your box, ship on top of it.