Most online compilers work the same way: your code is sent to a server, compiled inside a container, and the output comes back. That works, but it means running a fleet of sandboxes, paying for them, rate-limiting them and trusting them with other people's code.
For the online compilers on Devtoolry I went the other way: the compiler itself runs in your browser . C and C++ are compiled by Clang 21 and Go by the official Go 1.27 compiler and linker, all as WebAssembly inside a Web Worker. Nothing is uploaded, and the server only serves static files.
This post covers how it works and the problems I ran into.
The architecture in one picture
page ββ{ code, stdin }βββΆ Web Worker ββ download toolchain once (cached by the browser) ββ compile + link in an in-memory file system ββ WebAssembly.compile(main.wasm) ββ run it with a tiny WASI host (stdin/stdout/stderr, clocks) page βββ{ output, exitCode }ββ
Enter fullscreen mode
Exit fullscreen mode
Each language has its own worker.β¦