HeadlinesBriefing favicon HeadlinesBriefing.com

Topcoat: Rust Full-Stack Web Framework

Hacker News •
×

Topcoat is a modular, "batteries-included" Rust framework designed for building full-stack web applications with a focus on simplicity and productivity. It renders all markup on the server, allowing components to be asynchronous and query databases directly, thereby eliminating the need for a separate API layer.

Client interactivity is achieved without boilerplate. A $(...) expression is type-checked Rust that Topcoat evaluates on the server for initial rendering and also translates to JavaScript for instant re-execution in the browser, avoiding a WASM bundle or client build step. For updates requiring server interaction, such as fresh search results, components can be marked as #[shard]. Topcoat re-renders these on the server when their arguments change and swaps the new HTML in place.

The framework features a `view!` macro that stays true to HTML and Rust, allowing familiar Rust control flow within templates. Routing can be module-based, inferring the route tree from the app's module structure. Topcoat also includes an asset system for serving files efficiently with aggressive browser caching and offers built-in Tailwind support.