Cruxi
A minimal, transport-agnostic hexagonal architecture framework for Rust.
Cruxi implements the Ports & Adapters pattern with a 4-layer architecture:
┌──────────────────────────────────────┐
│ INBOUND TRANSPORTS │
│ (HTTP, gRPC, MQTT, TCP) │
└──────────────────────────────────────┘
↓
┌──────────────────────────────────────┐
│ HANDLER (Inbound Adapter) │
│ • Receives requests │
│ • Validates transport format │
│ • Delegates to Service │
└──────────────────────────────────────┘
↓
┌──────────────────────────────────────┐
│ SERVICE (Application Layer) │
│ • Business logic orchestration │
│ • Authorization checks │
│ • Coordinates Repositories │
└──────────────────────────────────────┘
↓
┌──────────────────────────────────────┐
│ REPOSITORY (Domain Layer) │
│ • Domain validation │
│ • Transactional integrity │
│ • Calls Providers │
└──────────────────────────────────────┘
↓
┌──────────────────────────────────────┐
│ PROVIDER (Infrastructure) │
│ • Database I/O │
│ • HTTP API calls │
│ • Message queues │
└──────────────────────────────────────┘
Design Principles
- Zero external dependencies in the core (only std + thiserror)
- Generic type safety via trait generics on Req/Resp
- Pattern matching for all control flow and error handling
- No
.unwrap()- explicit error handling throughout
Features
async- Enables async trait variants (requiresasync-trait)