tokio-rs /topcoat
A batteries-included framework for building web apps
★ 7,230⑂ 326👁 46⑃ 455● 137▤ 12
+11
日增长
+919
周增长
+1,151
月增长
7,230
stars
326
forks
46
watchers
455
prs
137
issues
12
releases
README
The full full-stack framework for Rust
[![Crates.io][crates-badge]][crates-url]
[![Docs.rs][docs-badge]][docs-url]
[![MIT licensed][mit-badge]][mit-url]
[![Build Status][actions-badge]][actions-url]
[![Discord chat][discord-badge]][discord-url]
[crates-badge]: https://img.shields.io/crates/v/topcoat.svg?style=flat-square
[crates-url]: https://crates.io/crates/topcoat
[docs-badge]: https://img.shields.io/docsrs/topcoat?style=flat-square
[docs-url]: https://docs.rs/topcoat/latest/topcoat
[mit-badge]: https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square
[mit-url]: https://github.com/tokio-rs/topcoat/blob/main/LICENSE
[actions-badge]: https://img.shields.io/github/actions/workflow/status/tokio-rs/topcoat/ci.yml?branch=main&style=flat-square
[actions-url]: https://github.com/tokio-rs/topcoat/actions?query=workflow%3ACI+branch%3Amain
[discord-badge]: https://img.shields.io/discord/500028886025895936.svg?logo=discord&style=flat-square
[discord-url]: https://discord.gg/tokio
Topcoat is a modular, batteries-included Rust framework for building full-stack apps. It prioritizes simplicity and productivity. See Learn Topcoat to get started, or the Roadmap for what's coming next.
Early-stage and experimental. Expect breaking changes.
rust,ignore
use topcoat::{
Result,
context::Cx,
router::{module_router, page},
view::{View, component, view},
};
[tokio::main]
async fn main() {
topcoat::start(module_router!().build()).await.unwrap();
}
[page]
async fn home(cx: &Cx) - Result {
Ok(view! {
hello(name: "World")
})
}
[component]
async fn hello(cx: &Cx, name: &str) - Result {
Ok(view! { "Hello, " (name) "!" })
}
What makes Topcoat different
Client reactivity without the boilerplate
Topcoat renders all markup on the server: components can be async and query the database directly, eliminating all the traditional boilerplate needed for a separate API layer. Interactivity does not have to cost a round-trip, though. A $(...) expression is ordinary type-checked Rust that Topcoat evaluates on the server for the initial render and also translates to JavaScript, so it re-runs instantly in the browser. No wasm bundle, no client build step:
rust,ignore
[component]
async fn faq(cx: &Cx) - Result {
let open = signal(cx, || false);
Ok(view! {
// Runs entirely in the browser; no server round-trip.
"What is Topcoat?"
"A full-stack Rust framework."
})
}
When an update does need the server, like fresh search results, mark the component as a [shard]. Topcoat re-renders it on the server whenever one of its $(...) arguments changes and swaps the new HTML in place:
rust,ignore
[component]
async fn search(cx: &Cx) - Result {
let query = signal(cx, String::new);
Ok(view! {
// Updates as the user types.
search_results(query: $(query.get()))
})
}
[shard]
async fn search_results(cx:Top issues
#275Proposal: compile client code from real Rust to JavaScript instead of runtime expressions (working spike + benchmarks)8 comments · 2026-07-31#517`topcoat asset bundle` / `topcoat dev` wipes other apps' bundles when multiple apps share a target directory5 comments · 2026-10-11#486Developer experience pain points4 comments · 2026-10-01#463Stronger types for component children4 comments · 2026-09-28#578add support for 'update' command in topcoat ui cli3 comments · 2026-11-02#401Is topcoat planning to have a styleX-like built-in CSS engine?3 comments · 2026-09-11#357Feature Request: Support loops with await expressions in event handlers3 comments · 2026-08-18#539[RFC] Integrated storybook experience shiped by the CLI2 comments · 2026-10-16
Discussions
#572Is the sidebar intended only as a top-level layout component?0 comments · 2026-10-29#568Is this the intended way to pass procedure to a component?0 comments · 2026-10-29#561Validation feature0 comments · 2026-10-25#554What is the best way to handle product images for an ecommerce site in topcoat?1 comments · 2026-10-22#552Component-scoped CSS: is there a supported approach, or is Tailwind the intended path?2 comments · 2026-10-22#548Updating a page's route query, with a signal.1 comments · 2026-10-20#527Layout groups for non-module routing2 comments · 2026-10-14#512Requirements from a self-hosted business platform admin UI (what would make Topcoat a fit)1 comments · 2026-10-10
Latest release
v0.12.1 v0.12.1 2026-11-10- OpenAPI
- Getting started
- Inherited settings
- Parameters, bodies and authentication
- Listing routes
OpenAPI
Getting started
Enable the new openapi feature and add schemars, which describes the data in your request and response bodies:
sh
cargo add topcoat --features openapi
cargo add schemars
Attach an Operation to a route with with(...). Topcoat takes the path, HTTP methods and path parameters from the router, and you add the rest:
rust
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use topcoat::{
Result,
context::Cx,
o相关报道 (3)
News & coverage (5)
Hacker NewsTopcoat: The full full-stack framework for Rust▲ 134 · 48 comments · 2026-07-17news.lavx.huTokio releases Topcoat: A batteries-included full-stack Rust framework2026-11-09Graphene-InfoGIT Coatings launches XGIT‑VORTEX graphene-based propeller coating2026-06-13EntrevestorGIT Releases New Coating Product2026-06-08MarineLinkGIT Coatings Launches XGIT-VORTEX Propeller Coating2026-06-04