Skip to main contentOverview
Event sourcing architectures treat S2 streams as a strongly consistent shared write-ahead log, from which state can be materialized. Instead of storing current state directly, you store a sequence of events that led to that state. This pattern typically involves a process or serverless function that performs the materialization, using S2 to achieve durability and enable state reconstruction.
Events are appended to the stream as they occur, and one or more consumers read the stream to materialize state. Because S2 streams are durable and support reading from any point in history, you can rebuild state from scratch or create new materialized views at any time.
Examples
Key-value store
S2 can be used as the WAL for a distributed, strongly-consistent key-value database. See this blog post for a detailed walkthrough and code examples.