Use Cases
info
Fluvius Framework is designed for applications that benefit from domain-driven design, event sourcing, and CQRS patterns.
Ideal Use Cases
1. Enterprise Applications
Fluvius excels in building enterprise applications with complex business logic:
- Financial Systems: Banking, trading, payment processing
- E-commerce Platforms: Order management, inventory, fulfillment
- Healthcare Systems: Patient records, appointments, billing
- CRM Systems: Customer management, sales pipelines, analytics
Why Fluvius?
- Clear domain boundaries
- Complete audit trail
- Complex business rule enforcement
- Scalable architecture
2. Event-Driven Systems
Applications that need to react to events and maintain event logs:
- IoT Platforms: Device management, telemetry, alerts
- Analytics Systems: Data collection, processing, reporting
- Notification Systems: Multi-channel messaging
- Workflow Engines: Process automation, state machines
Why Fluvius?
- Built-in event sourcing
- Event replay capabilities
- Event-driven integrations
- Time-travel debugging
3. Microservices Architectures
Building distributed systems with clear boundaries:
- Service Mesh: Inter-service communication
- API Gateways: Request routing and aggregation
- Backend for Frontend: BFF patterns
- Domain Services: Bounded context implementation
Why Fluvius?
- Clear domain boundaries
- Independent scaling
- Service isolation
- Event-based communication
4. Multi-Tenant Applications
Applications serving multiple organizations:
- SaaS Platforms: Multi-tenant data isolation
- Platform Services: Shared infrastructure, isolated data
- White-label Solutions: Customizable per tenant
Why Fluvius?
- Namespace isolation
- Tenant-aware queries
- Policy-based access control
- Resource-level authorization
5. Systems Requiring Audit Trails
Applications needing complete change history:
- Compliance Systems: Regulatory requirements
- Legal Systems: Document versioning
- Financial Systems: Transaction history
- Healthcare Systems: HIPAA compliance
Why Fluvius?
- Immutable event log
- Complete change history
- Event replay
- Audit reporting
Real-World Examples
Banking Domain
from fluvius.domain import Domain, Aggregate, action
class AccountAggregate(Aggregate):
@action(evt_key='account-opened', resources=['account'])
async def open_account(self, customer_id: str, account_type: str):
# Business logic for opening account
pass
@action(evt_key='deposit-made', resources=['account'])
async def deposit(self, amount: float):
# Validate and process deposit
pass
Benefits:
- Complete transaction history
- Regulatory compliance
- Event-driven notifications
- Audit trail
E-commerce Platform
class OrderAggregate(Aggregate):
@action(evt_key='order-created', resources=['order'])
async def create_order(self, items: list, customer_id: str):
# Validate inventory, calculate totals
pass
@action(evt_key='order-shipped', resources=['order'])
async def ship_order(self, tracking_number: str):
# Update order status, trigger notifications
pass
Benefits:
- Order state management
- Inventory synchronization
- Event-driven fulfillment
- Customer notifications
IoT Device Management
class DeviceAggregate(Aggregate):
@action(evt_key='device-registered', resources=['device'])
async def register_device(self, device_id: str, device_type: str):
# Register new device
pass
@action(evt_key='telemetry-received', resources=['device'])
async def record_telemetry(self, data: dict):
# Store telemetry data
pass
Benefits:
- Device state tracking
- Telemetry event stream
- Alert generation
- Historical analysis
When NOT to Use Fluvius
Fluvius may be overkill for:
- Simple CRUD applications without complex business logic
- Static websites or content management
- Simple APIs with minimal state
- Prototypes that need rapid iteration without structure
For these cases, simpler frameworks might be more appropriate.
Migration Scenarios
From Django/FastAPI
If you have:
- Complex business logic in views/services
- Need for event sourcing
- CQRS requirements
- Audit trail needs
Fluvius can help by:
- Extracting domain logic into aggregates
- Adding event sourcing
- Separating commands and queries
- Providing audit capabilities
From Event Sourcing Libraries
If you're using:
- EventStore
- EventStoreDB
- Custom event sourcing
Fluvius provides:
- Python-native implementation
- DDD patterns built-in
- FastAPI integration
- Multiple backend support
Next Steps
- Learn about Key Features
- Check Target Audience
- Start with Getting Started