A production-ready cargo-generate template for creating full-stack Rust web applications using Leptos framework with WebAssembly System Interface (WASI) Components. This template provides a complete, working setup for server-side rendered (SSR) Rust web applications with client-side hydration, ready for deployment on any WASI-compatible runtime.
Note:
The default branch/tag (0.1.3) is pinned to match a specificleptos_wasiversion.
Usingmainor newer tags may introduce breaking changes unless you explicitly opt into them.
Install cargo-generate:
cargo install cargo-generateGenerate a new project using the stable release:
cargo generate --git https://github.com/codeitlikemiley/leptos-wasi-template --name counter -sGenerate from a specific version:
cargo generate --git https://github.com/codeitlikemiley/leptos-wasi-template --branch 0.1.3 --name counter -s- WASI Component Architecture – Full Guest trait and WasiExecutor implementation
- Server-Side Rendering (SSR) – Fast initial page loads
- Client-Side Hydration – Interactive UI with seamless hydration
- Server Functions – Type-safe RPC between client and server
- File-Based Routing – Automatic routing for organized pages
- Static Asset Serving – Built-in support for WASI filesystems
- Tailwind CSS Support – Pre-configured and ready to use
- Working Counter Example – Demonstrates full client-server flow
-
Rust 1.82+
-
WASI Target:
rustup target add wasm32-wasip2
-
cargo-generate:
cargo install cargo-generate
-
cargo-leptos:
cargo install cargo-leptos
-
Wasmtime CLI:
cargo install wasmtime-cli
-
(Optional) Tailwind CSS:
npm install -g tailwindcss
cd my-app
cargo leptos build --release
chmod +x serve.sh
./serve.shAccess your app at http://localhost:8080.
my-app/
├── Cargo.toml
├── README.md
├── serve.sh
├── public/
│ └── favicon.ico
└── src/
├── main.rs
├── lib.rs
├── server.rs
├── routes.rs
└── pages/
├── mod.rs
└── home.rs
This template is dual-licensed under MIT or Apache 2.0. Generated projects are free to adopt their own licensing.
Each template tag corresponds to a specific leptos_wasi version to ensure compatibility.
Check the available versions:
git ls-remote --tags https://github.com/codeitlikemiley/leptos-wasi-template