#tower #web #web-framework


Web framework with a focus on removing boilerplate

15 unstable releases (3 breaking)

Uses old Rust 2015

0.3.7 Apr 10, 2019
0.3.6 Mar 13, 2019
0.3.5 Feb 25, 2019
0.3.3 Nov 18, 2018
0.0.0 Mar 11, 2018

#451 in HTTP server

Download history 67/week @ 2022-11-29 124/week @ 2022-12-06 116/week @ 2022-12-13 132/week @ 2022-12-20 74/week @ 2022-12-27 62/week @ 2023-01-03 118/week @ 2023-01-10 92/week @ 2023-01-17 154/week @ 2023-01-24 160/week @ 2023-01-31 93/week @ 2023-02-07 154/week @ 2023-02-14 128/week @ 2023-02-21 90/week @ 2023-02-28 115/week @ 2023-03-07 90/week @ 2023-03-14

447 downloads per month
Used in 5 crates

MIT license

11K SLoC

Tower Web

A web framework for Rust with a focus on removing boilerplate.

Build Status License: MIT Crates.io Gitter

API Documentation

Tower Web is:

  • Fast: Fully asynchronous, built on Tokio and Hyper.
  • Ergonomic: Tower-web decouples HTTP from your application logic, removing all boilerplate.
  • Works on Rust stable: You can use it today.

Hello World

extern crate tower_web;
extern crate tokio;

use tower_web::ServiceBuilder;
use tokio::prelude::*;

/// This type will be part of the web service as a resource.
#[derive(Clone, Debug)]
struct HelloWorld;

/// This will be the JSON response
struct HelloResponse {
    message: &'static str,

impl_web! {
    impl HelloWorld {
        fn hello_world(&self) -> Result<HelloResponse, ()> {
            Ok(HelloResponse {
                message: "hello world",

pub fn main() {
    let addr = "".parse().expect("Invalid address");
    println!("Listening on http://{}", addr);



Tower Web aims to decouple all HTTP concepts from the application logic. You define a "plain old Rust method" (PORM?). This method takes only the data it needs to complete and returns a struct representing the response. Tower Web does the rest.

The impl_web macro looks at the definition and generates the glue code, allowing the method to respond to HTTP requests.

Getting Started

The best way to get started is to read the examples and API docs.


This project is licensed under the MIT license.


Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in tower-web by you, shall be licensed as MIT, without any additional terms or conditions.


~387K SLoC