Skip to main content
Actix Web Logo

Actix Web is a powerful, pragmatic, and extremely fast web framework for Rust

Strong Type Safety

Typed requests and responses make handler contracts explicit.

Batteries Included

Get started fast with an extensive first-party ecosystem.

Trusted in Production

Over 80 million downloads and counting.

Built for Performance

High throughput. Low latency. Tiny memory requirements.
Verified by independent benchmarks.

Hello, World!

Start with a route and a handler. Actix Web matches incoming requests to your routes by path and method, then calls the right handler to build a response.

use actix_web::{get, web, App, HttpServer, Responder};

#[get("/")]
async fn index() -> impl Responder {
"Hello, World!"
}

#[get("/{name}")]
async fn hello(name: web::Path<String>) -> impl Responder {
format!("Hello {}!", &name)
}

#[actix_web::main]
async fn main() -> std::io::Result<()> {
HttpServer::new(|| App::new().service(index).service(hello))
.bind(("127.0.0.1", 8080))?
.run()
.await
}

Powerful Extractors

Just ask for what you need. Extractors turn request data into ready-to-use types, just by adding a function parameter.

From JSON and query parameters to typed headers and file uploads, the parsing is handled for you. Less boilerplate. Cleaner handlers.

#[derive(Deserialize, Serialize)]
struct Event {
id: i32,
timestamp: f64,
kind: String,
tags: Vec<String>,
}

async fn capture_event(
db: web::Data<DatabaseHandle>,
event: web::Json<Event>,
) -> impl Responder {
let new_event = store_in_db(&db, &event).await;
format!("Received event id={}", new_event.id)
}

Batteries Included

The Actix Web team maintains a whole ecosystem of flexible and high quality crates for building real apps. Get off the ground without reinventing the things you expect to be there.

Add the crates your application needs, with documentation and examples to get you started.

let tls_config = rustls::ServerConfig::builder()
.with_no_client_auth()
.with_single_cert(tls_certs, private_key)
.unwrap();

HttpServer::new(|| {
App::new().route("/", web::get().to(index))
})
.bind_rustls_0_23(("127.0.0.1", 8443), tls_config)?
.run()
.await

It's Fast (Blazing Fast)

Actix Web tops benchmarks on high- and low-resource machines.

The unique architecture keeps tail latencies low while providing massive throughput on your workloads.

1M+ requests / s

10 MiBtiny memory overhead