Skip to content

tieje/htmx-axum-hello-world

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HTMX-Axum Hello World App

This is a simple hello world app that is intended to be forked into new projects.

Recommendations

Templating

While I have opted to use Askama for templating, there are several good options for templating:

  • Minijinja: MiniJinja is a powerful but minimal dependency template engine for Rust compatible with Jinja/Jinja2
  • Askama: Jinja inspired, type-safe, requires template precompilation. Has significant divergence from Jinja syntax in parts.
  • Tera: Jinja inspired, dynamic, has divergences from Jinja.
  • TinyTemplate: minimal footprint template engine with syntax that takes lose inspiration from Jinja and handlebars.
  • Liquid: an implementation of Liquid templates for Rust. Liquid was inspired by Django from which Jinja took it's inspiration.

If you're planning on using HTMX extensively, I recommend looking into axum-htmx. As you can see from this example project, it is possible to use HTMX without the axum-htmx crate.

CLI

  • Cargo Watch is a must so that you can see your changes immediately

CSS

Usage

  1. cargo run
  2. Go to http://localhost:3000

Bonus: Try out http://localhost:3000/Kevin

Motivation

I created this simple app as part of my blog. You can learn more about my experience building with HTMX and Axum there.