DEV Community

Alex Spinov
Alex Spinov

Posted on

Leptos Has a Free Rust Framework That Builds React-Like Apps — With Zero JavaScript

The Frontend Problem

React ships 40KB+ of JavaScript. Vue ships 30KB+. Svelte compiles away the framework, but you still ship JavaScript.

Leptos compiles to WebAssembly. Your frontend runs at near-native speed. The framework itself? ~15KB gzipped WASM.

What Leptos Gives You

Reactive Signals (Like SolidJS, But in Rust)

use leptos::*;

#[component]
fn Counter() -> impl IntoView {
    let (count, set_count) = signal(0);

    view! {
        <button on:click=move |_| set_count.update(|n| *n += 1)>
            "Count: " {count}
        </button>
    }
}
Enter fullscreen mode Exit fullscreen mode

Fine-grained reactivity. No virtual DOM. No diffing. Direct DOM updates.

Server-Side Rendering Built In

#[server(GetPosts)]
async fn get_posts() -> Result<Vec<Post>, ServerFnError> {
    // This runs on the server — database access, secrets, etc.
    let posts = db::get_all_posts().await?;
    Ok(posts)
}

#[component]
fn PostList() -> impl IntoView {
    let posts = create_resource(|| (), |_| get_posts());

    view! {
        <Suspense fallback=|| view! { <p>"Loading..."</p> }>
            {move || posts.get().map(|posts| {
                posts.iter().map(|p| view! { <h2>{&p.title}</h2> }).collect_view()
            })}
        </Suspense>
    }
}
Enter fullscreen mode Exit fullscreen mode

Same component renders on server AND client. Hydration is automatic.

Type Safety Everywhere

Rust's compiler catches:

  • Null pointer dereferences → Option<T>
  • Missing error handling → Result<T, E>
  • Data races → ownership system
  • Typos in component props → compile-time type checking

Your frontend has the same safety guarantees as your backend.

Quick Start

cargo install cargo-leptos
cargo leptos new --git leptos-rs/start-axum
cd my-app
cargo leptos watch
Enter fullscreen mode Exit fullscreen mode

Why This Matters

WebAssembly isn't just for performance-critical code anymore. Leptos proves that entire web apps can run faster, use less memory, and catch more bugs — all by using Rust instead of JavaScript.


Need data for your Rust web apps? Check out my web scraping actors on Apify Store — structured data via API. For custom solutions, email spinov001@gmail.com.

Top comments (0)