Ironflow Event Sourcing Flow

Ironflow Event Sourcing Flow A data-flow diagram generated by Archify. 01 / Append 02 / Entity stream 03 / Replay 04 / Project 05 / Consume Client append · streams.append() · 01 / Append · expectedVersion Client append streams.append() expectedVersion Version conflict · nothing written · 02 / Entity stream · read, then retry Version conflict nothing written read, then retry Entity stream · append-only events · 02 / Entity stream · v1..v4 Entity stream append-only events v1..v4 NATS publish · entity event fan-out · 02 / Entity stream NATS publish entity event fan-out Upcaster registry · old shape to current · 03 / Replay · v1 to v3 Upcaster registry old shape to current v1 to v3 Managed projection · pure reducer · 04 / Project Managed projection pure reducer External projection · your own cursor · 04 / Project External projection your own cursor Read model · materialized state · 05 / Consume Read model materialized state Side effects · HTTP, writes, alerts · 05 / Consume Side effects HTTP, writes, alerts version mismatch version matches publish entity event replay from v1 current-shape events current-shape events reduce into state act on each event Legend primary data policy / PII async batch data store data flow

Optimistic concurrency

  • • Every append carries expectedVersion; it must equal the current stream version
  • • A mismatch rejects the whole append — read the stream again and retry
  • • Events are immutable once written, so history never changes shape in place

Upcasters, not migrations

  • • OrderCreated v1 { amount } to v2 { amount, currency } to v3 { total: { amount, currency } }
  • • The transform runs on replay, so old rows stay exactly as they were stored
  • • Register one upcaster per version step and the chain composes

Two kinds of projection

  • • Managed: a pure reducer, cursor owned by the server, safe to rebuild any time
  • • External: side effects allowed, and you own the cursor and the replay story