Skip to main content

Introduction & Ferrox Crate Architecture

Welcome to Ferrox, the enterprise-grade Rust web framework designed for building ultra-resilient microservices, multi-protocol API gateways, high-frequency real-time applications, and WebAssembly frontend clients.


1. What It Is & Architectural Purpose​

Building production-ready software in Rust requires assembling multiple asynchronous crates: web servers (Axum / Hyper), ORMs (SeaORM), security modules, resilience tools, and logging engines. Without a unified framework, developers spend significant time configuring boilerplate code and managing dependency compatibility.

Ferrox provides a modular suite of 35+ specialized Rust crates. It delivers NestJS-style dependency injection ergonomics, zero-copy performance, end-to-end type safety, and production observability out of the box.

┌────────────────────────────────────────────────────────────────────────────────────────┐
│ YOUR FERROX APP │
├────────────────────────────────────────────────────────────────────────────────────────┤
│ ferrox-app │ ferrox-cqrs │ ferrox-sentinel │ ferrox-transports │ ferrox-sync │
├──────────────┴───────────────┴───────────────────┴─────────────────────┴───────────────┤
│ FERROX FRAMEWORK KERNEL │
├────────────────────────────────────────────────────────────────────────────────────────┤
│ Tokio Async Runtime │ Hyper HTTP / Axum │ SeaORM Database │ Pino / Tracing Logs │
└────────────────────────────────────────────────────────────────────────────────────────┘

2. Comprehensive Crate Ecosystem Taxonomy​

CrateCategory & DomainKey Feature
ferrox-appApplication KernelApplication lifecycle bootstrap & dependency injection.
ferrox-circuit-breakerFault ToleranceState machine (Closed, Open, HalfOpen) for remote APIs.
ferrox-cliCommand Line ToolingCode generator, module scaffolder, migration runner.
ferrox-configDynamic SettingsEnvironment variable parsing with schema validation.
ferrox-cqrsArchitecture PatternCommand Bus, Query Bus, and Event Sourcing dispatchers.
ferrox-crud-genAutomated CRUDAuto-generates REST/GraphQL CRUD routes from SeaORM entities.
ferrox-datagridQuery TranslationServer-side AG-Grid / TanStack Table SeaORM query builder.
ferrox-errorsSystem TaxonomyType-safe error taxonomies with localized messages.
ferrox-eventsEvent BusIn-process and distributed Kafka/AMQP event bus.
ferrox-graphqlTransportAsync-GraphQL schema stitching, scalars, and federation.
ferrox-guardsSecurity & AuthDeclarative RBAC / ABAC / Multi-Tenant access guards.
ferrox-healthDiagnosticsHealth checks, readiness probes, and liveness endpoints.
ferrox-i18nInternationalizationTranslation catalogs, fallback resolution, pluralization.
ferrox-integrationsThird-Party ServicesMailer, Payments (Stripe), Notifications (FCM/Twilio), Flags.
ferrox-interceptorsMiddlewareDynamic request/response pipeline interceptors.
ferrox-jobsBackground QueuesDistributed Redis job queue worker engine.
ferrox-loggerStructured LoggingFast JSON logging with OpenTelemetry trace bindings.
ferrox-metricsObservabilityPrometheus metric exporter (req/sec, latency histograms).
ferrox-migrationsDatabase SchemaVersioned schema migration runner & SQL DDL generator.
ferrox-rate-limiterSecuritySliding Window Log & Token Bucket rate limiters.
ferrox-sagaDistributed SagasDistributed transaction orchestrator with compensations.
ferrox-scheduleTask SchedulingDistributed Cron scheduler engine & heartbeat workers.
ferrox-searchSearch IntegrationFull-text & vector search integration (Meilisearch/Qdrant).
ferrox-securityCryptographyJWT signing (Ed25519), AES-256-GCM, distributed Redlock locks.
ferrox-selftestComplianceOWASP security compliance scan & p95 latency runner.
ferrox-sentinelEdge ProtectionHelmet CSP headers, CORS regex matcher, payload bouncer.
ferrox-singleflightThundering Herd ShieldLock-free concurrent request deduplicator.
ferrox-sseReal-Time TransportServer-Sent Events streaming with reconnect resume support.
ferrox-storageCloud Object StorageZero-buffer S3 streams & presigned download URLs.
ferrox-syncCRDT Real-Time SyncCollaborative CRDT state synchronization over WebSockets.
ferrox-tracingDistributed TracingOpenTelemetry trace span exporter (OTLP gRPC).
ferrox-transportsMulti-ProtocolUnified HTTP, gRPC, and Kafka transport engine.
ferrox-typesType PrimitivesShared type primitives & value objects.
ferrox-utilsShared ToolsHigh-performance helper routines & collections.
ferrox-validationSchema ValidationZero-cost validation macros & JSON schema checks.

3. Core Architectural Philosophy​

1. High Performance & Zero-Cost Abstractions​

Ferrox uses Rust's affine type system and Tokio async runtime to deliver near-bare-metal performance with zero garbage collection pauses.

2. Built-in Fault Tolerance & Resilience​

Circuit breakers, singleflight deduplicators, and distributed Redlocks are built directly into the framework primitives.

3. End-to-End Type Safety​

Share identical data models between backend Rust microservices and frontend WebAssembly applications (ferrox-front).


4. Execution Sequence Flow​

sequenceDiagram
autonumber
participant Client as Client Request
participant [Sentinel](/docs/ferrox/security/ferrox-sentinel) as ferrox-sentinel Shield
participant App as Ferrox Kernel
participant Guard as Security Guard
participant Bus as [CQRS](/docs/ferrox/architectures/cqrs) CommandBus
participant DB as Database (SeaORM)

Client->>[Sentinel](/docs/ferrox/security/ferrox-sentinel): Incoming HTTP / gRPC Request
[Sentinel](/docs/ferrox/security/ferrox-sentinel)->>[Sentinel](/docs/ferrox/security/ferrox-sentinel): Verify CSP Headers, CORS & Payload Size Limit
[Sentinel](/docs/ferrox/security/ferrox-sentinel)->>App: Forward Clean Request
App->>Guard: Evaluate Roles & Tenant Isolation
Guard-->>App: Access Granted
App->>Bus: Dispatch Command ('CreateOrderCommand')
Bus->>DB: Execute Query inside CircuitBreaker
DB-->>Bus: Return Saved Entity
Bus-->>App: Command Execution Success
App-->>Client: Standard Response Payload { success: true, data }

5. Next Steps​

  • Proceed to First Steps to build your first Ferrox application.
  • Explore individual crate guides in the Fundamentals and Security sidebar sections. \n\n---\n\n## 3. How it Works (Under the hood)\n\nDetail the internal mechanics, memory model, and execution flow.\n\n## 4. Why it was designed this way\n\nExplain the historical context, trade-offs, and design rationale.\n\n## 5. Usage Guide & Code Examples\n\nProvide integration examples, setup guides, and typical use cases.\n\n## 6. Anti-Patterns\n\nList common mistakes, misconfigurations, and patterns to avoid when using this component.\n\n## 7. Pro-Tips / Best Practices\n\nProvide advanced tips, performance optimizations, and recommended patterns.