varletint retweeted
When building distributed systems, people don’t realize they’ve already shipped something that might give them a crazy production issue.
For instance, you save data to your database, then publish an event to a message broker. Simple, right?
Until it isn’t.
I'll break down "Transaction Outbox Pattern" using a real-world example.
With all today's Twitter gbasgbos so I'll use the same e-commerce to explain the pattern;
So, imagine you’re building an e-commerce system. A customer places an order:
You write the order into your database.
You publish an “OrderCreated” event to Kafka (or RabbitMQ).
Now here’s the problem: these two steps are NOT atomic.
If your DB write succeeds but your event publish fails:
1. Your system now has an order that other services (inventory, payment, shipping) don’t even know exists.
If your event publish succeeds, but your DB write fails:
2. Other services react to an order that was never actually created.
This is how systems quietly corrupt themselves.
And no… wrapping both in a single transaction is not possible because:
1. Your database and your message broker are two completely different systems.
2. Distributed transactions (2PC) are slow, fragile, and rarely worth the complexity.
So what do you do?
This is where the Transaction Outbox Pattern comes in.
Instead of trying to write to the DB and publish an event at the same time, you change the flow:
You write your business data (e.g., Order)
In the SAME database transaction, you also write an “event record” into an outbox table
Now, both operations succeed or fail together. No inconsistency.
Then separately:
1. A background worker (or polling service) reads from the outbox table
2. Publishes events to your message broker
3. Marks them as processed
Now your system becomes:
Eventually consistent,
Fault-tolerant,
Retryable without duplication (if done right),
Real-world example:
Say you’re running a marketplace like Jumia.
When an order is placed:
Orders service writes to the orders table
Same transaction writes to outbox table →
{
type: "OrderCreated", payload: {...}
}
Then a worker:
Picks that row
Publishes to Kafka
Updates status → “processed”
Is Kafka down?
No problem, the event stays in the outbox and retries later.
If your app crashes?
No problem, the event is still in the DB.
This pattern solves:
Lost events
Partial failures
Inconsistent state across services
It’s one of those patterns that looks like it's stressing you out until your system scales and you realize it’s the only reason things aren’t falling apart.
In the next threads, I’ll show:
What the traditional (broken) approach looks like visually
What the outbox pattern flow looks like
Why one silently fails while the other survives real-world chaos
a robust payment system is not just about “success or failed” it’s about tracking money across its entire lifecycle with absolute consistency
I'm trying to understand how ACID based database function by implementing all the functionalities from scratch together with FSM
mixing codecs with the wrong containers and parsing stderr like a fortune teller gets your FFmpeg live recorder hanging and generating broken audio files
and this can cause playback errors
try my new live audio streaming app
saamee.vercel.app
automated stream recording 🤯
icecast mount_add - trigger recording
mount_remove - stop + upload to cloud
varletint retweeted
You're building a complex dashboard with 1000+ rows that update in real-time.
What is your go-to combo right now?
- TanStack Table + Virtualizer
- AG Grid (and pray the license fits)
- Just react-window + custom everything
- "I gave up and went full server components"
Drop your stack & why?
#react #frontend
varletint retweeted
Replying to @ConsciousRide
This is how it works:
1. Client sends request with Accept: text/event-stream
2. Server keeps connection open
3. Server sends events as data: ...\n\n lines
4. Each \n\n triggers a client-side event
5. Client uses EventSource API to listen
SSE is simpler than WebSockets when you only need server→client streaming.
varletint retweeted
Replying to @mysticwillz
I usually parse all query params at once into a clean object or dto first.
Then I chain small functions that each handle one thing like addFilter, addSearch, addSort, addPageLimitOffset.
Each function checks if the param exists and only adds the clause if it does.
This way controller stays short, just calls the chain in order and executes.
do you think implementing page view analytics could help you make more data-driven decisions for the project?
Yesterday I worked on my Icecast streaming setup.
Sounds simple. It wasn’t.
Auth flows, stream stability, reconnects, duplicate mounts
you can’t just push audio and pray.









