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
Running locally
Enter the Nix shell, and run:
just watch
Building
nix build
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.
In 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 backend, as opposed to 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.