HTMXOLOGY
A type-safe, full-stack web framework for Rust that brings together the power of HTMX and Axum for server-side rendering.
Why HTMXOLOGY?
HTMXOLOGY makes building interactive web applications with HTMX in Rust a joy. It provides:
- Type-safe routing - Routes are Rust enums, eliminating typos and broken links
- Compile-time guarantees - Know your routes work before running your app
- Zero-cost abstractions - Macros generate efficient code with no runtime overhead
- First-class HTMX support - Built-in helpers for HTMX attributes and responses
- Flexible architecture - Compose controllers for clean, maintainable code
Quick Start
Add HTMXOLOGY to your Cargo.toml:
[]
= { = "0.18", = ["full"] }
= { = "1", = ["full"] }
Create a simple app:
use ;
// Define your routes as an enum
// Implement a controller
;
async
Key Features
Type-Safe Routes
Routes are defined as Rust enums, making your routing logic type-safe and refactor-friendly:
// Generate URLs with Display
let url = Post.to_string; // "/posts/42"
// Use in HTMX templates
let attr = Search.as_htmx_attribute; // hx-get="/search?q=..."
Composable Controllers
Build modular applications with nested controllers:
HTMX Integration
First-class support for HTMX features:
// Access HTMX headers
if htmx.is_htmx_request else
// Generate HTMX attributes from routes
Post.as_htmx_attribute // "hx-get=\"/posts/42\""
// Type-safe HTML IDs
let id = new;
Built-in Caching
Add caching to any controller:
use ;
let cached_controller = my_controller.with_cache;
Templating Support
Integrate with Askama templates:
// Use RenderIntoResponse trait
Feature Flags
derive- Enable derive macros (Route, DisplayDelegate, RoutingController)templating- Askama template integrationauto-reload- Development hot-reload supportinterfaces- Network interface detectionws- WebSocket supportfull- Enable all features
Examples
Check out the examples directory for complete applications:
blocks- Component-based UI with HTMXcomponents- Reusable component patterns
Run an example:
Documentation
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for details.
License
Licensed under the MIT License. See LICENSE-MIT for details.