GithubHelp home page GithubHelp logo

"We don't want to lose time and money due to millions of unnecessary technical micro-decisions."


MoonZoon is a Rust Fullstack Framework to build Web and Desktop apps with Multithreading and Durable Computing. No HTML, CSS or JS needed.


Code example

use zoon::*;

fn main() {
    start_app("app", root);
}

static COUNTER: Lazy<Mutable<i32>> = lazy::default();

fn root() -> impl Element {
    Row::new()
        .s(Align::center())
        .s(Gap::new().x(15))
        .item(counter_button("-", -1))
        .item_signal(COUNTER.signal())
        .item(counter_button("+", 1))
}

fn counter_button(label: &str, step: i32) -> impl Element {
    let (hovered, hovered_signal) = Mutable::new_and_signal(false);
    Button::new()
        .s(Width::exact(45))
        .s(RoundedCorners::all_max())
        .s(Background::new()
            .color_signal(hovered_signal.map_bool(|| color!("#edc8f5"), || color!("#E1A3EE", 0.8))))
        .s(Borders::all(
            Border::new()
                .width(2)
                .color(color!("oklch(0.6 0.182 350.53 / .7")),
        ))
        .on_hovered_change(move |is_hovered| hovered.set(is_hovered))
        .label(label)
        .on_press(move || *COUNTER.lock_mut() += step)
}

Demos

New Project Template on Netlify | Template

Chat


Create & Run project

  1. Install the latest stable Rust. (Or upgrade with rustup update stable.)

  2. Install the web assembly target rustup target add wasm32-unknown-unknown

  3. cargo install mzoon --git https://github.com/MoonZoon/MoonZoon --locked

  4. mzoon new my_counter

  5. cd my_counter

  6. mzoon start --open

    mzoon start --open


Deploy project

Both Frontend & Backend

I use Coolify on Hetzner with this Dockerfile:

FROM rust:1
WORKDIR /app

RUN rustup target add wasm32-unknown-unknown
# NOTE: Set `--rev` to the commit you use in your project
RUN --mount=type=cache,target=/usr/local/cargo,from=rust,source=/usr/local/cargo \
    cargo install mzoon --git https://github.com/MoonZoon/MoonZoon --rev ccc15d043e78a6656d68a60d46de1f540724e093 --locked

COPY . .

RUN --mount=type=cache,target=/usr/local/cargo,from=rust,source=/usr/local/cargo \
    --mount=type=cache,target=target \
    /usr/local/cargo/bin/mzoon build -r

RUN --mount=type=cache,target=target \
    ["cp", "./target/release/backend", "/usr/local/bin/moon_app"]

ENTRYPOINT ["moon_app"]

MoonZoon app was successfully deployed to other services like Heroku (buildpack), Clever Cloud, CapRover or Fly.io.

Frontend-only

  1. mzoon build --release --frontend-dist netlify

    • Hosting name (netlify) is optional. It creates files like netlify.toml.
  2. [optional] Test it with a dev server like miniserve:

    cargo install miniserve
    
    miniserve --port 8079 --index index.html --spa frontend_dist
  3. Drag & drop the frontend_dist directory to Netlify.

    moonzoon-new-project on Netlify


Examples


Blog

Dev News

  1. CLI, Build pipeline, Live-reload, HTTPS [dev.to / MD]

  2. Live demo, Zoon, Examples, Architectures [dev.to / MD]

  3. Signals, React-like Hooks, Optimizations [dev.to / MD]

  4. Actix, Async CLI, Error handling, Wasm-pack installer [dev.to / MD]

  5. Chat example, MoonZoon Cloud [dev.to / MD]


Documentation

2. Frontend.md

3. Backend.md

4. CLI.md


Size & Speed

Benchmark example size

Benchmark example speed


Sponsors

Logo NLnet

Logo GitHub Sponsors


Thank you for reading! We are waiting for you on Discord.

MoonZoon's Projects

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.