{{ partial "header" . }}

A powerful, pragmatic, and extremely fast web framework for Rust

Get Started

## Type Safe

Forget about stringly typed objects, from request to response, everything has types.

## Feature Rich

Actix provides a lot of features out of box. HTTP/2, logging, etc.

## Extensible

Easily create your own libraries that any Actix application can use.

## Blazingly Fast

Actix is blazingly fast. Don't take our word for it -- see for yourself!

{{ highlight `use actix_web::{web, App, HttpRequest, HttpServer, Responder}; async fn greet(req: HttpRequest) -> impl Responder { let name = req.match_info().get("name").unwrap_or("World"); format!("Hello {}!", &name) } #[actix_web::main] async fn main() -> std::io::Result<()> { HttpServer::new(|| { App::new() .route("/", web::get().to(greet)) .route("/{name}", web::get().to(greet)) }) .bind(("127.0.0.1", 8080))? .run() .await }` "rust" "" }}

## Flexible Responders

Handler functions in actix can return a wide range of objects that implement the `Responder` trait. This makes it a breeze to return consistent responses from your APIs.

{{ highlight `#[derive(Serialize)] struct Measurement { temperature: f32, } async fn hello_world() -> impl Responder { "Hello World!" } async fn current_temperature() -> impl Responder { web::Json(Measurement { temperature: 42.3 }) }` "rust" "" }}

## Powerful Extractors

Actix comes with a powerful extractor system that extracts data from the incoming HTTP request and passes it to your view functions. Not only does this make for a convenient API but it also means that your view functions can be synchronous code and still benefit from asynchronous IO handling.

{{ highlight `#[derive(Deserialize, Serialize)] struct Event { id: Option, timestamp: f64, kind: String, tags: Vec, } async fn capture_event(evt: web::Json) -> impl Responder { let new_event = store_in_db(evt.timestamp, &evt.kind, &evt.tags); format!("got event {}", new_event.id.unwrap()) }` "rust" "" }}

## Easy Form Handling

Handling multipart/urlencoded form data is easy. Just define a structure that can be deserialized and actix will handle the rest.

{{ highlight `#[derive(Deserialize)] struct Register { username: String, country: String, } async fn register(form: web::Form) -> impl Responder { format!("Hello {} from {}!", form.username, form.country) }` "rust" "" }}

## Request Routing

An actix app comes with a URL routing system that lets you match on URLs and invoke individual handlers. For extra flexibility, scopes can be used.

{{ highlight `#[get("/")] async fn index(_req: HttpRequest) -> impl Responder { "Hello from the index page!" } async fn hello(path: web::Path) -> impl Responder { format!("Hello {}!", &path) } let app = App::new() .service(index) .route("/{name}", web::get().to(hello)); ` "rust" "" }}

- flexible responders
- powerful extractors
- easy form handling
- request routing

{{ partial "footer" . }}