Migrating from CRUD to CQRS and Event-Sourcing with Akka.Persistence
How Akka.Persistence allowed us to break the logjam on Sdkbin's massive technical debt.
15 minutes to readWe’re about a year into the process of completely re-working Sdkbin to better support our needs here at Petabridge and, eventually, other third-party software vendors.
Sdkbin was originally built on an extremely flimsy CRUD architecture that violates most of my personal design preferences - you can read about the history behind that here. But to summarize, I tend to use the following heuristics when building software:
- Prefer optionality-preserving designs - make sure your design decisions can be reversed or altered when things inevitably change.
- Use as few moving parts as possible - most of Akka.NET is constructed this way.
- No magic - if nothing magically works, then nothing magically breaks either.
- Ensure that coupling happens only where it’s necessary - coupling usually needs to happen in your integration layer (i.e. your UI or HTTP API.) Your accounting system should probably not be coupled to your payments system.
Sdkbin’s original CRUD design violated all of these principles:
- Used hard deletes, destroying data with no ability to recover or audit (impossible to reverse);
- Relied heavily on AutoMapper-powered generic repositories (magic with lots of moving parts); and
- Was highly coupled throughout - Stripe payment events served double-duty as invoices, for instance.
We’ve fixed a ton of these issues already, and one of the most important tools we’re using is Akka.Persistence. We’ve also made some significant improvements to Akka.Persistence in recent releases that made it much easier for us to accomplish our ambitious goals with Sdkbin.
Let me show you what we did.

