hero

A powerful and simple Rust web server framework

Get Started Donate

Simplicity First

With only basic knowledge of Rust, you can write a powerful and efficient server comparable to the development speed of some Go web server frameworks.

Powerful Features

Although it is simple, it is still powerful, with built-in Multipart, extract data from request, etc., which can meet the needs of most business scenarios.

Performance

Thanks to the performance advantages of Rust, you can write extremely high-performance server-side applications very easily.

Chainable tree router

Chainable tree routing system let you write routing rules easily and chains. You can use regex to constraint parameters.

Middlewares

Flexible plugin API, allowing plugins to provide lots of plug-and-play features for your site.

Stable after online

Rust's extremely secure mechanism allows you to have no worries after your website is online. You have more time to enjoy your life!

Hello world!

use salvo::prelude::*;

#[handler]
async fn hello() -> &'static str {
    "Hello World"
}

#[tokio::main]
async fn main() {
    tracing_subscriber::fmt().init();

    let router = Router::new().get(hello);
    let acceptor = TcpListener::new("127.0.0.1:5800").bind().await;
    Server::new(acceptor).serve(router).await;
}
[package]
name = "example-hello"
version = "0.1.0"
edition = "2021"
publish = false

[dependencies]
salvo.workspace = true
tokio = { version = "1", features = ["macros"] }
tracing = "0.1"
tracing-subscriber = "0.3"