22 releases

0.1.21 Nov 30, 2024
0.1.20 Nov 22, 2024

#273 in Rust patterns

Download history 13/week @ 2024-09-23 2/week @ 2024-11-04 1968/week @ 2024-11-18 171/week @ 2024-11-25 12/week @ 2024-12-02 53/week @ 2024-12-09

2,204 downloads per month

Fair license

23KB
320 lines

Heart

A Rust-based web stack combining powerful libraries for building modern, efficient web applications.

Components

  • Warp: High-performance HTTP server with filter-based routing
  • Maud: Compile-time HTML templating
  • HTMX: Modern web interactions without complex JavaScript
  • TiKV: Distributed, strongly consistent key-value store

Installation

Add to your Cargo.toml:

[dependencies]
heart = "0.1.20"

Example

use tokio;
use heart::prelude::*;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    tracing_subscriber::fmt::init();

    let route = warp::path("hello")
        .map(|| {
            let markup = html! {
                h1 { "Hello, Heart Stack!" }
                p { "This is a tiny example." }
            };

            info!("Serving hello route");

            Response::builder()
                .header("Content-Type", "text/html")
                .body(markup.into_string())
        });

    info!("Starting server on http://localhost:3030");
    warp::serve(route)
        .run(([127, 0, 0, 1], 3030))
        .await;
    Ok(())
}

Contributions

Contributions are welcome! Please follow Kant's categorical imperative.

License

Fair License (2024)

Copyright (c) 2024 Lukáš Hozda

Usage of the software is PERMITTED, modification and redistribution are PERMITTED, 
however all versions of the derived code MUST be clearly marked as such 
and NOT represented as the original software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND.

Dependencies

~24–38MB
~719K SLoC