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
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.
varletint retweeted
Very true. I use AI to write the code I don't want to write again for the 100th time, not the code I don't know how to write the first time.
As the poster says, if you let AI code above your pay grade (or in a language where that's true) you won't be able to fix any of the subtle bugs that come with it!
varletint retweeted
A surprising number of people are claiming this isn't real? Here's the parallel run I did in Cursor. Same exact prompt. Same exact codebase.
Gemini gladly wrote arbitrary code execution for a tool that LLMs use. No validation whatsoever.
varletint retweeted
I recently integrated a monitoring system, using Prometheus and Grafana, into @DevText16's platform, myzendo.vercel.app.
My contribution was made because the project is open source! Here's how the live dashboard looks:
varletint retweeted
As a React.js Developer, how many of the below concepts can you explain :
1. Fiber Architecture
2. Concurrent Mode
3. Suspense for Data Fetching
4. Passive Effects vs Layout Effects
5. Hydration
6. useTransition
7. FlushSync and Deferred Updates
8. Error Boundaries
9. React.memo vs useMemo vs useCallback
10. Context Re-renders
varletint retweeted
Replying to @jxnlco
Surprised nobody has recommended Jordan has no life: youtube.com/playlist?list=PL…
varletint retweeted
You queue a job to update user data.
While it's running, the user edits their info in the app.
Job finishes late and overwrites fresh input.
Now the DB has stale data.|
How do you prevent this?
varletint retweeted
When you're building APIs in Node.js, there are some security best practices you should follow.
These will help you harden your APIs and protect them from common threats.
In this guide, Manish shows you how to use environment variables, validate input, rate limit your endpoints, and more.
freecodecamp.org/news/how-to…
varletint retweeted
Latency vs. Throughput
Ever wondered why your app feels slow even when the bandwidth looks fine? Latency and throughput explain two very different stories of performance.
Latency measures the delay per packet. It is what users feel when they click a button. It’s responsiveness. It is the time for one request to travel from the server to the end device. This includes server processing time, queuing delays, propagation through the network, transmission delays, and the last-mile connection to the user's device.
Throughput measures volume per second. It is how much data successfully gets delivered in a given timeframe. Not how fast each packet moves, but how many packets flow through the pipe. Throughput is capacity. High throughput means the system handles the load without choking.
Over to you: How do you measure these metrics in a way that actually predicts when things will break?
--
We just launched the all-in-one tech interview prep platform, covering coding, system design, OOD, and machine learning.
Launch sale: 50% off. Check it out: bit.ly/bbg-li-posts
#systemdesign #coding #interviewtips
.
varletint retweeted
Anyone know any TS utility library for RAG?
I mean chunking algorithms, documented, in TypeScript.
Langchain has them, but all the docs are in Python.
varletint retweeted
Experiment 002 : Smooth Infinite Page Transition
Inspired by the amazing work of @__o_state on his SOTD Layrid.
Original site: layrid.tomoyaokada.com
Scale animation + progress sync + seamless image transition
Full breakdown on YouTube → youtube.com/watch?v=w7q2k_7P…
varletint retweeted
From 2026, I will start investing in Nigerian startups especially those whose founders are still very young, overlooked and don’t have access to the “circle” of Nigeria tech gatekeepers.
Yes, I will bet on those i know have potentials.
I will also speak to my friends in the US,Canada and the UK, we can form a small community of early stage investors.
It’s a possibility!
varletint retweeted
ACID clearly explained.
ACID stands for Atomicity, Consistency, Isolation, and Durability.
These are the foundations of transaction systems, 𝗲𝗻𝘀𝘂𝗿𝗶𝗻𝗴 𝗮𝗰𝗰𝘂𝗿𝗮𝘁𝗲 𝗱𝗮𝘁𝗮 𝗲𝘃𝗲𝗻 𝗶𝗻 𝘂𝗻𝗲𝘅𝗽𝗲𝗰𝘁𝗲𝗱 𝘀𝗶𝘁𝘂𝗮𝘁𝗶𝗼𝗻𝘀 𝗹𝗶𝗸𝗲 𝘀𝘆𝘀𝘁𝗲𝗺 𝗰𝗿𝗮𝘀𝗵𝗲𝘀 𝗼𝗿 𝗻𝗲𝘁𝘄𝗼𝗿𝗸 𝗳𝗮𝗶𝗹𝘂𝗿𝗲𝘀.
Let’s examine each property:
🔹 𝗔𝘁𝗼𝗺𝗶𝗰𝗶𝘁𝘆
Atomicity is a concept that 𝘁𝗿𝗮𝗻𝘀𝗮𝗰𝘁𝗶𝗼𝗻𝘀 𝗺𝘂𝘀𝘁 𝗯𝗲 "𝗮𝗹𝗹 𝗼𝗿 𝗻𝗼𝘁𝗵𝗶𝗻𝗴".
This approach is 𝗰𝗿𝗶𝘁𝗶𝗰𝗮𝗹 𝗳𝗼𝗿 𝗱𝗮𝘁𝗮 𝗶𝗻𝘁𝗲𝗴𝗿𝗶𝘁𝘆 because it 𝗲𝗹𝗶𝗺𝗶𝗻𝗮𝘁𝗲𝘀 scenarios in which just a piece of the transaction is implemented, which might result in 𝗱𝗮𝘁𝗮 𝗶𝗻𝗰𝗼𝗻𝘀𝗶𝘀𝘁𝗲𝗻𝗰𝗶𝗲𝘀 and logical errors in the database.
🔹 𝗖𝗼𝗻𝘀𝗶𝘀𝘁𝗲𝗻𝗰𝘆
Consistency 𝗽𝗿𝗼𝘁𝗲𝗰𝘁𝘀 𝗱𝗮𝘁𝗮 𝗶𝗻𝘁𝗲𝗴𝗿𝗶𝘁𝘆 by ensuring that 𝗲𝘃𝗲𝗿𝘆 𝘁𝗿𝗮𝗻𝘀𝗮𝗰𝘁𝗶𝗼𝗻 𝗰𝗵𝗮𝗻𝗴𝗲𝘀 𝘁𝗵𝗲 𝗱𝗮𝘁𝗮𝗯𝗮𝘀𝗲 𝗳𝗿𝗼𝗺 𝗼𝗻𝗲 𝘃𝗮𝗹𝗶𝗱 𝘀𝘁𝗮𝘁𝗲 𝘁𝗼 𝗮𝗻𝗼𝘁𝗵𝗲𝗿 while complying with all defined rules, such as unique keys and constraints.
This ensures that data is correct and accessible following the stated business logic and database structure.
🔹 𝗜𝘀𝗼𝗹𝗮𝘁𝗶𝗼𝗻
In a database system where numerous transactions are completed concurrently, isolation guarantees that 𝗲𝗮𝗰𝗵 𝘁𝗿𝗮𝗻𝘀𝗮𝗰𝘁𝗶𝗼𝗻 𝗯𝗲𝗵𝗮𝘃𝗲𝘀 𝗮𝘀 𝗶𝗳 𝗶𝘁 𝘄𝗲𝗿𝗲 𝘁𝗵𝗲 𝗼𝗻𝗹𝘆 𝗼𝗻𝗲 𝗯𝗲𝗶𝗻𝗴 𝗽𝗲𝗿𝗳𝗼𝗿𝗺𝗲𝗱 𝗮𝘁 𝘁𝗵𝗲 𝘁𝗶𝗺𝗲.
Isolation contributes to data correctness and integrity by making sure that 𝗰𝗼𝗻𝗰𝘂𝗿𝗿𝗲𝗻𝘁 𝗮𝗰𝘁𝗶𝘃𝗶𝘁𝗶𝗲𝘀 𝗱𝗼 𝗻𝗼𝘁 𝗿𝗲𝘀𝘂𝗹𝘁 𝗶𝗻 𝗱𝗮𝘁𝗮 𝗮𝗻𝗼𝗺𝗮𝗹𝗶𝗲𝘀 𝗼𝗿 𝗰𝗼𝗿𝗿𝘂𝗽𝘁𝗶𝗼𝗻.
🔹 𝗗𝘂𝗿𝗮𝗯𝗶𝗹𝗶𝘁𝘆
Database modifications are protected against system failures by durability, which 𝗴𝘂𝗮𝗿𝗮𝗻𝘁𝗲𝗲𝘀 𝘁𝗵𝗮𝘁 𝗼𝗻𝗰𝗲 𝗮 𝘁𝗿𝗮𝗻𝘀𝗮𝗰𝘁𝗶𝗼𝗻 𝗶𝘀 𝗰𝗼𝗺𝗺𝗶𝘁𝘁𝗲𝗱, 𝗶𝘁 𝘀𝘁𝗮𝘆𝘀 𝘁𝗵𝗮𝘁 𝘄𝗮𝘆.
ACID principles form the backbone of database integrity, enabling precise and reliable transaction management. Their application is essential for ensuring data consistency across applications.
--
Thanks to our partner Box who keeps our content free to the community.
𝗕𝗼𝘅 & 𝗗𝗲𝗲𝗽𝗹𝗟𝗲𝗮𝗿𝗻𝗶𝗻𝗴 have released a 𝘀𝗵𝗼𝗿𝘁 𝗰𝗼𝘂𝗿𝘀𝗲 where you'll 𝗯𝘂𝗶𝗹𝗱 𝗮 𝗺𝘂𝗹𝘁𝗶-𝗮𝗴𝗲𝗻𝘁 𝘀𝘆𝘀𝘁𝗲𝗺.
𝗔𝘁 𝘁𝗵𝗲 𝗺𝗼𝗺𝗲𝗻𝘁 𝗶𝘁'𝘀 𝗳𝗿𝗲𝗲 too. This won't last forever though.
Check it out (while it's free): lucode.co/box-deeplearning-a…
varletint retweeted
If you want to get started with system design (I'm not joking), learn these 14 concepts:
varletint retweeted
𝗥𝗔𝗚 (Retrieval Augmented Generation) vs. Memory
These two terms are often confused, but they play very different roles.
RAG grounds an LLM with external knowledge.
A query is embedded, matched against a vector store, and the top k-chunks are injected into context.
Memory is broader.
It is a system that stores, processes, and later retrieves distilled knowledge that supports decisions. It is not long context or raw logs. It captures salient facts, preferences, learned inferences and keeps them available across sessions.
Here are four ways they differ 👇
1. Statefulness -
• RAG resets every time unless you stuff history back into the prompt.
• Memory persists, retaining distilled context across sessions so the agent can build on past interactions rather than starting fresh.
2. Adaptability -
• RAG serves chunks as indexed.
• Memory evolves what it knows. It consolidates overlapping entries, overwrites outdated items, prunes low value details, and maintains a single source of truth so recall stays consistent as reality changes.
3. Personalisation -
• RAG treats queries uniformly.
• Memory represents user specific facts and preferences, identity, and style, which lets agents answer in a way that feels tuned to the person, not just to the question of the moment.
4. Temporal awareness -
• RAG does not natively reason over time, so old and new can coexist.
• Memory tracks recency and applies update or delete operations to resolve contradictions and keep the freshest truth at hand.
RAG is one tool inside memory, specifically the retrieval step. True memory is the intelligence layer that decides what to remember, what to forget, and when to recall.
That’s what we’re building with Mem0, the universal memory layer for AI agents.
varletint retweeted
𝗪𝗵𝗮𝘁 𝗶𝘀 𝘁𝗵𝗲 𝘀𝗶𝗻𝗴𝗹𝗲 𝗺𝗼𝘀𝘁 𝗵𝗲𝗹𝗽𝗳𝘂𝗹 𝘀𝘁𝗿𝗮𝘁𝗲𝗴𝘆 𝘁𝗼 𝗶𝗺𝗽𝗿𝗼𝘃𝗲 𝘆𝗼𝘂𝗿 𝗮𝗽𝗽'𝘀 𝗽𝗲𝗿𝗳𝗼𝗿𝗺𝗮𝗻𝗰𝗲?
It is to 𝗰𝗮𝗰𝗵𝗲 (𝗮𝗹𝗺𝗼𝘀𝘁) 𝗲𝘃𝗲𝗿𝘆𝘁𝗵𝗶𝗻𝗴! Caching stores copies of frequently accessed data in a readily accessible location, reducing access time and offloading primary data sources.
The advantages of caching include faster data retrieval, reduced load on primary data stores, and an improved user experience.
Don't cache only database queries, as reading from cache is much faster than an API call.
How do you 𝗱𝗲𝗰𝗶𝗱𝗲 to cache something? The better question is, why not cache something?
Adding a cache comes with costs, so for each candidate, we need to 𝗲𝘃𝗮𝗹𝘂𝗮𝘁𝗲 the following:
🔹 Is it faster to hit cache?
🔹 Is it worth storing?
🔹 How often do we need to validate?
🔹 How many hits per cache entry will we get?
🔹 Is it local or shared cache?
However, cached data can be stale, so there may be situations in which it is inappropriate.
To determine the success of your cache, you can monitor metrics such as cache misses.
There are 𝗰𝗮𝗰𝗵𝗶𝗻𝗴 𝘀𝘁𝗿𝗮𝘁𝗲𝗴𝗶𝗲𝘀:
𝟭. 𝗖𝗮𝗰𝗵𝗲-𝗔𝘀𝗶𝗱𝗲: The application manually manages data storage and retrieval from the cache. Data is fetched from the primary storage on a cache miss and then added to the cache.
𝟮. 𝗥𝗲𝗮𝗱-𝗧𝗵𝗿𝗼𝘂𝗴𝗵: When a cache miss occurs, the cache automatically loads data from the primary storage. It simplifies data retrieval by handling cache misses internally.
𝟯. 𝗪𝗿𝗶𝘁𝗲-𝗔𝗿𝗼𝘂𝗻𝗱: Data is written directly to the primary storage, bypassing the cache. This strategy is effective when writes are frequent, and reads are less common.
𝟰. 𝗪𝗿𝗶𝘁𝗲-𝗕𝗮𝗰𝗸: Data is first written to the cache and later synchronized with the primary storage. This reduces the number of write operations but risks data loss if the stock fails to sync before it is updated.
𝟱. 𝗪𝗿𝗶𝘁𝗲-𝗧𝗵𝗿𝗼𝘂𝗴𝗵: Data is simultaneously written to both the cache and the primary storage, ensuring consistency but potentially increasing write latency. Ideal for scenarios where data integrity is crucial.



























