Skip to content
CØDE N!NJΔ edited this page Jun 19, 2025 · 6 revisions

📚 SourceFlow - Overview

🎯Build better software with events as your foundation

✨Key Features

  • Immutable Events: All events are immutable records
  • Optimistic Concurrency: Version-based conflict detection
  • Event Replay: Complete state reconstruction from events
  • Type Safety: Strong typing throughout the system
  • Testability: Easy to unit test with in-memory implementations
  • Separation of Concerns: Clean architecture with distinct layers

⚡Core Components:

💫 1. Event Infrastructure

  • IEvent interface and BaseEvent record for all events
  • EventStoreEntry for persistence
  • Type-safe event definitions using records

💫 2. Aggregate Root Pattern

  • Base AggregateRoot class with event sourcing capabilities
  • Uncommitted events tracking
  • Version-based optimistic concurrency control
  • Event application for state reconstruction

💫 3. Event Store

  • IEventStore interface for pluggable storage
  • In-memory implementation with concurrency control
  • Event serialization/deserialization
  • Stream-based event organization

💫 4. Repository Pattern

  • Generic IRepository interface
  • Event-sourced repository implementation
  • Automatic aggregate reconstruction from events

💫 5. Domain Implementation

  • Rich domain model with business rules
  • Event-driven state changes
  • Factory methods for aggregate creation
  • Proper encapsulation and validation

💫 6. Domain Events

  • Strongly-typed events using records
  • Immutable event data
  • Clear event naming conventions

💫 7. Application Layer:

  • Application Services
  • Command handling with
    • business logic
    • Transaction boundaries
    • Error handling and validation

💫 8. Projections/Read Models

  • CQRS pattern implementation
    • Separate read model for queries
    • Event handlers for projection updates