AllFrame is a complete Rust web framework with a built-in HTTP/2 server, designed and evolved exclusively through TDD. Write your handler once and expose it via REST, GraphQL, and gRPC from a single codebase.
Quick Start
&&
# Visit http://localhost:8080/swagger-ui
Or add it as a dependency:
[]
= "0.1"
use *;
async
async
Crates
AllFrame ships as composable crates -- use only what you need:
| Crate | Description | |
|---|---|---|
allframe |
Re-exports core + CLI (allframe ignite) |
|
allframe-core |
Router, CQRS, DI, resilience, auth, security | |
allframe-macros |
Proc macros (#[handler], #[di_container], #[retry], ...) |
|
allframe-forge |
Project scaffolding & code generation | |
allframe-mcp |
MCP server -- expose handlers as LLM tools (zero overhead when unused) | |
allframe-tauri |
Tauri 2.x plugin for offline-first desktop apps |
Features at a Glance
Protocol-Agnostic Routing
async
78 tests across 5 phases. Full adapters for REST, GraphQL (async-graphql), and gRPC (tonic) with automatic schema generation (OpenAPI 3.1, GraphQL SDL, .proto).
CQRS + Event Sourcing
85% average boilerplate reduction with CommandBus, QueryBus, ProjectionRegistry, event versioning with auto-upcasting, and saga orchestration with automatic compensation. Pluggable backends: in-memory, SQLite, AllSource.
#[command], #[query], and #[event] macros generate real trait implementations at compile time:
async
Clean Architecture Enforcement
Layer dependency rules enforced at compile time via #[domain], #[repository], #[use_case], and #[handler] macros. Domain types that reference repository or handler types produce clear compile errors:
// No upper-layer deps allowed
// Can depend on repositories
Compile-Time DI
// Resolved at compile time -- zero runtime overhead
Resilience Patterns
Retry with exponential backoff, circuit breaker (per-resource with KeyedCircuitBreaker), rate limiting (token bucket, Redis-backed for distributed), adaptive retry, and retry budgets. Use the Clean Architecture ResilienceOrchestrator API:
let orchestrator = new;
let policy = Retry ;
let result = orchestrator.execute_with_policy.await;
Note: The
#[retry],#[circuit_breaker], and#[rate_limited]attribute macros are deprecated since 0.1.13. See the migration guide for the new Clean Architecture approach.
MCP Server (LLM Tool Calling)
Handlers automatically become Model Context Protocol tools. Zero overhead when not used -- opt-in via a separate crate.
let mcp = with_router;
let result = mcp.call_tool.await;
allframe-mcp docs | MCP distribution model
Layered Authentication
Protocol-agnostic auth with zero-bloat feature flags: core Authenticator trait, JWT validation (HS256, RS256, EdDSA), Axum extractors/middleware, gRPC interceptors, and type-safe AuthContext<C>.
Security Utilities
URL/credential obfuscation, Sensitive<T> wrapper, #[derive(Obfuscate)] with #[sensitive] field attributes, smart header obfuscation.
API Documentation
Auto-generated interactive docs for all protocols:
- Scalar UI for REST (10x smaller than Swagger) -- guide
- GraphiQL 3.0 playground for GraphQL -- guide
- gRPC Explorer for service discovery -- example
Offline-First Architecture
SQLite event store, offline circuit breaker with operation queuing, store-and-forward for intermittent connectivity, bidirectional projection sync with conflict resolution. Zero network dependencies in offline builds, enforced by CI.
Streaming Handlers
StreamSender with backpressure and cooperative cancellation. Tauri IPC bridge with per-stream events. TypeScript codegen with RxJS adapter.
Contract Testing
Automatic test generation from router, schema validation, breaking change detection, and coverage reporting.
Graceful Shutdown
ShutdownAwareTaskSpawner for named tasks with automatic cancellation, GracefulShutdownExt for cleanup orchestration.
Feature Flags
Start minimal and add features as needed. Detailed guide: docs/guides/FEATURE_FLAGS.md
| Feature | Description | Default |
|---|---|---|
router |
Protocol-agnostic routing | yes |
di |
Compile-time dependency injection | yes |
openapi |
Auto OpenAPI 3.1 + Scalar UI | yes |
cqrs |
CQRS + Event Sourcing | yes |
otel |
OpenTelemetry tracing | yes |
health |
Health check endpoints | yes |
router-graphql |
GraphQL via async-graphql | -- |
router-grpc |
gRPC via tonic | -- |
router-full |
GraphQL + gRPC | -- |
resilience |
Retry, circuit breaker, rate limiting | -- |
resilience-redis |
Distributed rate limiting | -- |
auth / auth-jwt / auth-axum / auth-tonic |
Layered auth | -- |
security |
Safe logging, obfuscation | -- |
cqrs-sqlite |
SQLite event store | -- |
offline |
Full offline bundle | -- |
vector-search |
Vector similarity search | -- |
keyword-search |
Full-text BM25 search | -- |
# Minimal REST API
= { = "0.1", = false, = ["router"] }
# Full multi-protocol gateway
= { = "0.1", = ["router-full", "resilience", "auth-jwt"] }
Examples
See examples/README.md for details.
Why AllFrame?
| AllFrame | Actix | Axum | Rocket | |
|---|---|---|---|---|
| Protocol-agnostic handlers | yes | -- | -- | -- |
| Built-in CQRS + Event Sourcing | yes | -- | -- | -- |
| Compile-time DI | yes | -- | -- | -- |
| Auto OpenAPI 3.1 | yes | manual | manual | manual |
| Resilience patterns | yes | ext | ext | -- |
| MCP server (LLM tools) | yes | -- | -- | -- |
| Offline-first / Tauri | yes | -- | -- | -- |
| Streaming handlers | yes | -- | -- | -- |
| Contract testing | yes | -- | -- | -- |
| TDD from day zero | yes | -- | -- | -- |
Documentation
| API Reference (docs.rs) | Generated Rust API docs |
| Project Docs (GitHub Pages) | Guides, architecture, announcements |
| Project Status | Current status and metrics |
| Roadmap | Path to v1.0 |
| Feature Flags Guide | Minimize binary size |
| Documentation Index | Full catalog |
CQRS Deep Dives
- Phase 1: AllSource Integration
- Phase 2: CommandBus (90% reduction)
- Phase 3: ProjectionRegistry
- Phase 4: Event Versioning (95% reduction)
- Phase 5: Saga Orchestration
Contributing
AllFrame is 100% TDD-driven. Every commit must contain at least one new failing test.
- Read the PRD
- Ensure 100% test coverage for all changes
- Follow the Clean Architecture Guide
License
Licensed under either of Apache License 2.0 or MIT, at your option.