A tiny, interactive Axum app that shows how a Rust web server works using server-side templates (Askama) and small HTMX fragments. It's meant to teach by example — short, readable code and a live UI you can poke at.
Why this project is great for beginners
- Small and focused: only a few files to read (
src/andtemplates/). - Hands-on: run it locally and explore the code while seeing changes in the browser.
- Uses real tools you'll meet in production: Axum, Askama, HTMX, Tokio.
Quick start — 1 command
Run this from the project root:
# default: 0.0.0.0:3001
AXUM_EXPLAINER_APP_HOST=0.0.0.0 AXUM_EXPLAINER_APP_PORT=3001 cargo runOpen http://127.0.0.1:3001 and click "Start with the Stack".
What you will learn (in 10 minutes)
- How
Routermaps URLs to handlers (src/router.rs). - How to use
Stateto share read-only data across handlers (src/state.rs). - How handlers return HTML via Askama templates (
src/handlers/). - How small HTMX partials update parts of the page without a full reload (
templates/partials).
Where to look first (guided path)
src/main.rs— app entry, logging, and server start.src/router.rs— routes and static file serving.src/handlers/pages.rs— full page handlers and template structs.templates/— openbase.htmlandindex.htmlto see how data flows from Rust into HTML.
Tips for exploring
- Start the server and open the UI; then search for a template variable in
templates/and find where it is set insrc/. - Try editing a template (small text), save, and refresh to see the change.
- The code is intentionally simple: many values are hard-coded in
src/models/content.rsso you can read them easily.
Small, safe improvements you can try
- Replace an
unwrapinsrc/config.rswith a smallmatchto practice error handling. - Add a tiny unit test for
NavCtx(tests go intests/or as#[cfg(test)]in a module).
If you want more
- See full README with development tips, linting, and recommended CI in the original README (kept in repo history).
License
- Add a
LICENSEfile if you plan to reuse this code publicly (MIT or Apache-2.0 are common).
Questions or stuck? Tell me what you want to explore next — I can make a guided walkthrough or small PR with step-by-step edits.