Welcome to Fluvius Framework
info
Fluvius Framework is a Python library for building domain-driven API & MCP backends with CQRS, event sourcing, and modern architecture patterns.
What is Fluvius?
Fluvius Framework helps you build scalable, maintainable backend applications using:
- Domain-Driven Design: Organize your code around business domains
- CQRS: Separate read and write operations for better performance
- Event Sourcing: Track all changes as immutable events
- FastAPI Integration: Build REST APIs quickly
- Multiple Data Backends: Support for PostgreSQL, MongoDB, SQLite, and more
Quick Start
Get started in minutes:
from fluvius.domain import Domain, Aggregate, action
from fluvius.domain.context import SanicContext
from fluvius.data import UUID_GENR
# Define your aggregate
class UserAggregate(Aggregate):
@action(evt_key='user-created', resources=['user'])
async def create_user(self, name: str, email: str):
# Your business logic
return {'name': name, 'email': email}
# Create your domain
class UserDomain(Domain):
__aggregate__ = UserAggregate
# Use it
ctx = SanicContext.create(namespace='app-user')
domain = UserDomain(ctx)
domain.set_aggroot('user', UUID_GENR())
command = domain.create_command('create-user', {
'name': 'John Doe',
'email': '[email protected]'
})
response = await domain.process_command(command)
Key Features
- Domain-Driven Design: Build applications around business domains
- CQRS Pattern: Separate commands and queries for scalability
- Event Sourcing: Automatic event generation and storage
- FastAPI Integration: REST APIs out of the box
- Multiple Databases: PostgreSQL, MongoDB, SQLite support
- Background Workers: Async job processing with ARQ
- Media Management: File upload and storage
- Query Builder: Flexible querying with filtering and sorting
- Authorization: Casbin integration for policy-based access control
Documentation Structure
- Getting Started: Installation and quick start guides
- Core Concepts: DDD, CQRS, event sourcing
- Modules: Detailed module documentation
- Examples: Complete working examples
- API Reference: Complete API documentation
Get Started
Need Help?
- Check the Examples section
- Read the API Reference
- Review the Core Concepts
Let's build something amazing! 🚀