Sauron Save

A versatile web framework and library for building client-side and server-side web applications

Project README



Latest Version Build Status MIT licensed


Sauron is a versatile web framework and library for building client-side and/or server-side web applications with strong focus on ergonomics, simplicity and elegance. This allows you to write least amount of code possible, and focus more on the business logic rather than the inner details of the framework.

Sauron is inspired by elm-lang and is following The Elm Architecture.


  • server-side rendering
  • static site generation
  • progressive rendering
  • web components / custom-element
  • html syntax for writing views
  • elegant macro to write styles
  • batteries included

Devoid of unnecessary framework complexities

  • no framework specific cli needed
  • no template specific language as everything is in rust.
    • Model and update function is all in rust.
    • view? in rust
    • events handling? rust
    • styling? believe it or not: rust

In a sauron application, there is only the model, view and update. The model is your application state. The view describes how to present the model to the user. The update function describes how to update the model, this uses message which contains the data needed for updating the model.

Counter example

In your src/

use sauron::{
    html::text, html::units::px, jss, node, wasm_bindgen, Application, Cmd, Node, Program,

enum Msg {

struct App {
    count: i32,

impl App {
    fn new() -> Self {
        App { count: 0 }

impl Application for App {

    type MSG = Msg;

    fn view(&self) -> Node<Msg> {
        node! {
                <input type="button"
                    on_click=|_| {
                <button class="count" on_click=|_|{Msg::Reset} >{text(self.count)}</button>
                <input type="button"
                    on_click=|_| {

    fn update(&mut self, msg: Msg) -> Cmd<Msg> {
        match msg {
            Msg::Increment => self.count += 1,
            Msg::Decrement => self.count -= 1,
            Msg::Reset => self.count = 0,

    fn stylesheet() -> Vec<String> {
        vec![jss! {
                font_family: "verdana, arial, monospace",

                width: px(30),
                height: px(100),
                margin: "auto",
                text_align: "center",

            "input, .count":{
                font_size: px(40),
                padding: px(30),
                margin: px(30),

pub fn start() {


<!doctype html>
    <meta content="text/html;charset=utf-8" http-equiv="Content-Type"/>
    <script type=module>
        import init from './pkg/counter.js';
        await init().catch(console.error);

In Cargo.toml, specify the crate-type to be cdylib

name = "counter"
version = "0.1.0"
edition = "2021"

crate-type = ["cdylib"]

sauron = "0.61.0"


cargo install wasm-pack
cargo install basic-http-server

Build using

wasm-pack build --target web --release

Serve using

basic-http-server -a

Then navigate to http://localhost:4000

Head over to the for the full tutorial.

For more details on the commands to build and serve, look on examples on this repo, each has scripts on how to build and run them.

Demo examples

  • todomvc The todomvc example
  • data-viewer - A resizable spreadsheet CSV data viewer
  • svg-clock - A clock drawn using SVG and window tick event.
  • ultron code-editor - A web-base text-editor with syntax highlighting
  • hackernews-sauron - A hackernews clone showcasing the feature of sauron to write web applications that can work with or without javascript.

License: MIT

Open Source Agenda is not affiliated with "Sauron" Project. README Source: ivanceras/sauron
Open Issues
Last Commit
1 month ago

Open Source Agenda Badge

Open Source Agenda Rating