Skip to content

A modern, lightweight, and extensible framework for building event-sourced applications using Domain-Driven Design (DDD) principles and Command Query Responsibility Segregation (CQRS) patterns.

License

Notifications You must be signed in to change notification settings

CodeShayk/SourceFlow.Net

Repository files navigation

ninja SourceFlow.Net

License: MIT GitHub Release master-build master-codeql

A modern, lightweight, and extensible .NET framework for building event-sourced applications using Domain-Driven Design (DDD) principles and Command Query Responsibility Segregation (CQRS) patterns.


Overview

SourceFlow.Net empowers developers to build scalable, maintainable applications by providing a complete toolkit for event sourcing, domain modeling, and command/query separation. Built from the ground up for .NET 9.0 with performance and developer experience as core priorities.

Key Features

  • 🏗️ Domain-Driven Design Support - First-class support for aggregates, entities, value objects
  • CQRS Implementation - Complete command/query separation with optimized read models
  • 📊 Event Sourcing Foundation - Event-first design with full audit trail
  • 🧱 Clean Architecture - Clear separation of concerns and dependency management
  • 💾 Flexible Persistence - Multiple storage options including Entity Framework Core
  • 🔄 Event Replay - Built-in command replay for debugging and state reconstruction
  • 🎯 Type Safety - Strongly-typed commands, events, and projections
  • 📦 Dependency Injection - Seamless integration with .NET DI container
  • 📈 OpenTelemetry Integration - Built-in distributed tracing and metrics for operations at scale
  • Memory Optimization - ArrayPool-based optimization for extreme throughput scenarios
  • 🛡️ Resilience Patterns - Polly integration for fault tolerance with retry policies and circuit breakers

Core Concepts

v1.0.0 Architecture

Aggregates

  • An Aggregate encapsulates a root domain entity within a bounded context (microservice)
  • Changes to aggregates are initiated by publishing commands
  • Aggregates subscribe to events to react to external changes from other sagas or workflows that may affect their state

Sagas

  • A Saga represents a long-running transaction that orchestrates complex business processes
  • Sagas subscribe to commands and execute the actual updates to aggregate entities
  • They manage both success and failure flows to ensure data consistency and preserve aggregate state
  • Sagas can publish commands to themselves or other sagas to coordinate multi-step workflows
  • Events can be raised by sagas during command handling to notify other components of state changes

Events

  • Events are published to interested subscribers when state changes occur
  • Two primary event subscribers exist in the framework:
    • Aggregates: React to events from external workflows that impact their domain state
    • Views: Project event data into optimized read models for query operations

Views

  • Views subscribe to events and transform domain data into denormalized view models
  • View models provide optimized read access for consumers such as UIs or reporting systems
  • Data in view models follows eventual consistency patterns

v2.0.0 Roadmap (Cloud Integration)

Command Dispatcher

  • Dispatches commands to cloud-based message queues for distributed processing
  • Targets specific command queues based on bounded context routing

Command Queue

  • A dedicated queue for each bounded context (microservice)
  • Routes incoming commands to the appropriate subscribing sagas within the domain

Event Dispatcher

  • Publishes domain events to cloud-based topics for cross-service communication
  • Enables event-driven architecture across distributed systems

Event Listeners

  • Bootstrap components that listen to subscribed event topics
  • Dispatch received events to the appropriate aggregates and views within each domain context
  • Enable seamless integration across bounded contexts

Architecture

architecture

Click on Architecture for more details on how to extend SourceFlow.Net for bespoke requirements.

RoadMap

Package Version Release Date Details .Net Frameworks
SourceFlow v1.0.0 NuGet version 29th Nov 2025 Core functionality for event sourcing and CQRS .Net 10 .Net 9.0 .Net Standard 2.1 .Net Standard 2.0 .Net Framework 4.6.2
SourceFlow.Stores.EntityFramework v1.0.0 NuGet version 29th Nov 2025 Provides store implementation using EF. Can configure different (types of ) databases for each store. .Net 10 .Net 9.0 .Net 8.0
SourceFlow.Cloud.AWS v2.0.0 (TBC) Provides support for AWS cloud with cross domain boundary command and Event publishing & subscription. .Net 10 .Net 9.0 .Net 8.0
SourceFlow.Cloud.Azure v2.0.0 (TBC) Provides support for Azure cloud with cross domain boundary command and Event publishing & subscription. .Net 10 .Net 9.0 .Net 8.0

Getting Started

Installation

add nuget packages for SourceFlow.Net

  • dotnet add package SourceFlow.Net
  • dotnet add package SourceFlow.Stores.EntityFramework
  • dotnet add package SourceFlow.Cloud.Aws (to be released)
  • add custom implementation for stores, and extend for your cloud.

Developer Guide

This comprehensive guide provides detailed information about the SourceFlow.Net framework, covering everything from basic concepts to advanced implementation patterns and troubleshooting guidelines.

Please click on Developer Guide for complete details.

Support

If you are having problems, please let me know by raising a new issue.

License

This project is licensed with the MIT license.

Contributing

We welcome contributions! Please see our Contributing Guide for details.

  • 🐛 Bug Reports - Create an issue
  • 💡 Feature Requests - Start a discussion
  • 📝 Documentation - Help improve our docs
  • 💻 Code - Submit pull requests

Credits

Thank you for reading. Please fork, explore, contribute and report. Happy Coding !! :)

About

A modern, lightweight, and extensible framework for building event-sourced applications using Domain-Driven Design (DDD) principles and Command Query Responsibility Segregation (CQRS) patterns.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors 2

  •  
  •  

Languages