TL;DR: A collection of use cases utilizing event sourcing and event-driven architecture in the ecommerce domain that leverage the event-native database EventStoreDB.
- 1.0 What is this repository?
- 2.0 Technologies, frameworks, and libraries, oh my!
- 3.0 Documentation
- 4.0 Roadmap
- 5.0 Compatibility
- 6.0 Installation Requirements
- 7.0 How To Run
- 8.0 The Story
- 9.0 Resources
- 10.0 Maintainer
- 11.0 License
This repository's objective to demonstrate how an ecommerce backend can be built using the data storage technique known as event sourcing, along with related concepts frequently employed such as event-driven architecture (EDA), Command and Query Responsibility Segregation (CQRS), and more.
The aim is to provide an assortment of use cases of varying complexity across different technologies. That is to say, examples that are beyond the Hello World
level that showcase different methodologies and technologies.
Moderns tools are leveraged to demonstrate different ways to interact with EventStoreDB, the event-native database. While it was written from the ground up for Event Sourcing, there are other interesting uses the database can be used for that this repository may explore in the future.
An exciting yet perhaps lofty idea is to have this single code repository be the home for different runtimes and programming languages that work in tandem. Where one module (service) is written in C# running in .NET, while another service it communicates with is written in TypeScript running Node.js.
If this proves to be too ambitious or if the community finds it confusing, changes can be made. Such as making different versions of this repository with each featuring a different language and runtime.
Is there a library, framework, or other piece of tech you would like to see here? Simply open an issue, pull request, or contact me directly (see above). I would love to hear more about what you think should be highlighted here.
- TBD. Current candidates:
A companion guide is currently in development.
Details are being worked out and will be shared soon.
Value Streams are a core concept in Team Topologies. To Grossly simplify, think departments, divisions, or teams within a company. That is, organizing business and technology teams for fast flow.
This early on in development, this is effectively a loose roadmap of what technologies will be used where. Better fits may be found or other technologies may want to be explored. All subject to change.
Value Stream | Module | Progress | Runtime | Language | ESDB Library | Additional Data Stores, etc. |
---|---|---|---|---|---|---|
πΌ Vendor Management | Portal | π΄ | Emmet | |||
πͺ Retail | Storefront | π΄ | Emmet | |||
πͺ Retail | Cart | π’β«β« | Eventuous | |||
π Catalog | Listings | π΄ | Eventuous | |||
π Catalog | Products | π’β«β« | Eventuous | |||
π Catalog | Prices | π’β«β« | Eventuous | |||
π¦ Supply Chain | Inventories | π΄ | Eventuous | |||
π¦ Supply Chain | Procurement | π΄ | Eventuous | |||
π¦ Supply Chain | Fulfillment | π΄ | Eventuous | |||
π¬ Data Analysis | Data Science | π΄ | N/A | TBD | ||
π¬ Data Analysis | Data Reporting | π΄ | N/A | TBD | ||
ποΈ Legacy | Legacy | π΄ | N/A | |||
TBD | TBD | π΄ | MicroPlumberd | TBD | ||
TBD | TBD | π΄ | TBD | TBD |
Names, structure, and hierarchy are based on personal experiences and opinions derived from time spent in the ecommerce industry. They do not reflect the inner workings of any specific singular system, team, or organization.
At this time it is preferred you build the projects on your machine directly, the traditional way.
In the future there will be an easier way to choose between running modules traditionally or with Docker.
As this time the background services, such as the databases, are ran inside of Docker containers.
- Install .NET 8.0 SDK
- Install Docker
TODO: | enable projects to be built within Docker and not require the .NET SDK to be installed |
Clone the repository via your preferred method. For example, using the command line:
git clone https://github.com/erikshafer/event-sourcing-ecommerce
Open a terminal and navigate to the root of the repository.
Build the dotnet solution (AKA the container of projects) with the following command at the root of the repository:
dotnet build
If you see no errors and a Build succeeded.
message output, that means all the dotnet requirements were met. Hooray!
Be sure that after Docker is installed it is also actively running, otherwise the commands below will result in a Docker daemon is not running
error.
Run the following command to have Docker begin running (detached, so you can still use your terminal) all background services, such as databases, sinks, etc.:
docker-compose up -d
This may take a moment to complete if this is your first time running the code. Specifically if you need to pull down the Docker images and then run the containers.
If there are no visible errors, and you see a Running 6/6
message output, all the Docker components, AKA the background services, are running successfully. Hooray!
As we ran docker-compose
as a detached process, so we can continue to use the same terminal, we will need to manually stop the services as well with the docker-compose feature. That can be done with the following command:
docker-compose down
If you didn't run Docker detached earlier (with no -d
param), you can just escape out of the process with CTRL+C or whatever the binding is on your machine.
Check the Docker Compose documentation for more details.
Work In Progress π§
As more vertical slices and implemented and projects are more fleshed out as a whole.
TL;DR: execute dotnet run
where applicable. If you're a dotnet developer you likely know what to do!
An ecommerce company has grown out of its startup phase. It is needing to scale not just the amount of requests and responses it's capable of per second, but make itself capable to adapt to changing trends and shifts in the industry.
Enter event sourcing with EventStoreDB!
To be continued
More to come π§
- Event Store blog and webinars
- Oskar Dudycz and his EventSourcing.NetCore code repository and event-driven.io blog.
- Oskar's style of developing applications using concepts like CQRS and Event Sourcing has certainly rubbed off on me. That will be evident when looking at some of this very code! Aggregate design especially.
- Derek Comartin writes articles on CodeOpinion.com and produces accompanying videos on his YouTube channel of the same name.
- Greg Young and his involvement in getting so much of this rolling. His contributions helped this community and interest in this way of storing data get its start. And no, I didn't mean CARS. I mean CQRS!
- Event Store, at time of this writing, is my employer! The individuals at Event Store are phenomenal in too many ways to write here. Thank you all for your professional and personal support.
- JetBrains, I love your IDEs and Kotlin. That is all.
- More to come!
I've been a large fan of JetBrains' suite of Integrated Development Environments (IDEs) for the better part of a decade. That includes their dotnet IDE called Rider which is used to work on this effort.
Erik "Faelor" Shafer
blog: www.event-sourcing.dev