Feather is a lightweight, DX-first web framework for Rust. inspired by the simplicity of Express.js, but designed for Rust’s performance and safety.
Why Feather?
-
Middleware-First Architecture
Everything is a middleware even if they are not a middleware they produce a middleware in the end. -
Easy State Management Using Context
Recently implemented the Context API that makes it very easy to manage state without the use of Extractors/Macros. -
All in One
Feather is a complete web framework that includes routing, middleware, logging, JWT authentication, and more, all in one package. -
Feel of Async Without Async
Feather is Multithreaded by default running on Feather-Runtime.
How it works behind the scenes:
Every request is given a thread from the server's threadpool and that thread is responsible for returning the response to that request.
So you can run long running tasks on another thread in the middlewares, but the response can only be returned from the middleware the request is accepted on.
If you want to go deeper take a look at Feather-Runtime
Getting Started
Add Feather to your Cargo.toml:
[]
= "~0.4"
Quick Example
use builtins;
use ;
use ;
That’s all — no async.
Middleware in Feather
Middleware is intented to be the heart of Feather. You may write it as a closure, a struct, or chain them together:
use ;
use builtins;
use ;
// Implementors of the Middleware trait are middleware that can be used in a Feather app.
;
State Management using the Context API
Feather's new Context API allows you to manage application-wide state without extractors or macros.
As an example:
use ;
// Create a counter struct to hold the state
Context is especially useful when needing to access databases and files.
Built-in JWT Authentication
Feather has a native JWT module activated using a cargo feature jwt:
[]
= { = "0.3.1", = ["jwt"] }
use ;
use ;
Goals
- Being the simplest Rust web framework to get started with
- Being modular and easy to extend
- Focusing on DX without sacrificing Rust's safety and performance
Contributing
PRs are welcome!
If you have ideas or bugs, please open an issue or submit a pull request.
# Getting started with dev
License
Feather is MIT licensed. See LICENSE.
Acknowledgments
Feather is inspired by Express.js and exists to bring that same productivity to Rust.
Huge thanks to the Rust community for their support and contributions!
Special thanks to the contributors who have helped make Feather better!
Spread the Word
If you like Feather:
- ⭐ Star it on GitHub,
- Share it on Reddit, HN, or Discord
- Build something and show up!