[][src]Crate contraband

Contraband is a web framework for building modular applications in Rust with dependency injection and performant higher-level abstractions. It is build on top of actix-web.

Contraband is heavily inspired by Spring Boot and Nestjs.

Example

use contraband::{Injectable, controller, module};
use contraband::core::ContrabandApp;
use actix_web::HttpResponse;

#[derive(Clone, Injectable)]
struct HelloController;

#[controller]
impl HelloController {
    #[get]
    async fn hello_world(self) -> HttpResponse {
        HttpResponse::Ok().body("Hello world!")
    }
}

#[module]
#[controller(HelloController)]
struct HelloModule;

#[contraband::main]
async fn main() -> std::io::Result<()> {
    ContrabandApp::new()
        .start::<HelloModule>()
        .await
}

Documentation & community resources

Modules

config
core
graph
log
module

Structs

Runtime

System is a runtime manager.

Attribute Macros

controller

Generates a controller.

main
module
test

Derive Macros

Injectable

Derives the Injectable trait for dependency injection.