This is a web application built with Rust with Axum and HTMX. It provides a set of APIs for managing cats and user authentication.
The backend of this application is built with Rust using the Axum framework. Axum is a blazingly fast web application framework.
We use LibSQL (fork of SQLite) for the database, which is accessed using the libsql
crate. For environment variable management, we use the dotenv
crate.
For templating, we use the Sailfish template engine. Sailfish is a fast and minimalistic template engine for Rust. It's designed to be simple.
The frontend of this application is built using HTMX for dynamic HTML content. HTMX allows us to access modern browser features directly from HTML, without requiring a separate JavaScript framework by swapping out HTML from the server response.
PicoCSS was used for styling.
The project is organized into several directories:
src/
: Contains the Rust source code for the server.frontend/
: Contains the frontend code written in TypeScript.templates/
: Contains the server-side templates.
- Clone the repository:
git clone <repository-url>
- Navigate to the root directory:
cd rust-axum-htmx-example/
- Set the environment variable in the .env file:
SERVER_URL=IP:PORT
SECRET=secret
- Install the dependencies:
cargo build
- Run the server:
cargo run
- Navigate to the frontend directory:
cd rust-axum-htmx-example/frontend
- Install the dependencies:
pnpm install
- Run the frontend:
pnpm dev
As we can see all basic CRUD operations + template rendering is blazingly fast and so is the auth part.