Awesome
leptos-fullstack
A Nix template for full-stack web apps in Rust using Leptos. Tech used:
- Leptos full-stack framework
- Axum as backend framework
- Tailwind CSS for styling
- Build system
- Autoformatting using
rustfmt
andleptosfmt
Running locally
Enter the Nix shell, and run:
# To spin up the dev server
just watch
# To run tests
just test
Building
nix build
# To build the rust doccs
nix build .#leptos-fullstack-docs
You can also nix run
the app directly.
Using as flake-parts module
Import ./nix/flake-module.nix
from this repos as a flake-parts module. For an example project, see nix-browser.
In the future, we might create a standalone flake-parts module for Leptos.
Notes
Single-crate model
This repo uses the single-crate model primarily because the backend-common-frontend split (prior to PR #5; similar to start-axum-workspace template) is not suitable when using server functions in leptos. Consequently, expect a bunch of cfg
attributes or macros that make backend-only code conditional upon the ssr
flag (which is set when compiling the crate for the backend, as opposed to the wasm frontend, which uses csr
)
Credits
The Rust code is largely based on start-axum. Also, credit goes to @benwis for pointers to how crane
can be made to work with cargo-leptos
.