Skip to content

epikweb/pg-journal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

65 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🐘 pg-journal

license beta

🐘 pg-journal is a Proof of Concept Application Layer Event Sourcing inspired by:

The Goal:

  • Rely completely on 🐘 PostgreSQL for the entire OLTP/messaging stack to reduce operational complexity
  • Provide a composable set of packages without lock-in that can be used to selectively apply CQRS/Event Sourcing in real world apps where its needed
  • Provide non-CRUD examples of modeling real world complex domains

Update

I've decided to not spend further time developing this approach due to its high cost and complexity (event sourcing on the application layer). Cons discovered:

  • Reinventing powerful SQL operation such as group by/joins on the application layer
  • Slow read model rebuild times with a large dataset
  • Versionining online read models becomes a huge problem

Approaches such as Lambda Architecture and Kappa Architecture have been shown to be scalable to petabytes whereas this approach does not. The batch processing side can be implemented by reading Postgres disk files and running a large Spark cluster on it, and stream processing done using Kinesis + Spark Streams.

I will start another project investigating Lambda Architecture using Postgres (with CDC) for the entire stack with Spark + Kinesis.

🏷 Features

  • βœ… Event store
  • βœ… Guaranteed global ordering/gap handling for read models (projections)
  • βœ… Opinionated projectors for postgres
  • βœ… Real world example apps
  • βœ… Performance tests & reports

πŸ§ͺ Contributing

Pull requests/maintainers are welcome! πŸ˜ƒ

  • Tests should be green
  • Linting should pass

Install dev dependencies & run tests in a specific package:

$ yarn
$ yarn workspace fact-pg-journal test

πŸ’‘ License

This project is licensed under the terms of the Apache 2.0 license.