Event Sourcing and materialization in Elixir

Event Sourcing and materialization in Elixir Series: Part 4 of 5 — CQRS and architecture for AI agents. Reading time: ~6 min. In the previous article we covered Ask vs Act (RAG and Tool Use) for AI...

By · · 1 min read
Event Sourcing and materialization in Elixir

Source: DEV Community

Event Sourcing and materialization in Elixir Series: Part 4 of 5 — CQRS and architecture for AI agents. Reading time: ~6 min. In the previous article we covered Ask vs Act (RAG and Tool Use) for AI agents. Here we cover Event Sourcing as a timeline and materialization in Elixir with Commanded and Projectors. Event-driven architecture: persistence as a timeline The CQRS pattern reaches its full architectural potential when combined with Event Sourcing (ES). Instead of storing the current state of an object in the database and overwriting previous records with destructive UPDATEs, Event Sourcing holds that every change in the system should be recorded as an immutable domain event in an append-only log. The current state of a system does not exist as a single consolidated entity in the transactional store; it is derived by replaying all past events in sequence. Example timeline: GroupCreated → MemberAdded → WalletFunded → WalletLiquidated. The group’s current state is the sequential appli