Skip to content

Event Sourcing

  • Similar to Redux but persisted and synced across devices
  • Core idea: Separate read vs write model
    • Read model: App database (i.e. SQLite)
    • Write model: Ordered log of all mutation events
  • Related topics
    • Domain driven design
  • Benefits
    • Simple mental model
    • Scalable
    • Flexible
      • You can easily evolve the read model based on your query patterns as your app requirements change over time
      • Automatic migrations of the read model (i.e. app database)
      • Write model can also be evolved (e.g. via versioned mutations and optionally mapping old mutations to new ones)
    • History of all state changes is captured (e.g. for auditing and debugging)
      • Foundation for syncing
  • Downsides
    • Slightly more boilerplate to manually define mutations
    • Need to be careful so mutation log doesn’t grow too much