Rust Web Framework
Build production-ready web applications with minimal code. Hotaru combines the performance of Rust with an API that just feels right.
use hotaru::prelude::*;
LServer!(APP = Server::new()
.binding("127.0.0.1:3000")
.build());
endpoint! {
APP.url("/"),
pub hello<HTTP> {
text_response("Hello, Hotaru!")
}
}
Why Hotaru
What you write is what you get. No hidden complexity, no surprising behaviors. Just clean, explicit Rust code.
HTTP, WebSocket, and custom TCP protocols. One framework, infinite possibilities.
Built-in Akari template engine for server-rendered HTML.
Request validation, body limits, and method whitelisting.
Async middleware with protocol-aware inheritance.
Flexible pattern matching with typed parameters.
Developer Experience
use hotaru::prelude::*;
use hotaru::http::*;
LServer!(APP = Server::new()
.binding("127.0.0.1:3000")
.build());
endpoint! {
APP.url("/"),
pub index<HTTP> {
text_response("Hello, World!")
}
}
#[tokio::main]
async fn main() {
APP.clone().run().await;
}
endpoint! {
APP.url("/users/<int:id>"),
pub get_user<HTTP> {
let user_id = req.pattern("id")
.unwrap_or("unknown".to_string());
json_response(object!({
id: user_id,
name: "Alice",
email: "alice@example.com"
}))
}
}
// GET /users/42 → {"id":"42","name":"Alice",...}
endpoint! {
APP.url("/profile"),
pub profile<HTTP> {
akari_render!(
"profile.html",
name = "Alice",
email = "alice@example.com",
posts = ["First post", "Second post"]
)
}
}
// Server-rendered HTML with type-safe templates
middleware! {
pub Logger<HTTP> {
let start = std::time::Instant::now();
let path = req.path().to_string();
let req = next(req).await?;
println!("[LOG] {} - {:?}",
path, start.elapsed());
Ok(req)
}
}
LServer!(APP = Server::new()
.binding("127.0.0.1:3003")
.single_protocol(
ProtocolBuilder::new(HTTP::server(HttpSafety::default()))
.append_middleware::<GlobalLogger>()
.append_middleware::<GlobalMetrics>()
)
.build());
Get started with Hotaru in seconds. One command is all it takes.
cargo add hotaru