{"id":"6b08bd3380884893657cc94c","slug":"event-sourcing","title":"Event sourcing: store the facts, not just the latest state","summary":"State as a sequence of immutable events: streams, rehydration by folding, optimistic concurrency, projections, snapshots and event versioning. An aggregate and an event store in C# (Marten), TypeScript, Java, Go and Python.","servedLang":"en","availableLangs":["pl","en"],"topics":["event-sourcing","cqrs","event-driven-architecture"],"techs":["dotnet","java","typescript","go","python"],"tags":["architecture","event-sourcing","event-store","projections","optimistic-concurrency","marten"],"level":"advanced","kind":"article","access":"members","status":"published","cover":null,"author":{"id":"6b08bd2e80884893657cc8cf","name":"Redakcja Art of Devs","avatar":null,"handle":"redakcja","community":false},"readingMinutes":13,"stats":{"views":4,"likes":0,"bookmarks":0,"comments":0},"publishedAt":"2026-11-26T23:13:55.121Z","updatedAt":"2026-11-27T13:12:33.153Z","requestedLang":"en","theme":{"hero":"classic","heroMedia":null,"accent":"teal","background":"hex","weaveResources":true,"toc":"right"},"seoDescription":"Event sourcing: events as the source of truth, aggregate streams, rehydration, expected version and conflicts, projections, snapshots, upcasting, GDPR, examples in C#, TypeScript, Java, Go and Python, Marten, KurrentDB, Axon.","wordCount":2588,"doc":{"type":"doc","content":[{"type":"paragraph","content":[{"type":"text","text":"\"Where did my points go?\" asks Mr Zdzisio, a regular at Halina's pierogi place. The database only shows "},{"type":"text","text":"balance = 40","marks":[{"type":"code"}]},{"type":"text","text":". Nobody knows whether the points expired, whether someone redeemed them, or whether there was a bug during a refund. "},{"type":"text","text":"Event sourcing","marks":[{"type":"bold"}]},{"type":"text","text":" answers such questions by definition: instead of overwriting state, the system records every change as an immutable "},{"type":"text","text":"event","marks":[{"type":"bold"}]},{"type":"text","text":" and computes the current state by replaying the history."}]},{"type":"callout","attrs":{"variant":"tip","title":"In short"},"content":[{"type":"bulletList","content":[{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"The source of truth is an "},{"type":"text","text":"event stream","marks":[{"type":"bold"}]},{"type":"text","text":" ("},{"type":"text","text":"PointsEarned","marks":[{"type":"code"}]},{"type":"text","text":", "},{"type":"text","text":"PointsRedeemed","marks":[{"type":"code"}]},{"type":"text","text":", "},{"type":"text","text":"PointsExpired","marks":[{"type":"code"}]},{"type":"text","text":"), and the state is its "},{"type":"text","text":"fold","marks":[{"type":"bold"}]},{"type":"text","text":" – the sum of the applied events."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"A write is an "},{"type":"text","text":"append","marks":[{"type":"bold"}]},{"type":"text","text":" of events with the stream's "},{"type":"text","text":"expected version","marks":[{"type":"bold"}]},{"type":"text","text":"; concurrent changes end in a controlled conflict."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"Reads are served by "},{"type":"text","text":"projections","marks":[{"type":"bold"}]},{"type":"text","text":" – which is why event sourcing almost always goes hand in hand with CQRS."}]}]}]}]},{"type":"stats","attrs":{"items":[{"value":"2005","label":"the \"Event Sourcing\" pattern write-up","hint":"Martin Fowler, a continuation of the PoEAA catalogue"},{"value":"6M","label":"orders per second at LMAX","hint":"one thread, logic rebuilt from events (Fowler, 2011)"},{"value":"0","label":"UPDATEs and DELETEs on events","hint":"the event store is append-only"}]}},{"type":"heading","attrs":{"level":2,"id":"context-and-forces"},"content":[{"type":"text","text":"Context and forces"}]},{"type":"bulletList","content":[{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"Audit and disputes","marks":[{"type":"bold"}]},{"type":"text","text":" – the loyalty programme is about the customer's money; you need to be able to show where every point came from."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"Questions about the past","marks":[{"type":"bold"}]},{"type":"text","text":" – \"how many points did Zdzisio have on Christmas Eve?\" or \"what if the promotion had lasted longer?\"."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"New views from existing data","marks":[{"type":"bold"}]},{"type":"text","text":" – marketing wants a report nobody thought of when the tables were designed."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"Integration through events","marks":[{"type":"bold"}]},{"type":"text","text":" – other modules and services need to know what happened anyway."}]}]}]},{"type":"paragraph","content":[{"type":"text","text":"Banking and accounting have done this for centuries: an account balance is the result of postings, and a mistake isn't erased with a rubber but corrected with another posting. Martin Fowler described the pattern in 2005, and Greg Young popularised it together with CQRS and the EventStoreDB database (now KurrentDB)."}]},{"type":"heading","attrs":{"level":2,"id":"structure"},"content":[{"type":"text","text":"Structure"}]},{"type":"diagram","attrs":{"kind":"mermaid","code":"flowchart LR\n  cmd[\"Command<br/>RedeemReward\"] --> h[\"Handler\"]\n  h -- \"1. load the stream\" --> es[(\"Event store<br/>loyalty-7f3c: v1..v12\")]\n  h -- \"2. fold → state,<br/>3. decide → new events\" --> agg[\"LoyaltyAccount\"]\n  h -- \"4. append with expected version 12\" --> es\n  es -- \"subscription\" --> p1[\"Projection: customer balance\"]\n  es -- \"subscription\" --> p2[\"Projection: promotion report\"]\n  es -- \"subscription\" --> p3[\"Publishing integration events\"]\n  p1 --> r1[(\"Read model\")]\n  p2 --> r2[(\"Data warehouse\")]","caption":"A command, an event stream and projections"}},{"type":"table","content":[{"type":"tableRow","content":[{"type":"tableHeader","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Concept"}]}]},{"type":"tableHeader","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Meaning"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Event"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"A fact from the past, in the past tense, immutable: "},{"type":"text","text":"PointsRedeemed(reward, 300)","marks":[{"type":"code"}]}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Stream"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"The ordered events of one aggregate, e.g. "},{"type":"text","text":"loyalty-<id>","marks":[{"type":"code"}]},{"type":"text","text":"; the position in it is the version"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Rehydration"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Rebuilding the state by applying (folding) all events in the stream"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Expected version"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"A condition on append: \"append if the stream is still at version 12\" – optimistic concurrency"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Projection"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"A process that reads events and builds a read model from them; it can be rebuilt from scratch"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Snapshot"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Saved state after N events, so thousands of events needn't be replayed on every read"}]}]}]}]},{"type":"paragraph","content":[{"type":"text","text":"A good way to see the idea is the stream of a single account – this is the history that was missing when Mr Zdzisio asked:"}]},{"type":"timeline","attrs":{"items":[{"date":"1 March","title":"AccountOpened","text":"Zdzisio opens an account in the app, balance 0."},{"date":"3 March","title":"PointsEarned +85","text":"An order of 20 ruskie and 10 blueberry pierogi."},{"date":"17 March","title":"PointsEarned +120","text":"Catering for his granddaughter's birthday."},{"date":"2 April","title":"Attempt to redeem 300 pts","text":"Rejected by the rule (balance 205) – no event is recorded."},{"date":"20 April","title":"PointsEarned +140","text":"More orders, balance 345."},{"date":"21 April","title":"PointsRedeemed −300","text":"A free portion of 10 ruskie, balance 45."},{"date":"1 July","title":"PointsExpired −5","text":"Points older than a year expire under the terms – balance 40."}]}},{"type":"heading","attrs":{"level":2,"id":"what-it-looks-like-in-code"},"content":[{"type":"text","text":"What it looks like in code"}]},{"type":"paragraph","content":[{"type":"text","text":"The aggregate has two functions: "},{"type":"text","text":"apply/evolve","marks":[{"type":"bold"}]},{"type":"text","text":" (how an event changes the state) and "},{"type":"text","text":"decide","marks":[{"type":"bold"}]},{"type":"text","text":" (which events follow from a command in a given state). Both are pure and are tested without a database: \"given these events, after this command I expect these events\"."}]},{"type":"codeGroup","attrs":{"title":"An aggregate rebuilt from events"},"content":[{"type":"codeBlock","attrs":{"language":"csharp","filename":"LoyaltyAccount.cs"},"content":[{"type":"text","text":"// Events are facts in the past tense. They are the source of truth.\npublic abstract record LoyaltyEvent;\npublic sealed record AccountOpened(Guid CustomerId, DateTimeOffset At) : LoyaltyEvent;\npublic sealed record PointsEarned(Guid OrderId, int Points, DateTimeOffset At) : LoyaltyEvent;\npublic sealed record PointsRedeemed(string Reward, int Points, DateTimeOffset At) : LoyaltyEvent;\npublic sealed record PointsExpired(int Points, DateTimeOffset At) : LoyaltyEvent;\n\npublic sealed class LoyaltyAccount\n{\n    public Guid Id { get; private set; }\n    public int Balance { get; private set; }\n    public int Version { get; private set; }               // number of events applied so far\n\n    // State = left fold of all events. No setters, no ORM mapping.\n    public static LoyaltyAccount Rehydrate(Guid id, IEnumerable<LoyaltyEvent> history)\n    {\n        var account = new LoyaltyAccount { Id = id };\n        foreach (var e in history) account.Apply(e);\n        return account;\n    }\n\n    // Decide: check the rules against the current state and return NEW events (nothing is mutated yet).\n    public IReadOnlyList<LoyaltyEvent> Redeem(string reward, int cost, DateTimeOffset now) =>\n        Balance >= cost\n            ? [new PointsRedeemed(reward, cost, now)]\n            : throw new InvalidOperationException($\"Balance {Balance} is lower than {cost}.\");\n\n    public void Apply(LoyaltyEvent e)\n    {\n        Balance = e switch\n        {\n            AccountOpened => 0,\n            PointsEarned x => Balance + x.Points,\n            PointsRedeemed x => Balance - x.Points,\n            PointsExpired x => Balance - x.Points,\n            _ => Balance\n        };\n        Version++;\n    }\n}"}]},{"type":"codeBlock","attrs":{"language":"typescript","filename":"loyalty-account.ts"},"content":[{"type":"text","text":"// Events are facts in the past tense. They are the source of truth.\nexport type LoyaltyEvent =\n  | { type: \"AccountOpened\"; customerId: string; at: string }\n  | { type: \"PointsEarned\"; orderId: string; points: number; at: string }\n  | { type: \"PointsRedeemed\"; reward: string; points: number; at: string }\n  | { type: \"PointsExpired\"; points: number; at: string };\n\nexport interface LoyaltyState {\n  balance: number;\n  version: number;\n}\n\n// evolve: (state, event) -> state. State is a left fold of the whole stream.\nexport const evolve = (s: LoyaltyState, e: LoyaltyEvent): LoyaltyState => {\n  switch (e.type) {\n    case \"AccountOpened\": return { balance: 0, version: s.version + 1 };\n    case \"PointsEarned\": return { balance: s.balance + e.points, version: s.version + 1 };\n    case \"PointsRedeemed\":\n    case \"PointsExpired\": return { balance: s.balance - e.points, version: s.version + 1 };\n  }\n};\n\nexport const rehydrate = (events: LoyaltyEvent[]): LoyaltyState =>\n  events.reduce(evolve, { balance: 0, version: 0 });\n\n// decide: (command, state) -> new events. Pure function, trivially testable.\nexport function redeem(state: LoyaltyState, reward: string, cost: number, now: Date): LoyaltyEvent[] {\n  if (state.balance < cost) throw new Error(`Balance ${state.balance} is lower than ${cost}`);\n  return [{ type: \"PointsRedeemed\", reward, points: cost, at: now.toISOString() }];\n}"}]},{"type":"codeBlock","attrs":{"language":"java","filename":"LoyaltyAccount.java"},"content":[{"type":"text","text":"public sealed interface LoyaltyEvent permits AccountOpened, PointsEarned, PointsRedeemed, PointsExpired {}\npublic record AccountOpened(UUID customerId, Instant at) implements LoyaltyEvent {}\npublic record PointsEarned(UUID orderId, int points, Instant at) implements LoyaltyEvent {}\npublic record PointsRedeemed(String reward, int points, Instant at) implements LoyaltyEvent {}\npublic record PointsExpired(int points, Instant at) implements LoyaltyEvent {}\n\npublic final class LoyaltyAccount {\n    private int balance;\n    private int version;\n\n    public static LoyaltyAccount rehydrate(List<LoyaltyEvent> history) {\n        var account = new LoyaltyAccount();\n        history.forEach(account::apply);                    // state = fold of events\n        return account;\n    }\n\n    public List<LoyaltyEvent> redeem(String reward, int cost, Instant now) {\n        if (balance < cost) throw new IllegalStateException(\"Balance \" + balance + \" is lower than \" + cost);\n        return List.of(new PointsRedeemed(reward, cost, now)); // decide, don't mutate\n    }\n\n    public void apply(LoyaltyEvent e) {\n        balance = switch (e) {                             // exhaustive thanks to the sealed interface\n            case AccountOpened o -> 0;\n            case PointsEarned p -> balance + p.points();\n            case PointsRedeemed r -> balance - r.points();\n            case PointsExpired x -> balance - x.points();\n        };\n        version++;\n    }\n\n    public int balance() { return balance; }\n    public int version() { return version; }\n}"}]},{"type":"codeBlock","attrs":{"language":"go","filename":"loyalty/account.go"},"content":[{"type":"text","text":"package loyalty\n\nimport (\n\t\"fmt\"\n\t\"time\"\n)\n\n// Event is a fact in the past tense; concrete types below.\ntype Event interface{ isEvent() }\n\ntype AccountOpened struct {\n\tCustomerID string\n\tAt         time.Time\n}\ntype PointsEarned struct {\n\tOrderID string\n\tPoints  int\n\tAt      time.Time\n}\ntype PointsRedeemed struct {\n\tReward string\n\tPoints int\n\tAt     time.Time\n}\n\nfunc (AccountOpened) isEvent()  {}\nfunc (PointsEarned) isEvent()   {}\nfunc (PointsRedeemed) isEvent() {}\n\ntype Account struct {\n\tBalance int\n\tVersion int\n}\n\n// Rehydrate folds the stream into the current state.\nfunc Rehydrate(history []Event) Account {\n\tvar a Account\n\tfor _, e := range history {\n\t\ta.Apply(e)\n\t}\n\treturn a\n}\n\nfunc (a *Account) Apply(e Event) {\n\tswitch ev := e.(type) {\n\tcase AccountOpened:\n\t\ta.Balance = 0\n\tcase PointsEarned:\n\t\ta.Balance += ev.Points\n\tcase PointsRedeemed:\n\t\ta.Balance -= ev.Points\n\t}\n\ta.Version++\n}\n\n// Redeem decides which events should happen; it does not mutate the account.\nfunc (a Account) Redeem(reward string, cost int, now time.Time) ([]Event, error) {\n\tif a.Balance < cost {\n\t\treturn nil, fmt.Errorf(\"balance %d is lower than %d\", a.Balance, cost)\n\t}\n\treturn []Event{PointsRedeemed{Reward: reward, Points: cost, At: now}}, nil\n}"}]},{"type":"codeBlock","attrs":{"language":"python","filename":"loyalty/account.py"},"content":[{"type":"text","text":"from dataclasses import dataclass, replace\nfrom datetime import datetime\nfrom functools import reduce\n\n\n# Events are facts in the past tense. They are the source of truth.\n@dataclass(frozen=True)\nclass AccountOpened:\n    customer_id: str\n    at: datetime\n\n\n@dataclass(frozen=True)\nclass PointsEarned:\n    order_id: str\n    points: int\n    at: datetime\n\n\n@dataclass(frozen=True)\nclass PointsRedeemed:\n    reward: str\n    points: int\n    at: datetime\n\n\n@dataclass(frozen=True)\nclass Account:\n    balance: int = 0\n    version: int = 0\n\n\ndef evolve(state: Account, event) -> Account:\n    match event:\n        case AccountOpened():\n            return Account(balance=0, version=state.version + 1)\n        case PointsEarned(points=p):\n            return replace(state, balance=state.balance + p, version=state.version + 1)\n        case PointsRedeemed(points=p):\n            return replace(state, balance=state.balance - p, version=state.version + 1)\n    return state\n\n\ndef rehydrate(history: list) -> Account:\n    return reduce(evolve, history, Account())\n\n\ndef redeem(state: Account, reward: str, cost: int, now: datetime) -> list:\n    if state.balance < cost:\n        raise ValueError(f\"Balance {state.balance} is lower than {cost}\")\n    return [PointsRedeemed(reward=reward, points=cost, at=now)]"}]}]}]},"toc":[{"id":"context-and-forces","text":"Context and forces","level":2,"locked":false},{"id":"structure","text":"Structure","level":2,"locked":false},{"id":"what-it-looks-like-in-code","text":"What it looks like in code","level":2,"locked":false},{"id":"event-evolution-and-personal-data","text":"Event evolution and personal data","level":2,"locked":true},{"id":"trade-offs","text":"Trade-offs","level":2,"locked":true},{"id":"adoption-path","text":"Adoption path","level":2,"locked":true},{"id":"in-practice","text":"In practice","level":2,"locked":true},{"id":"anti-patterns","text":"Anti-patterns","level":2,"locked":true},{"id":"related-topics","text":"Related topics","level":2,"locked":true},{"id":"test-yourself","text":"Test yourself","level":2,"locked":true}],"locked":true,"paywall":null,"previewRatio":0.3,"totalBlocks":36,"visibleBlocks":14,"resources":[{"id":"6b0857bf3c96f2d34d0b423b","type":"article","provider":"web","url":"https://microservices.io/patterns/data/event-sourcing.html","embedUrl":null,"title":"Microservices Pattern: Pattern: Event sourcing","description":"Use event sourcing, which persists aggregates as a sequence of domain events","author":"Chris Richardson (microservices.io)","thumbnailUrl":null,"durationSec":null,"lang":"en","topics":["event-sourcing","microservices"],"techs":["general"],"tags":["software-architecture"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"manual","publishedAt":null,"popularity":70,"verifiedAt":"2026-11-26T11:25:54.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:01:02.417Z","updatedAt":"2026-11-26T16:01:02.417Z"},{"id":"6b0857b23c96f2d34d0b355e","type":"repo","provider":"github","url":"https://github.com/oskardudycz/EventSourcing.NetCore","embedUrl":null,"title":"oskardudycz/EventSourcing.NetCore","description":"Examples and Tutorials of Event Sourcing in .NET","author":"oskardudycz","thumbnailUrl":"https://opengraph.githubassets.com/1/oskardudycz/EventSourcing.NetCore","durationSec":null,"lang":"en","topics":["cqrs","event-sourcing"],"techs":["dotnet"],"tags":["cqrs","dotnet-core","event-sourcing","example","hacktoberfest","marten","mediatr","netcore","software-architecture"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"github","publishedAt":"2017-01-28T11:21:53.000Z","popularity":69,"verifiedAt":"2026-11-26T10:58:21.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:00:50.215Z","updatedAt":"2026-11-26T16:00:50.215Z"},{"id":"6b0857a53c96f2d34d0b3216","type":"video","provider":"youtube","url":"https://www.youtube.com/watch?v=JHGkaShoyNs","embedUrl":"https://www.youtube-nocookie.com/embed/JHGkaShoyNs","title":"Greg Young - CQRS and Event Sourcing - Code on the Beach 2014","description":"","author":"Code on the Beach","thumbnailUrl":"https://i.ytimg.com/vi/JHGkaShoyNs/hqdefault.jpg","durationSec":null,"lang":"en","topics":["cqrs","event-sourcing"],"techs":["general"],"tags":[],"price":"free","featured":true,"featuredOrder":12,"packageName":null,"source":"seed","publishedAt":null,"popularity":0,"verifiedAt":"2026-11-26T00:00:00.000Z","curated":true,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:00:37.067Z","updatedAt":"2026-11-26T16:00:37.067Z"},{"id":"6b0857b23c96f2d34d0b3570","type":"repo","provider":"github","url":"https://github.com/JasperFx/marten","embedUrl":null,"title":"JasperFx/marten","description":".NET Transactional Document DB and Event Store on PostgreSQL","author":"JasperFx","thumbnailUrl":"https://opengraph.githubassets.com/1/JasperFx/marten","durationSec":null,"lang":"en","topics":["event-sourcing"],"techs":["dotnet"],"tags":["document-database","documentdb","dotnet","event-sourcing","eventsourcing","marten","databases","plv8","postgres","software-architecture"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"github","publishedAt":"2015-10-12T18:11:12.000Z","popularity":68,"verifiedAt":"2026-11-26T10:58:21.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:00:50.215Z","updatedAt":"2026-11-26T16:00:50.215Z"},{"id":"6b0857b73c96f2d34d0b3beb","type":"podcast","provider":"apple-podcasts","url":"https://podcasts.apple.com/us/podcast/wprowadzenie-do-event-sourcing-z-oskarem-dudyczem/id1477067604?i=1000607816170","embedUrl":"https://embed.podcasts.apple.com/us/podcast/id1477067604?i=1000607816170","title":"Wprowadzenie do Event Sourcing z Oskarem Dudyczem","description":"Sprawdź Patoszkolenia! ➡️ 04.06.2024 Architektura 101 ➡️ 18.06.2024 Observability Tym razem nasz gość specjalny, Oskar Dudycz, przybliży nam temat event sourcingu! Słuchasz Patoarchitektów dzięki Protopii. Sprawdź, jak Patoarchitekci i Protopia mogą Ci pomóc ➡️ protopia.tech Nasze sociale i linki…","author":"Patoarchitekci","thumbnailUrl":"https://is1-ssl.mzstatic.com/image/thumb/Podcasts221/v4/d7/43/6e/d7436e6d-b51c-6ba8-69ba-56c43c62978d/mza_16348210063467326394.jpg/600x600bb.jpg","durationSec":2803,"lang":"pl","topics":["event-sourcing"],"techs":["general"],"tags":["podcast","observability","software-architecture"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"itunes","publishedAt":"2023-04-07T06:00:02.000Z","popularity":69,"verifiedAt":"2026-11-26T10:58:53.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:00:53.924Z","updatedAt":"2026-11-26T16:00:53.924Z"},{"id":"6b0857be3c96f2d34d0b4222","type":"article","provider":"web","url":"https://martinfowler.com/articles/lmax.html","embedUrl":null,"title":"The LMAX Architecture","description":"LMAX is a retail financial trading system that can handle that can 6 million orders per second on a single JVM thread. The business logic runs in-memory surrounded by disruptors using event sourcing.","author":"Martin Fowler","thumbnailUrl":"https://martinfowler.com/articles/images/lmax/arch-full.png","durationSec":null,"lang":"en","topics":["event-sourcing"],"techs":["java"],"tags":["martin-fowler","software-architecture"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"manual","publishedAt":null,"popularity":75,"verifiedAt":"2026-11-26T11:07:26.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:00:59.965Z","updatedAt":"2026-11-26T16:00:59.965Z"}],"challenges":[{"id":"6b093dc191bd8fbaf2a0c8d0","slug":"inventory-cqrs","title":"Inventory with CQRS – separate write and read models","summary":"Warehouse commands validated on their own write model, events on a bus and a projection building a read model with a low-stock report. The read model can be rebuilt from events alone.","servedLang":"en","availableLangs":["pl","en"],"kind":"code","category":"architecture","status":"published","difficulty":"medium","topics":["cqrs","event-driven-architecture"],"techs":["typescript","javascript","python","dotnet","java","go"],"tags":["cqrs","read-model","projection","events","inventory"],"languages":["typescript","javascript","python","csharp","java","go"],"questionCount":null,"xp":20,"stats":{"attempts":0,"solves":0,"solutions":0,"comments":0},"solveRate":null,"publishedAt":"2026-11-27T08:22:25.519Z"},{"id":"6b093dc091bd8fbaf2a0c8c0","slug":"event-sourced-account","title":"Event-sourced bank account","summary":"An account aggregate whose state comes only from replaying events, an event store with optimistic concurrency and a repository that saves only new facts. Queries about past state come for free.","servedLang":"en","availableLangs":["pl","en"],"kind":"code","category":"architecture","status":"published","difficulty":"hard","topics":["event-sourcing","cqrs"],"techs":["typescript","javascript","python","dotnet","java","go"],"tags":["event-sourcing","aggregate","event-store","optimistic-concurrency","ddd"],"languages":["typescript","javascript","python","csharp","java","go"],"questionCount":null,"xp":40,"stats":{"attempts":0,"solves":0,"solutions":0,"comments":0},"solveRate":null,"publishedAt":"2026-11-27T08:22:24.935Z"}],"attachments":[],"hasCode":true,"repoUrl":null,"series":[{"slug":"architecture-path","title":"From monolith to microservices","items":[{"slug":"monolith","title":"The Monolith: one application, one deployment, and why it is often the right start","current":false},{"slug":"modular-monolith","title":"The Modular Monolith: hard boundaries without the cost of the network","current":false},{"slug":"layered-architecture","title":"Layered architecture: presentation, logic, data – and where it breaks","current":false},{"slug":"hexagonal-architecture","title":"Pierogi in the Hexagon","current":false},{"slug":"clean-architecture","title":"Clean Architecture: the dependency rule and use cases at the centre","current":false},{"slug":"onion-architecture","title":"Onion architecture: the domain model in the middle, infrastructure outside","current":false},{"slug":"vertical-slice-architecture","title":"Vertical slice architecture: code by feature, not by layer","current":false},{"slug":"cqrs","title":"CQRS: one model for changing, another for reading","current":false},{"slug":"event-sourcing","title":"Event sourcing: store the facts, not just the latest state","current":true},{"slug":"event-driven-architecture","title":"Event-driven architecture: who publishes, who listens and what can go wrong","current":false},{"slug":"microservices","title":"Microservices: independent deployments, real costs and when it pays off","current":false},{"slug":"ddd-strategic-design","title":"DDD strategic design: subdomains, bounded contexts and context maps","current":false}]}],"prev":{"slug":"cqrs","title":"CQRS: one model for changing, another for reading"},"next":{"slug":"event-driven-architecture","title":"Event-driven architecture: who publishes, who listens and what can go wrong"},"featured":false,"authorCard":{"id":"6b08bd2e80884893657cc8cf","name":"Redakcja Art of Devs","avatar":null,"handle":"redakcja","headline":"Wzorce projektowe · Architektura · AI i LLM","community":false,"reputation":{"points":3900,"level":{"key":"mentor","label":"Mentor"}},"articles":68,"skills":[{"key":"typescript","title":"TypeScript","level":5,"levelLabel":"Authority","articles":63},{"key":"dotnet","title":".NET","level":5,"levelLabel":"Authority","articles":53},{"key":"python","title":"Python","level":5,"levelLabel":"Authority","articles":52},{"key":"java","title":"Java","level":5,"levelLabel":"Authority","articles":38}]}}