topic
WebAssemblyRust compiled to WASM, shipped to npm
overview
I'm Dibbayajyoti Roy — a WebAssembly engineer who writes performance-critical code in Rust and ships it as WASM that ordinary JavaScript and TypeScript projects can install. The promise of Rust + WebAssembly is simple: native-speed compute, delivered as a normal dependency, running everywhere JavaScript runs. This page covers what I've built with it and how.
diffcore — a Rust/WASM diff engine
Diffcore is a WebAssembly JSON diff engine — the diff itself runs in Rust compiled to WASM. It returns real RFC 6901 JSON Pointer paths and standard RFC 6902 JSON Patch, ships applyPatch / revertPatch, a React useDiff hook, a CLI, and a streaming engine for multi-GB files. In head-to-head benchmarks it runs several times faster than optimized pure-JS diff libraries. The full breakdown is on Diffcore vs jsondiffpatch.
how it's built
The Rust source is compiled to WebAssembly with wasm-bindgen, then the WASM module is embedded as Base64 inside the npm package — so there is nothing to host and no loader to configure. Memory is cleaned up automatically via FinalizationRegistry. The result installs and behaves like any other npm library while doing its real work in WebAssembly.
where WebAssembly wins
WASM earns its place on CPU-bound work — diffing, parsing, encoding, compression — where pure JavaScript leaves throughput on the table. Because the output is WebAssembly, the same build runs on Node, browsers, Bun, Deno, Cloudflare Workers, Vercel Edge, Electron, and Tauri. One artifact, every runtime. For the language side of this work, see Rust engineering.
faq
What WebAssembly project has Dibbayajyoti Roy shipped?
Diffcore — a JSON diff engine written in Rust, compiled to WebAssembly, and published on npm. It runs on Node, browsers, Bun, Deno, Cloudflare Workers, Vercel Edge, Electron, and Tauri.
Why compile to WebAssembly instead of writing pure JavaScript?
A diff is CPU-bound work over large objects. Running it as Rust compiled to WASM gives several times the throughput of optimized pure-JS while staying a normal npm install — no native addon, no platform-specific binaries.
How is the WASM module bundled?
Diffcore embeds the WASM module as Base64 inside the package, so it is zero-config: there is no separate .wasm file to host, import, or configure a loader for. It just works after npm install.
Does it work on edge runtimes?
Yes. Because the engine is WebAssembly, it runs unchanged on Cloudflare Workers and Vercel Edge alongside Node and the browser.
related
Keep reading: Rust engineering · Diffcore vs jsondiffpatch · projects & experience · get in touch
Thanks for reading. Love your work, keep it up!