archy
An async application framework for Rust with services, systems, and dependency injection.
Features
- Services - Actor-like components with message passing and automatic client generation
- Systems - Lifecycle hooks (startup, run, shutdown) with dependency injection
- Resources - Shared state accessible via
Res<T> - Events - Pub/sub broadcasting with
Emit<E>andSub<E> - Supervision - Configurable restart policies for fault tolerance
Installation
[]
= "0.1"
= { = "1", = ["full"] }
Quick Start
use ;
async
async
Core Concepts
Services
Services are actor-like components that process messages. Use #[derive(Service)] and #[service] to generate message handling:
use *;
Systems
Systems are async functions that run at specific lifecycle phases:
Schedule::First- Before services start (migrations, config validation)Schedule::Startup- After services start (cache warming)Schedule::Run- Background tasks that run until shutdownSchedule::Fixed(duration)- Periodic tasks (health checks, metrics)Schedule::Shutdown- Cleanup when shutting downSchedule::Last- Final cleanup after everything stops
use Duration;
async
async
async
app.add_system;
app.add_system;
app.add_system;
Resources
Shared state injected into services and systems:
let mut app = new;
app.add_resource;
// Systems receive resources automatically
async
Events
Fire-and-forget pub/sub broadcasting:
app.;
// Emit events
async
// Subscribe to events
async
License
Licensed under either of Apache License, Version 2.0 or MIT license at your option.