Example of a simple inventory management system implemented in F# using DDD, CQRS, and Event Sourcing.
This project is intended to implement a solution with modularity and versioning (eventually), and serve as a boilerplate template for real-life projects.
It is still very much work in progress, so definitely not suitable to be a template for real-life projects just yet.
Solution uses .NET 8 / F# and has following major parts:
- Core domain components. Only types and pure functions are allowed here.
- Application services that are aware of the outside world and intended to have effects - consume and publish messages, read and write DB data, make external HTTP/GRPC calls etc.
- API sends Commands to Application (command API), and uses ProjectionStore to retrieve view models (query API).
- Ports. Abstractions for event store, projections store, and message bus.
- Adapters. Implementations of Ports abstraction that (typically) use external services, e.g. MartenDB or RabbitMQ.
- CLI: example of an external client that interacts with the system via API.
See “Architecture” and “Solution Structure” documents for more information.
- .NET 8.0 SDK: https://dotnet.microsoft.com/download
- PowerShell: https://github.com/powershell/powershell
- Docker with Docker Compose: https://www.docker.com/
Development environment is a personal choice, here are some options:
- JetBrains Rider
- Visual Studio
- Visual Studio Code with following
extensions:
- Ionide F# (
ionide.ionide-fsharp
) - PowerShell (
ms-vscode.powershell
) - Docker (
ms-azuretools.vscode-docker
)
- Ionide F# (
PowerShell helper script build.ps1
can be used to build and run the solution,
see “Build and Run” document for more information.
See “Interacting with the system using API” document.
- Wlaschin, Scott. “Domain Modeling Made Functional”, The Pragmatic Programmers, 2018-01, https://pragprog.com/titles/swdddf/domain-modeling-made-functional/.
- Evans, Eric. “Domain-Driven Design: Tackling Complexity in the Heart of Software”, Addison-Wesley Professional, 2003-09-11
- Fowler, Martin. “Bliki: CQRS” martinfowler.com, 2011-07-14, https://martinfowler.com/bliki/CQRS.html.
- Young, Gregory. “CQRS Documents” wordpress.com, 2010-11, https://cqrs.files.wordpress.com/2010/11/cqrs_documents.pdf.
- Young, Gregory. “Simple CQRS” github.com, 2015-01-13, https://github.com/gregoryyoung/m-r.
- Fowler, Martin. “Event Sourcing” martinfowler.com, 2005-12-12, https://martinfowler.com/eaaDev/EventSourcing.html.
- Microsoft Learning. “Event Sourcing pattern”, learn.microsoft.com https://learn.microsoft.com/en-us/azure/architecture/patterns/event-sourcing.