Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WebR Logo

中文 · Document

WebR brings the developer experience of Spring Boot to the Rust ecosystem — macro-driven controllers, automatic dependency injection, ORM and cache, configuration management, and a built-in middleware system, all built on top of Axum.

use webr::prelude::*;

#[controller]
pub struct HelloController;

#[controller]
impl HelloController {
    #[get("/")]
    async fn index(&self) -> String {
        "hello world".to_string()
    }
}

#[webr::main]
async fn main(_app: &mut AppBuilder) -> Result<()> {
    Ok(())
}

If everything goes well, visit http://localhost:8080 and you will see hello world.

Documentation

Full documentation is available at WebR Document.

Examples

The examples directory contains some example projects that you can use to quickly get familiar with WebR.

Example Description
hello-world Controllers, DI, config binding, unified response
middleware Custom auth middleware, path-scoped routing, CORS
file-upload Multi-file upload, file download, inline preview
sse Server-Sent Events streaming
orm Entity CRUD, #[sql] dynamic queries, #[tx] transactions
cache Cache module usage
axum-bench Raw axum vs WebR performance benchmark

Run an example:

cd examples/hello-world
cargo run

Project Structure

webr/
├── crates/
│   ├── webr-core/        # Core primitives: DI, config, context, Inject, Error
│   ├── webr-web/         # Web layer: AppBuilder, extractors, middleware, response, router
│   ├── webr-db/          # Database: connection pool, transactions, ORM support
│   ├── webr-cache/       # Cache: Memory / Sled / Redis backends
│   ├── webr-macros/      # Procedural macros: controller, component, config, entity, sql, tx, HttpError
│   └── webr-middleware/  # Middleware: authentication, authorization, request body caching
├── examples/             # Example applications
└── src/lib.rs            # Umbrella crate, unified re-export of all public APIs

License

Apache 2.0

About

WebR brings the developer experience of Spring Boot to the Rust ecosystem — macro-driven controllers, automatic dependency injection, configuration management, and a built-in middleware system, all built on top of Axum.

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages