hermannm / rust-htmx-demo

A simple todo app created with HTMX and Rust.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rust-htmx-demo

A simple todo app created with HTMX and Rust, using axum as the web framework, Maud for HTML templating, SQLx for database queries and Tailwind CSS for styling.

Running the app

  1. Install Rust, Node.js and Docker Compose

  2. Run npm ci (required for Tailwind CSS generation and TypeScript compilation)

  3. Install the SQLx CLI for compile-time verification of SQL queries: cargo install sqlx-cli --no-default-features --features postgres,rustls

  4. Copy .env.example to a file named .env in the repo root

    • This is required for SQLx compile-time verification to work, as it needs the DATABASE_URL environment variable in a .env file
  5. Run docker compose up to start Postgres

  6. Run sqlx migrate run to create our database tables

  7. Run cargo run (this runs Tailwind and TypeScript as part of the build process)

For live reload in development, install cargo-watch and run cargo watch -c -w src -x run.

About

A simple todo app created with HTMX and Rust.

License:MIT License


Languages

Language:Rust 92.1%Language:TypeScript 5.5%Language:JavaScript 2.0%Language:CSS 0.4%