Stunt - A Modern Client-Side Web Framework

⚓ Rust    📅 2025-09-07    👤 surdeus    👁️ 1      

surdeus

stunt_logo

Stunt - A modern client-side web framework for developing reactive user interfaces.

Hey there, for the last few months i've been working on stunt, a client-side web framework for Rust. Stunt is designed to be efficient, type checked, and small (only 2.3k loc at the time of writing).

Features:

  • Macro for writing html with rust expressions, similar to that of JSX.
  • Client-side router implementation.
  • Highly extensible components with compile-time type checked properties.
  • Tons of examples.

Example:

More examples can be found at examples.

use stunt::prelude::*;

pub enum Message {
    Add,
}

pub struct App {
    count: usize,
}

impl Component for App {
    type Message = Message;
    type Properties = ();

    fn create() -> App {
        App {
            count: 0,
        }
    }

    fn callback(&mut self, message: &Message) {
        match message {
            Message::Add => {
                self.count += 1;
            },
        }
    }

    fn view(&self, _: ()) -> Html {
        html! {
            <div>
                <button onclick={ Message::Add } >
                    { "increment" }
                </button>
                <h1>
                    { self.count }
                </h1>
            </div>
        }
    }
}

fn main() {
    Renderer::new::<App>().render();
}

I'd highly appreciate any feedback or suggestions.

1 post - 1 participant

Read full topic

🏷️ Rust_feed