This is not an insurmountable task but it adds some complication. For convenience and an easier developer experience, we built the
cargo-leptos build tool.
cargo-leptos basically exists to coordinate the build process for your app, handling recompiling the server and client halves when you make changes, and adding some built-in support for things like Tailwind, SASS, and testing.
Getting started is pretty easy. Just run
cargo install cargo-leptos
And then to create a new project, you can run either
# for an Actix template
cargo leptos new --git leptos-rs/start
# for an Axum template
cargo leptos new --git leptos-rs/start-axum
cd into the directory you’ve created and run
cargo leptos watch
Note: Remember that Leptos has a
nightlyfeature, which each of these starters use. If you're using the stable Rust compiler, that’s fine; just remove the
nightlyfeature from each of the Leptos dependencies in your new
Cargo.tomland you should be all set.
Once your app has compiled you can open up your browser to
http://localhost:3000 to see it.
cargo-leptos has lots of additional features and built in tools. You can learn more in its
But what exactly is happening when you open our browser to
localhost:3000? Well, read on to find out.