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

.Net 9.0 .Net Standard 2.1 NuGet version 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 8+ with performance and developer experience as core priorities.

🌟 Why SourceFlow.Net?

✨ Key Features

  • 🏗️ Domain-Driven Design Support
    • Aggregate Root Framework - Base classes and interfaces for DDD aggregates
    • Value Objects - Immutable value type helpers and generators
    • Domain Events - Rich domain event publishing and handling
    • Bounded Context Isolation - Tools for maintaining clean architectural boundaries
  • ⚡ CQRS Implementation with Command/Query Segregation
    • Command Pipeline - Validation, authorization, and middleware support
    • Query Optimization - Dedicated read models with eventual consistency
    • Mediator Pattern - Built-in command/query dispatching
    • Projection Engine - Real-time and batch projection processing
    • Read Model Synchronization - Automated view materialization
  • 📊 Event-First Design with Event Sourcing Foundation
    • Event Replay - Complete system state reconstruction capabilities
    • Event Correlation - Track causation and correlation across event streams
    • Eventual Consistency - Saga pattern implementation for long-running processes
    • Audit Trail - Immutable audit log for compliance requirements
    • Snapshots - Automatic snapshot management for performance optimization
  • 🧱 Clean Architecture
    • Improved Maintainability - well-organized codebase with distinct layers and separation of concerns
    • Increased Modularity - promotes smaller, well-defined modules or components, each with a specific responsibility
    • Enhanced Testability - allows focused testing of individual components without the need for complex setups or external dependencies
    • Framework and Database Independence - allows easy switching of components, databases, or other external dependencies without requiring significant changes to the core application

🏁 Getting Started

🏢 Installation

nuget add package SourceFlow.Net

dotnet add package SourceFlow.Net.SqlServer # or your preferred storage

💼 Quick Setup

// Program.cs
builder.Services.AddSourceFlow()
    .UseSqlServerEventStore(connectionString)
    .AddAggregate<OrderAggregate>()
    .AddProjection<OrderSummaryProjection>();

// Domain Aggregate
public class OrderAggregate : AggregateRoot
{
    public void PlaceOrder(OrderId orderId, CustomerId customerId, OrderItems items)
    {
        // Business logic validation
        RaiseEvent(new OrderPlacedEvent(orderId, customerId, items, DateTime.UtcNow));
    }
}

// Command Handler
public class PlaceOrderHandler : ICommandHandler<PlaceOrderCommand>
{
    public async Task HandleAsync(PlaceOrderCommand command)
    {
        var aggregate = await _repository.GetAsync<OrderAggregate>(command.OrderId);
        aggregate.PlaceOrder(command.OrderId, command.CustomerId, command.Items);
        await _repository.SaveAsync(aggregate);
    }
}

🤝 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

📄 License

MIT License - Free for commercial and open source use

🚀 Build better software with events as your foundation

Start your journey with SourceFlow.Net today!

Get Started View on GitHub

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

Releases

No releases published

Packages

No packages published

Languages