HeadlinesBriefing favicon HeadlinesBriefing.com

Datastar powers trillion‑character collaborative canvas on €5.52 VPS

Hacker News •
×

Elias de Jong’s “Trillion Characters” turns a blank canvas into a live, collaborative text field built on the lightweight Datastar framework. Users click anywhere, type, and instantly see peers’ cursors as each keystroke streams from the server. The app contains no client‑side JavaScript beyond Datastar attributes, pushing all interaction logic to the backend, and the experiment showcases how server‑driven interactivity can scale without JavaScript bloat.

Datastar eliminates client state by delivering server‑rendered HTML over a persistent Server‑Sent Events (SSE) channel. The browser acts only as a rendering viewport, while a DOM‑morphing algorithm applies compressed updates. The architecture follows Query Command Request Segregation (CQRS), separating reads and writes and queuing commands at a fixed update rate. Brotli compression on SSE stream yields compression ratios between 50× and 4000×, surpassing gzip responses.

The backend stores each character in 45×45 chunks inside LMDB, a store compressed with LZ4 and indexed by Morton codes for spatial locality. Writes are fully ACID, guaranteeing every glyph lands on disk. During rendering, the server culls unseen chunks, sending each client only the visible portion of the canvas.

All of this runs on a €5.52 German VPS, the cheapest tier offered by public cloud providers. By offloading state and logic to the server, the experiment proves that real‑time, massive collaborative editing can operate on minimal hardware without sacrificing interactivity for thousands of simultaneous users.