Skip to content

Instantly share code, notes, and snippets.

@jhosteny
jhosteny / building-a-cqrs-web-application-in-elixir-using-phoenix.md
Last active January 15, 2022 22:43
Building a CQRS/ES web application in Elixir using Phoenix

Background

I've been interested in Command Query Responsibility Segregation and event sourcing since hearing Greg Young talk on the subject in early 2010. During the past seven years I've built an open-source Ruby CQRS library (rcqrs); worked professionally on .NET applications following the pattern; and more recently built an Event Store (eventstore) and CQRS library (commanded) in Elixir.

Building applications following domain-driven design and using CQRS feels really natural with the Elixir -- and Erlang -- actor model. An aggregate root fits well within an Elixir process, which are driven by immutable messages through their own message mailboxes, allowing them to run concurrently and in isolation.

The web application I built to implement these ideas in Elixir was [Segment Challen