Quick Start

use armature::prelude::*;

// Injectable service
#[injectable]
#[derive(Default, Clone)]
struct UserService;

impl UserService {
    fn get_users(&self) -> Vec<String> {
        vec!["Alice".to_string(), "Bob".to_string()]
    }
}

// Controller with routes
#[controller("/api")]
#[derive(Default, Clone)]
struct UserController;

impl UserController {
    #[get("/users")]
    async fn list() -> Result<Json<Vec<String>>, Error> {
        Ok(Json(vec!["Alice".to_string(), "Bob".to_string()]))
    }
}

// Module wires everything together
#[module(
    providers: [UserService],
    controllers: [UserController]
)]
#[derive(Default)]
struct AppModule;

#[tokio::main]
async fn main() {
    let app = Application::create::<AppModule>().await;
    app.listen(3000).await.unwrap();
}

Installation

RECOMMENDED

Using Armature CLI

The CLI provides code generation, project scaffolding, and a development server with hot reloading.

# Install the CLI
cargo install armature-cli

# Create a new project
armature new my-api

# Navigate and start development
cd my-api
armature dev

Your server is now running at http://127.0.0.1:3000 with automatic rebuilding on file changes.

Generate Code

# Generate a controller
armature generate controller users

# Generate a service
armature generate service users

# Generate a complete resource (controller + service + module)
armature generate resource products --crud

# Generate middleware and guards
armature generate middleware auth
armature generate guard admin

Manual Setup

Or add Armature directly to an existing project:

[dependencies]
armature = "0.1"
tokio = { version = "1.35", features = ["full"] }

Run your app

# With CLI (recommended)
armature dev

# Or with cargo
cargo run

Your server is now running at http://127.0.0.1:3000

Next Steps

๐Ÿ“– Read the Documentation

Explore comprehensive guides covering all framework features.

Browse Documentation โ†’

๐Ÿ’ป Browse Examples

Check out 30+ working examples covering all features.

See Code Examples โ†’

๐Ÿ” Add Authentication

Integrate JWT, OAuth2, or SAML authentication in minutes.

Learn Authentication โ†’

๐Ÿ”ฅ Real-time Features

Add WebSockets and Server-Sent Events for live updates.

Real-time Guide โ†’

โ™ป๏ธ Lifecycle Hooks

Manage resources with NestJS-inspired lifecycle hooks.

Lifecycle Management โ†’

๐Ÿ“Š Logging & Observability

Structured logging with tracing, metrics, and OpenTelemetry.

Setup Logging โ†’