hn.today

Topcoat is pushing the boundary of server applications with Rust

tokio.rs5 points1 comments
Screenshot of Topcoat is pushing the boundary of server applications with Rust

Topcoat is a batteries-included full‑stack Rust framework now at v0.9 that brings server‑centric rendering together with fine‑grained client interactivity. It centers on signals and a restricted, type‑checked Rust runtime expression language that can be transpiled to JavaScript so state initialized on the server can live in the browser. For changes that affect markup structure, Topcoat adds shards - server‑rendered components that rerun when their arguments change - and a mechanism to read signals on the server so only the dependent parts of a page are refetched. Updated HTML is morphed to preserve focus and input state, enabling responsive, zero‑latency UI patterns (examples include button counters, live search, and progressive re‑rendering).

Topcoat also adds streaming and server‑push capabilities: live! and emit! let servers stream multiple UI updates for suspense, progress, or continual updates, and WebSocket subscriptions deliver long‑lived UI pushes (useful for chat). Toasty, the integrated DB client, gained expressive procedural‑macro APIs such as update! for in‑DB increments without roundtrips, first‑class document field (JSONB) support and query generation, and a pattern for polymorphic relations by combining enums with annotations like shared(id) and index(id) to map variant fields to common table columns.

Read on tokio.rs1 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Programming

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.