Li

Light implementation of Event Sourcing using PostgreSQL as event store

Hacker News

Light implementation of Event Sourcing using PostgreSQL as event store

Hi everyone, If you have a Java Spring Boot application with a PostgreSQL database, you can implement Event Sourcing without introducing new specialized databases or frameworks. If you have an application dealing with an entity called Order, you should adopt Event Sourcing to keep track of all changes, and know how the Order got into the current state. Event Sourcing gives you: 1. the true history of the system (audit and traceability), 2. the ability to put the system in any prior state (debugging), 3. the ability to create read projections from events as needed to respond to new demands. There are several well-known specialized frameworks and databases for Event Sourcing: EventStoreDB, Marten, Eventuate, to name a few. But adopting a new framework or database you are not familiar with may stop you from trying the Event Sourcing pattern in your project. But you can actually implement Event Sourcing with a few classes and use PostgreSQL as an event store. The "postgresql-event-sourcing" project is a reference implementation of an event-sourced system that uses PostgreSQL as an event store built with Spring Boot. Fork the repository and use it as a template for your projects. Or clone the repository and run end-to-end tests to see how everything works together. The project describes in detail: - database model for storing events, - synchronous and asynchronous event handlers, - CQRS, - Transactional Outbox pattern, - Polling Publisher pattern, - optimized publisher that uses PostgreSQL LISTEN/NOTIFY capabilities, - and more. This project can be easily extended to comply with your domain model. The source code is available on GitHub < https://github.com/eugene-khyst/postgresql-event-sourcing >.

Share card

Actual performance

231points
47comments
Made the leaderboard

Launch Intel predictions

Analyze your own launch →
Indie HackersFits the IH revenue-focused audience · Missing: supports, reddit linkedin, podcasting
81%81% predicted probability of success on Indie Hackers, based on ML models trained on real launch data.
best fitHighest predicted score across all platforms for this description.
Product HuntOn track for Day 1 leaderboard · Strong signals: model, new, using · Missing: mac, agents, macos
60%60% predicted probability of success on Product Hunt, based on ML models trained on real launch data.
Hacker NewsStrong engagement from HN community · Strong signals: io · Missing: https docs, excited, just released
56%56% predicted probability of success on Hacker News, based on ML models trained on real launch data.
nativeThis product was originally launched on this platform.
TrustMRRLess likely to generate early MRR · Missing: mobile apps, ios, personal
39%39% predicted probability of success on TrustMRR, based on ML models trained on real launch data.
AppSumoMay struggle as an AppSumo deal · Missing: plus, platform, intuitive
32%32% predicted probability of success on AppSumo, based on ML models trained on real launch data.
Acquire.comPre-revenue stage for this audience · Missing: arr, mrr, revenue
11%11% predicted probability of success on Acquire.com, based on ML models trained on real launch data.
BetaListMay not resonate with beta-testers · Missing: web3, chat, crypto
0%0% predicted probability of success on BetaList, based on ML models trained on real launch data.

Correct prediction on native model

Similar products

To
TodoMVC using DDD, CQRS and event-sourcing42%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

TodoMVC using DDD, CQRS and event-sourcing

Hacker News12
Ev
Event Sourcing with RxJs43%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Event Sourcing with RxJs

Hacker News3
Ev
Event Sourcing Platform44%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Event Sourcing Platform

Hacker News2
GO
GO ES – Golang event sourcing made easy46%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

GO ES – Golang event sourcing made easy

Hacker News4
Le
Learn what DDD, CQRS, and event-sourcing are all about49%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Learn what DDD, CQRS, and event-sourcing are all about

Hacker News138
I
I wrote a book on implementing DDD, CQRS and Event Sourcing59%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

I wrote a book on implementing DDD, CQRS and Event Sourcing

Hacker News169
SS
SSO for PostgreSQL Using OAuth2/OIDC58%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

SSO for PostgreSQL Using OAuth2/OIDC

Hacker News1
Pu
PumpkinDB, an event sourcing database engine57%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

PumpkinDB, an event sourcing database engine

Hacker News190
Fl
Flushout - A distributed data model based on event sourcing57%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Flushout - A distributed data model based on event sourcing

Hacker News3
He
Hekla, an event sourcing runtime with its own language50%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Hekla, an event sourcing runtime with its own language

Hacker News1