<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
  <title>abubakar yinusa: writing</title>
  <link>https://abubakar-yinusa.vercel.app/writing/</link>
  <description>notes from building things.</description>
  <item>
    <title>Jensen-level influence</title>
    <link>https://abubakar-yinusa.vercel.app/writing/jensen-level-influence/</link>
    <guid>https://abubakar-yinusa.vercel.app/writing/jensen-level-influence/</guid>
    <pubDate>Tue, 24 Nov 2026 12:00:00 +0000</pubDate>
    <description>nvidia lost its ceo for eleven days. here&#x27;s what i watched happen, and where i landed.</description>
    <content:encoded><![CDATA[<p>I remember when I first saw it. I was scrolling through Twitter, as I usually do, and I think it was at night. There was a post saying Nvidia's board was investigating Jensen Huang for something.</p>
<p>I'll be very honest. I wasn't really that into this whole story. What caught my interest was the sequence of events, and how there were two sides to it online. I'll give my own stance at the end.</p>
<h2>The Toddler and the Toy</h2>
<p>Then it came out that he'd had an affair with a woman alleged to be working for Chinese intelligence, and everything was going to shit, essentially. People were asking how this happened, and whether they were going to oust him.</p>
<p>On November 12, he resigned as CEO of Nvidia. Immediately, the stock market decided to have a teenage meltdown.</p>
<p>That's honestly what I equate it to. It's like when a toddler throws a tantrum because you took away his favourite toy. Nvidia opened 13% down, as much as 14% at the worst point that morning. Nvidia alone lost $549 billion at the open, and the whole US market lost about $700 billion.</p>
<blockquote class="twitter-tweet" data-dnt="true" data-align="center"><p lang="en" dir="ltr">$700 billion has been wiped out from the US stock market at the open.</p>&mdash; Bull Theory (@BullTheoryio) <a href="https://twitter.com/BullTheoryio/status/2120889270806483186">November 12, 2026</a></blockquote>

<h2>Two Sides</h2>
<p>The next few days were the meat of it, because people had very strong stances.</p>
<p>A lot of what I saw online, and that's probably just my side of Twitter, was people supporting him. Why would you push someone out over a personal situation?</p>
<p>Then reports came out about a second affair, and later a third. The stock kept going to shit. By the Friday before he came back, Nvidia had lost about $1.2 trillion in value since the day before he resigned. Everything was unravelling, and there was this dark cloud of uncertainty over the whole thing.</p>
<p>A lot of people wanted Jensen back. There was a petition going around, "Stand with Jensen". By November 14 it had over 100,000 signatures, including close to 6,000 people who said they work at Nvidia, and names like Elon Musk.</p>
<p>A lot of people were skeptical too, of course, because of the whole Chinese spy situation. A woman alleged to be working for Chinese intelligence, close to the man who runs the most important chip company in the world, is not a small thing. To be clear, nobody has shown that he knowingly gave anything away, and the investigation was still going.</p>
<p>Then, the week after he resigned, Nvidia's board said it did not intend to bring him back. That felt like the end of it.</p>
<h2>My Stance</h2>
<p>Towards the end of the whole saga, I finally had a stance. I think Jensen shouldn't have been ousted, and it comes down to two things.</p>
<p><strong>One: being unfaithful is wrong.</strong> I don't think it should be treated as a quote-unquote child move. I saw people saying, "He's a billionaire, what do you expect?" I don't know. I've never been a billionaire, so I don't know how it feels, and I won't pretend to. I'm just saying that personally, I think being unfaithful to your wife is wrong.</p>
<p><strong>Two: that is nowhere near grounds to make someone leave something they built from the ground up into this mega empire.</strong> Jensen is unique in that when you think about Nvidia, you immediately think about Jensen. There are only a few people with that kind of pull. When you think about Apple, you think about Steve Jobs, probably even more than Tim Cook. When you think about Facebook, or Meta, you think about Mark Zuckerberg. Jensen is one of those mega figures, so heavily tied to what they created that removing them was always going to be catastrophic.</p>
<p>To be clear about where I stand: if it turns out he did give anything away, that should be investigated properly, and there should be some damage control. But I still don't think he should be ousted.</p>
<h2>The Comeback</h2>
<p>Then yesterday, November 23, the board reinstated him. It was insane.</p>
<p>I remember laughing to myself and thinking, Nvidia's stock is going to go up. It did. Nvidia closed up 31%, adding almost a trillion dollars in one day. About $3.5 trillion was added to the US market at the open.</p>
<blockquote class="twitter-tweet" data-dnt="true" data-align="center"><p lang="en" dir="ltr">$3.5 trillion added to the US market at open.</p>&mdash; Bull Theory (@BullTheoryio) <a href="https://twitter.com/BullTheoryio/status/2124874606515560891">November 23, 2026</a></blockquote>

<p>And I thought, yep, someone definitely made a shit ton of money on this. Sure enough, one post went viral claiming a trader had put $3.4 million on Nvidia options the Friday before, and that they were worth $312 million by Monday. I can't verify that, and neither can anyone else yet, but it tells you how much was riding on one man's job.</p>
<blockquote class="twitter-tweet" data-dnt="true" data-align="center"><p lang="en" dir="ltr">JUST IN: Last Friday, an undisclosed trader spent $3.4 million on $NVDA $160 calls expiring today which is now worth $312 million, a roughly 9,000% gain, after Jensen Huang was reinstated as Nvidia CEO this morning. Who could it be?</p>&mdash; Liquid (@liquidtrading) <a href="https://twitter.com/liquidtrading/status/2124889413172031894">November 23, 2026</a></blockquote>

<h2>Jensen-Level Influence</h2>
<p>What I took away from all this is that this whole AI thing is still, in my opinion, not unstable exactly, but very susceptible to outside influence: news, scandals, one person's decisions. As anything is. But I did not expect Nvidia to crash the way it did solely because one person left.</p>
<p>It also shows how much influence one person can have. I think it might become a new phrase: this guy has Jensen-level influence. Meaning it's insane, the kind of influence that is crazy. Imagine: you leave, they put you back eleven days later, and the market adds almost a trillion dollars to your company in a day. Fortune literally ran it as Wall Street putting a $1 trillion price on Jensen Huang.</p>
<p>I think what's interesting now is watching how everything else develops. The board's investigation is still running, and Congress wants to talk to him on December 1. This isn't over.</p>
<p>Next, I'm going to write about Anthropic's IPO, and what I think about it.</p>
<script>
  // X's official embeds. They follow the site's light or dark mode; if X can't load, each quote still reads as text.
  document.querySelectorAll('.twitter-tweet').forEach(function (q) { q.dataset.theme = document.documentElement.dataset.theme === 'dark' ? 'dark' : 'light'; });
  var x = document.createElement('script'); x.async = true; x.src = 'https://platform.twitter.com/widgets.js'; document.body.appendChild(x);
</script>

<hr />
<p><em>Header photo: Jensen Huang, by the Office of the President, Republic of China (Taiwan), <a href="https://creativecommons.org/licenses/by/2.0/">CC BY 2.0</a>. Whole-market posts: <a href="https://x.com/BullTheoryio">@BullTheoryio</a> on X, embedded. Options post: <a href="https://x.com/liquidtrading/status/2124889413172031894">@liquidtrading</a> on X, embedded.</em></p>
<p><em>Sources: <a href="https://nvidianews.nvidia.com/news/nvidia-board-reinstates-jensen-huang-as-president-ceo-and-board-director">Nvidia's reinstatement announcement</a>, <a href="https://www.cnbc.com/2026/11/23/nvidia-jensen-huang-ceo.html">CNBC on the 31% day</a>, <a href="https://fortune.com/2026/11/23/wall-street-1-trillion-jensen-huang-nvidia-stock-market-cap/">Fortune on the $1 trillion</a>, <a href="https://qz.com/nvidia-huang-resigns-largest-market-value-wipeout-111226">Quartz on the November 12 drop</a>, <a href="https://techcrunch.com/2026/11/14/elon-musk-other-tech-execs-sign-petition-calling-on-nvidia-to-reinstate-jensen-huang/">TechCrunch on the petition</a>, <a href="https://www.npr.org/2026/11/08/nx-s1-6034036/nvidia-launches-investigation-into-ceos-alleged-relationship-with-chinese-spy">NPR on the investigation</a>, <a href="https://www.axios.com/2026/11/23/trump-vance-jensen-huang-nvidia-ceo-return">Axios on the December 1 interviews</a>.</em></p>]]></content:encoded>
  </item>
  <item>
    <title>One review cost 490,000 tokens. Now it costs about 32,000</title>
    <link>https://abubakar-yinusa.vercel.app/writing/the-490000-token-review/</link>
    <guid>https://abubakar-yinusa.vercel.app/writing/the-490000-token-review/</guid>
    <pubDate>Tue, 24 Nov 2026 12:00:00 +0000</pubDate>
    <description>an ai agent i worked on was spending 490,000 tokens on every review. where they went, and how we got it to about 32,000.</description>
    <content:encoded><![CDATA[<p>I work on an AI agent that reviews cases, one at a time. It pays an AI company for every word it reads and writes.</p>
<p>The prepaid balance behind it ran out much faster than anyone expected. That made me ask a question nobody had asked yet: what does one review actually cost?</p>
<p>The answer was about 490,000 tokens. A token is a piece of a word, and AI companies bill by them. This is what I learned getting that number down.</p>
<h2>Read the Error Before You Guess</h2>
<p>The first thing I got wrong was guessing. The agent was failing, and I spent time reasoning about rate limits before I read the actual error text closely. It said "You have no credits remaining." One line settled what an hour of reasoning couldn't.</p>
<p>It also answered the most useful question: is this their problem or ours? If an AI company is having an outage, you wait. If the problem is on your side, you act. Nothing was broken on their end. Everything that made it expensive was in our code.</p>
<h2>Three Numbers, Multiplied</h2>
<p>Cost turned out to be three numbers multiplied together, and nobody was watching the total.</p>
<p><strong>How many reviews ran.</strong> Clearing a pile of waiting work all at once means dozens of reviews back to back. A balance that looks fine for a normal day can empty in half an hour.</p>
<p><strong>How big each review was.</strong> This was the surprise. Where did 490,000 come from? An agent works in steps. It reads its instructions, decides what to look up, looks it up, and goes again. A review took about 11 steps. Every step sent about 28,000 tokens of instructions and tool descriptions again, and re-read every result gathered so far. So the cost doesn't grow step by step. It snowballs.</p>
<p><img alt="One bar split in two: about 308,000 tokens were the same instructions and tool descriptions sent again on all 11 steps, and about 182,000 were everything else." src="https://abubakar-yinusa.vercel.app/assets/writing/the-490000-token-review/split.webp" /></p>
<p><strong>How much was wasted.</strong> A failed review was retried up to 5 times, from scratch, and every try was paid for. A case whose review gave up was put back in the queue by an hourly sweep, forever. So a broken case could be paid for again and again, with nobody noticing.</p>
<p><img alt="A timeline of one failed review: five paid tries with waits of 5, 10, 20 and 40 minutes, then the case is queued again." src="https://abubakar-yinusa.vercel.app/assets/writing/the-490000-token-review/loop.webp" /></p>
<h2>Stop the Bleeding First</h2>
<p>A loop or a retry multiplies everything else, so those went first.</p>
<ul>
<li><strong>No more endless loop.</strong> After 3 failed runs, the sweep stops re-queueing a case. A person can still press retry.</li>
<li><strong>Fewer paid retries.</strong> Not all failures cost the same. If the AI company refuses straight away, you pay nothing, so it can keep its 5 tries. If the model did 10 steps of work and then timed out, you paid for all of it. Those now get 2 tries, not 5.</li>
<li><strong>A speed limit for big piles of work.</strong> A set number of reviews run at once, and the whole pass stops the moment the AI company says "slow down" or "no credit".</li>
<li><strong>Pause instead of retry.</strong> When there's no credit, a review keeps its place in line and doesn't count as a failure. The queue waits, tests again every 15 minutes, and carries on by itself once the money is back.</li>
</ul>
<p>That last one sounds small. Without it, a case could get flagged for a person because <em>we</em> ran out of credit. That's our problem, not the case's.</p>
<h2>Then Make Each Review Smaller</h2>
<p>With the waste stopped, the next lever was the 490,000.</p>
<p><strong>Shorter tool descriptions.</strong> The descriptions of the tools the agent could use were about 9,700 tokens on their own, sent on every step. Each kind of record had its own tool, each with a long explanation. Now every kind is one short line, and the long explanation comes back with the result, only when that kind is actually read. That took 9,700 tokens down to about 2,600. Tools it never used are gone completely.</p>
<p><strong>Code gathers the facts first.</strong> On every review, the model was spending most of its steps looking up the same basic facts it always needs. Now plain code reads those first and hands the model one short sheet in its first message. The model only goes looking when it finds something worth chasing.</p>
<p><strong>Cache what repeats.</strong> The instructions that are the same on every step are now reliably cached, so after the first step they cost about a tenth.</p>
<p><strong>Smaller results.</strong> Long results are cut off, and lists come back 10 rows at a time unless the model asks for more.</p>
<p>One thing I didn't do: put a cap on tokens per review. The obvious move was to stop the model at 90,000 tokens. But a token cap stops the model exactly when a case is unusual and needs a closer look. So 90,000 is a target for the average, not a wall. The only hard limits are a cap on lookups per review and a spending limit per run, which catch a model that gets stuck, not one that is being careful.</p>
<h2>The Numbers, Honestly</h2>
<p><img alt="One review before and after: tool descriptions went from about 9,700 tokens to 2,600, and tokens per review from about 490,000 to about 32,000, measured over 50 reviews." src="https://abubakar-yinusa.vercel.app/assets/writing/the-490000-token-review/after.webp" /></p>
<p>A failed review used to be paid for up to 5 times and then loop forever. Now it's paid for at most twice, and a failure because of no credit costs nothing and waits.</p>
<p>Before the fixes went live, all I had was an estimate from the size of the requests: about 140,000 tokens a review.</p>
<p>The real number came in far lower. Over the first 50 reviews, a review used about 32,000 tokens on average, and it held there over more than 200. That's about 458,000 fewer than before, a cut of about 93%. These numbers are from our own tracking. I haven't checked them against the AI company's bill yet, and I will.</p>
<p>That also means my plan was off. I expected about 21,000 tokens of instructions to go out on each of 4 or 5 steps. That alone would be well over 32,000. So the real reviews are taking fewer steps, or reading less each step, than I planned for. That's the next thing to measure.</p>
<h2>A Dashboard Is Not an Alert</h2>
<p>A page that shows the balance wouldn't have helped, because nobody is looking at a page at 2am.</p>
<p>So now there are checks every 10 minutes: out of credit, reviews stalled, failure rate, spend per hour and per day, cost per review, a growing backlog. Each one posts when it starts, again every 2 hours while it lasts, and once when it clears.</p>
<h2>What I'd Tell Myself Next Time</h2>
<ol>
<li><strong>Read the error before you guess.</strong> One line of real error text beats an hour of reasoning.</li>
<li><strong>Ask "ours or theirs?" first.</strong> It decides whether you wait or act.</li>
<li><strong>Look for multipliers.</strong> Cost is volume × size × waste. Fix the loop and the retries before anything else.</li>
<li><strong>Free failures and paid failures are different.</strong> Retry rules should know which is which.</li>
<li><strong>Measure before cutting.</strong> Knowing what made up the 490,000 is what made the savings obvious.</li>
<li><strong>A dashboard is not an alert.</strong></li>
<li><strong>Merged is not live.</strong> Check the deploy happened before you judge a fix.</li>
</ol>
<p>The agent itself was fine the whole time. It did what we asked it to, and it did it 490,000 tokens at a time.</p>]]></content:encoded>
  </item>
  <item>
    <title>How to accept mobile money payments in Kenya and Ghana</title>
    <link>https://bachs.io/blog/how-to-accept-mobile-money-payments-kenya-ghana</link>
    <guid>https://bachs.io/blog/how-to-accept-mobile-money-payments-kenya-ghana</guid>
    <pubDate>Sat, 24 Oct 2026 12:00:00 +0000</pubDate>
    <description>how m-pesa and mtn momo payments work, and how to accept them without a local business</description>
    <content:encoded><![CDATA[]]></content:encoded>
  </item>
  <item>
    <title>How to charge USD subscriptions from Nigeria</title>
    <link>https://bachs.io/blog/how-to-charge-usd-subscriptions-from-nigeria</link>
    <guid>https://bachs.io/blog/how-to-charge-usd-subscriptions-from-nigeria</guid>
    <pubDate>Sat, 24 Oct 2026 12:00:00 +0000</pubDate>
    <description>billing international customers in usd: recurring card payments, failed-payment recovery, trials and getting the dollars out</description>
    <content:encoded><![CDATA[]]></content:encoded>
  </item>
  <item>
    <title>How to test webhooks locally without ngrok or a tunnel</title>
    <link>https://bachs.io/blog/bachs-cli-test-webhooks-locally</link>
    <guid>https://bachs.io/blog/bachs-cli-test-webhooks-locally</guid>
    <pubDate>Fri, 09 Oct 2026 12:00:00 +0000</pubDate>
    <description>forward real, signed webhook events to localhost, trigger test events and replay failures from the bachs cli</description>
    <content:encoded><![CDATA[]]></content:encoded>
  </item>
  <item>
    <title>Virtual accounts in Nigeria: a permanent number for bank transfers</title>
    <link>https://bachs.io/blog/virtual-accounts-nigeria-bank-transfer</link>
    <guid>https://bachs.io/blog/virtual-accounts-nigeria-bank-transfer</guid>
    <pubDate>Fri, 09 Oct 2026 12:00:00 +0000</pubDate>
    <description>a permanent ngn account number customers can save and pay any time</description>
    <content:encoded><![CDATA[]]></content:encoded>
  </item>
  <item>
    <title>Going through Warp&#x27;s policy assignment take-home</title>
    <link>https://abubakar-yinusa.vercel.app/writing/warp-policy-assignment/</link>
    <guid>https://abubakar-yinusa.vercel.app/writing/warp-policy-assignment/</guid>
    <pubDate>Wed, 02 Sep 2026 12:00:00 +0000</pubDate>
    <description>designing a rule engine that decides which policy applies to which employee</description>
    <content:encoded><![CDATA[<p>I went through Warp's policy assignment take-home this week. Once I actually sat down with it, it was less daunting than I thought.</p>
<p><img alt="Warp's problem statement for the take-home: the kinds of policies employees can have, and the kinds of rules that assign them." src="https://abubakar-yinusa.vercel.app/assets/writing/warp-policy-assignment/1.webp" /></p>
<h2>The Problem</h2>
<p>Warp is basically the system that manages a company's people stuff: payroll, benefits, time off, app access, compliance training, all of it. Every one of those needs some kind of policy that decides who gets what.</p>
<ul>
<li>If you've been there 2 years, you get better vacation.</li>
<li>If you're in California, you sign the meal break policy.</li>
<li>If you're in engineering, you get GitHub access.</li>
</ul>
<p>The company writes rules. Employees fall under whatever rules apply to them. The ask: design the system that works all of that out and keeps it correct.</p>
<h2>A Rule Is Not a Policy</h2>
<p>What unlocked it for me was separating "rule" from "policy". I kept mixing those up at first.</p>
<p><strong>A policy is the actual thing</strong>, like Senior Vacation.</p>
<p><strong>A rule is the condition</strong> that decides when someone gets it, like "tenure ≥ 2 years → Senior Vacation".</p>
<p>Once that split was clear in my head, the rest of the problem got a lot less scary. In the final design, three things do almost all the work: the policy, the rule, and the slot the rule competes for, like vacation or app access. Every rule reads the same way:</p>
<p><img alt="If tenure is at least 2 years for this employee, assign Senior Vacation to the vacation slot, with priority 10." src="https://abubakar-yinusa.vercel.app/assets/writing/warp-policy-assignment/rule.webp" /></p>
<p>Stripped down, a rule in the data model is just this:</p>
<pre><code>RULE {
    uuid   slot_id
    string condition_type
    json   condition_value
    int    priority
    uuid   policy_id
}
</code></pre>
<h2>Which Rule Wins</h2>
<p>The part that made me think hardest was conflicts. What happens when two rules both apply to the same employee for the same slot? Say someone's tenure rule says Senior Vacation, but their employment type rule says Standard Vacation. Which one wins?</p>
<p>My first instinct was some kind of hierarchy, like department always beats tenure. I built that out and it broke immediately. I tested it against a different slot, app access instead of vacation, and the ordering that made sense for one didn't make sense for the other at all.</p>
<p>There's no universal answer to "which attribute matters more", because that isn't a technical question. It's a business one, and it's different for every policy category. Trying to hardcode it was wrong from the start.</p>
<p>What actually works is three steps:</p>
<ol>
<li><strong>A priority number on the rule itself</strong>, set by whoever created it. That number is the business judgment, already written down. No need to re-derive it with clever logic every time.</li>
<li><strong>If two rules tie on priority, the more specific rule wins.</strong> It's basically the same idea CSS uses for competing selectors. Funny how that showed up here.</li>
<li><strong>If it's a real tie with no clear winner, don't fail silently.</strong> Pick something deterministic so the employee still has an actual policy, and flag it loudly for a human to sort out.</li>
</ol>
<p><img alt="Two rules want the same slot. 1: different priorities, the higher priority wins. 2: same priority, the more specific rule wins. 3: still a tie, pick one the same way every time and flag it for a human." src="https://abubakar-yinusa.vercel.app/assets/writing/warp-policy-assignment/resolve.webp" /></p>
<p>That last step felt important. I almost went with "just fail", until I realized that just recreates the "employee has nothing" problem I'd already decided was bad.</p>
<h2>When Things Change</h2>
<p>The other part that clicked was reconciliation: what happens when things change after the fact. Someone switches departments, crosses a tenure threshold, or gets added to a group.</p>
<p><strong>Department and group changes are easy</strong> once you see it. They're just a write to some table, so you hook a recheck onto the write itself. Instant.</p>
<p><strong>Tenure was the one that tripped me up.</strong> My first idea was keeping a running counter of every employee's tenure, going up every day. Then I realized: I already have <code>hire_date</code>. Tenure is just today minus <code>hire_date</code>. I don't need to store or count anything. That alone killed the idea of looping through every employee every day just to check who crossed a threshold.</p>
<p>So instead: work out the exact date someone will hit the threshold, once, at onboarding, and schedule an event for that date. No polling, no daily scan. Just a future date sitting there waiting to fire.</p>
<p><img alt="For one employee, two years to Senior Vacation: a counter checked every day is about 730 checks. One event, scheduled at onboarding for hire_date plus 2 years, is 1." src="https://abubakar-yinusa.vercel.app/assets/writing/warp-policy-assignment/tenure.webp" /></p>
<p>It felt obvious in hindsight, but it took a while to get there.</p>
<h2>Everything Ended Up Eager</h2>
<p>One thing I didn't expect: every trigger in the system ended up eager. It recomputes and stores the result the moment something changes, instead of waiting for someone to ask.</p>
<p>I went looking for a case where lazy loading (only compute when requested) made sense, and couldn't find one. Every reconciliation path I built already had a natural moment to recompute. I didn't set out to build an all-eager system. I just kept testing cases, and that's where it landed.</p>
<h2>What's Left</h2>
<p>I still want to spend more time on the UX side, like what onboarding actually looks like for an admin, and on the architecture itself. I landed on Postgres as the source of truth, append-only so history doesn't get wiped, with Redis caching the hot reads.</p>
<p>But the core resolution and reconciliation logic feels solid. More importantly, I can explain why every piece of it is there, which is the part I care about most.</p>
<p>Fun problem. I'm writing up the full design doc next and submitting it, but I wanted to get this down while the thinking was still fresh.</p>
<p>The full design doc is here: <a href="https://github.com/abubakar2906/warp-policy-assignment">https://github.com/abubakar2906/warp-policy-assignment</a></p>]]></content:encoded>
  </item>
  <item>
    <title>How to accept payments across Africa and settle in USD or NGN</title>
    <link>https://bachs.io/blog/how-money-moves-through-bachs</link>
    <guid>https://bachs.io/blog/how-money-moves-through-bachs</guid>
    <pubDate>Sun, 30 Aug 2026 12:00:00 +0000</pubDate>
    <description>how money moves from checkout to your bank account</description>
    <content:encoded><![CDATA[]]></content:encoded>
  </item>
  <item>
    <title>What really happens after you click pay</title>
    <link>https://abubakar-yinusa.vercel.app/writing/what-happens-after-you-click-pay/</link>
    <guid>https://abubakar-yinusa.vercel.app/writing/what-happens-after-you-click-pay/</guid>
    <pubDate>Wed, 05 Aug 2026 12:00:00 +0000</pubDate>
    <description>from frontend to payment processor</description>
    <content:encoded><![CDATA[<p>Most people see a payment as one action. You tap a button and money moves.</p>
<p>Behind that tap is a chain of steps: validation, compliance checks, currency conversion, ledger entries, settlement. In a real system that can involve half a dozen services before a single cent arrives.</p>
<p>I wanted to make that chain <strong>visible</strong>.</p>
<p>So I built <strong>PayPipeline</strong>, a simulator where you send a payment and watch it move through every stage, from <strong>CREATED</strong> to <strong>COMPLETED</strong>. It has a live pipeline tracker, an event log, and a fixed table of exchange rates.</p>
<p>This post covers why I built it, how it works, and the decisions behind each layer.</p>
<h2>Why Build This</h2>
<p>If you're trying to get into fintech, there's a big gap between "I understand REST APIs" and "I understand how a payment moves through a system."</p>
<p>Most learning resources sit at one of two ends. They stay too abstract, or they drop you into production-grade complexity, with Kafka, gRPC and distributed ledgers, before you understand the basics.</p>
<p><strong>PayPipeline</strong> sits in between. It walks a payment through the stages a real one passes, with an in-memory backend you can start in seconds. No database. No message queue. Just the core logic, behind a small API, with a React frontend that shows it happening.</p>
<p>The goal was simple: <strong>submit a payment and watch it move, one stage at a time.</strong></p>
<h2>Three Ways to Pay</h2>
<p>Every payment starts the same way: it's created, validated and checked. Then it splits by type.</p>
<p><strong>1. Fiat to fiat.</strong> Send USD, GBP or EUR to NGN, KES, GHS or ZAR.</p>
<p>Created → Validated → Compliance → FX Locked → Ledger Posted → Settling → Completed</p>
<p><img alt="The simulator sending 500 GBP to Nigeria, four stages in, with the rate and fee shown." src="https://abubakar-yinusa.vercel.app/assets/writing/what-happens-after-you-click-pay/2.webp" /></p>
<p><strong>2. Crypto to crypto.</strong> Move a stablecoin like USDC, USDT or DAI from one network to another.</p>
<p>Created → Validated → Compliance → Gas Estimated → Contract Called → Bridging → Completed</p>
<p>Nothing here touches a real chain. "Gas" is a 0.5% fee, and the contract and bridging stages are labels with a message, so you can see where those steps would sit.</p>
<p><img alt="The simulator moving 500 DAI to USDT, at the gas estimate stage." src="https://abubakar-yinusa.vercel.app/assets/writing/what-happens-after-you-click-pay/3.webp" /></p>
<p><strong>3. Crypto to fiat.</strong> An off-ramp: crypto comes in, is converted through a liquidity provider, and paid out to a local bank.</p>
<p>Created → Validated → Compliance → Crypto Received → Liquidity Conversion → Fiat Settling → Completed</p>
<p><img alt="A finished crypto-to-fiat payment: 500 USDC became 65,340 KES." src="https://abubakar-yinusa.vercel.app/assets/writing/what-happens-after-you-click-pay/4.webp" /></p>
<p>The frontend shows each path as a row of nodes. Finished stages turn green, the current one glows purple, a failed one turns red, and the rest stay grey.</p>
<h2>The Architecture</h2>
<p>The repo has two parts:</p>
<pre><code>payment-playground/
├── client/ # React + Vite + TypeScript
├── server/ # Express + TypeScript
</code></pre>
<p>The interesting decisions are in the backend. Every concern gets its own folder:</p>
<pre><code>server/src/
├── models/        # Core domain types
├── repositories/  # Data access (in-memory)
├── services/      # Business logic
├── controllers/   # HTTP request handling
├── routes/        # Express routes
├── orchestrator/  # Runs the pipeline
├── state-machine/ # Which moves are allowed
├── compliance/    # Amount limit checks
├── fx/            # Exchange rates and fees
├── ledger/        # Placeholder, records nothing yet
├── settlement/    # Placeholder, waits a second, records nothing yet
├── events/        # The event log
├── errors/        # Custom error types
├── middleware/    # Express middleware
├── health/        # Health check
└── utils/         # Shared helpers
</code></pre>
<p>Each folder is one part of the domain, and each one only knows about its own job.</p>
<h2>Decision 1: A State Machine</h2>
<p>The core of the system is the <code>PaymentStateMachine</code>. A payment can't change status however it likes. Every move has to be listed as allowed:</p>
<pre><code class="language-ts">const transitions: Record&lt;PaymentStatus, PaymentStatus[]&gt; = {
    [PaymentStatus.CREATED]: [
        PaymentStatus.VALIDATED,
    ],
    [PaymentStatus.VALIDATED]: [
        PaymentStatus.COMPLIANCE_PASSED,
        PaymentStatus.COMPLIANCE_FAILED,
    ],
    [PaymentStatus.COMPLIANCE_PASSED]: [
        PaymentStatus.FX_LOCKED,         // Cross currency path
        PaymentStatus.GAS_ESTIMATED,     // Crypto cross chain path
        PaymentStatus.CRYPTO_RECEIVED,   // Crypto to fiat path
    ],
    // ...each path continues to COMPLETED or FAILED
};
</code></pre>
<p>The move itself is short. Look up what's allowed, and throw if this isn't:</p>
<pre><code class="language-ts">transition(payment: Payment, nextStatus: PaymentStatus): Payment {
    const allowed = transitions[payment.status];
    if (!allowed.includes(nextStatus)) {
        throw new Error(
            `Cannot move payment from ${payment.status} to ${nextStatus}`
        );
    }
    payment.status = nextStatus;
    return payment
};
</code></pre>
<p><strong>Why this matters:</strong> a payment in the wrong state is one of the most dangerous bugs a payment system can have. A payment that jumps from CREATED to settled without passing compliance is a regulatory problem. Here, that move can't happen: the code refuses it.</p>
<p>The fork is at <code>COMPLIANCE_PASSED</code>. From there a payment can go down one of three paths. That shape, shared checks at the top and separate paths after, is the picture at the top of this post, and it's common in real payment systems.</p>
<h2>Decision 2: An Orchestrator</h2>
<p>The <code>PaymentOrchestrator</code> runs the pipeline. It doesn't do the work itself. It calls the right service at the right time:</p>
<pre><code class="language-ts">async start(paymentId: string) {
    const payment = this.repository.findById(paymentId);
    // ...
    await this.moveTo(payment, PaymentStatus.VALIDATED);

    const approved = this.compliance.check(payment);
    if (!approved) {
        await this.moveTo(payment, PaymentStatus.COMPLIANCE_FAILED, &quot;Sender flagged by AML checks&quot;);
        return
    }
    await this.moveTo(payment, PaymentStatus.COMPLIANCE_PASSED);

    switch (payment.type) {
        case PaymentType.CROSS_CURRENCY:
            await this.processCrossCurrency(payment);
            break;
        case PaymentType.CRYPTO_CROSS_CHAIN:
            await this.processCryptoCrossChain(payment);
            break;
        case PaymentType.CRYPTO_TO_FIAT:
            await this.processCryptoToFiat(payment);
            break;
        // ...
    }

    await this.moveTo(payment, PaymentStatus.COMPLETED);
}
</code></pre>
<p>Each path has its own method:</p>
<pre><code class="language-ts">private async processCrossCurrency(payment: Payment) {
    this.fxService.quote(payment);
    await this.moveTo(payment, PaymentStatus.FX_LOCKED);

    this.ledgerService.record(payment);
    await this.moveTo(payment, PaymentStatus.LEDGER_POSTED);

    await this.settlementService.process(payment);
    await this.moveTo(payment, PaymentStatus.SETTLING);
}
</code></pre>
<p>To be clear about what's simulated: the compliance check is two rules, the amount must be more than 0 and no more than 10,000. And the ledger and settlement services are placeholders. They move the payment on but record nothing yet.</p>
<p><strong>Why not put this in the service layer?</strong> Because the orchestrator's job is the order. The FX service doesn't need to know compliance comes first. The ledger service doesn't need to know FX comes first. Each service does one thing, and the orchestrator is the only place that knows the sequence.</p>
<p>It also makes a fourth payment type easy to add: add its stages to the state machine, write a new <code>process</code> method, and add a case to the switch.</p>
<h2>Decision 3: Slow on Purpose</h2>
<p>Every stage waits 2 seconds before it moves:</p>
<pre><code class="language-ts">private async moveTo(payment: Payment, status: PaymentStatus, message?: string) {
    await sleep(2000);
    this.stateMachine.transition(payment, status)
    this.repository.update(payment);
    this.eventService.log(payment.id, payment.status, message);
}
</code></pre>
<p>Real payments don't finish in milliseconds. They wait on other companies' APIs, network confirmations and settlement windows. With 2 seconds a stage, plus 1 more second inside settlement, a fiat payment takes about 13 seconds. That's long enough to watch each stage arrive.</p>
<p><img alt="A fiat payment on a time line: validated at 2 seconds, compliance at 4, FX locked at 6, ledger posted at 8, settling at 11, completed at 13." src="https://abubakar-yinusa.vercel.app/assets/writing/what-happens-after-you-click-pay/timing.webp" /></p>
<p>It also shows a pattern worth knowing. Creating a payment starts the pipeline without waiting for it:</p>
<pre><code class="language-ts">void this.orchestrator.start(createdPayment.id);
return createdPayment
</code></pre>
<p>The client gets the payment ID back straight away. Then it asks <code>GET /payments/:id</code> and <code>GET /payments/:id/events</code> once a second to watch the payment move. Many payment APIs work this way: you get an ID immediately, then check its status or wait to be told.</p>
<h2>Decision 4: An Event for Every Move</h2>
<p>Every move is written to an event log:</p>
<pre><code class="language-ts">log(paymentId: string, status: PaymentStatus, customMessage?: string) {
    this.repository.add({
        paymentId,
        status,
        timestamp: new Date(),
        message: customMessage || this.createMessage(status) || &quot;&quot;,
    });
}
</code></pre>
<p><code>GET /payments/:id/events</code> returns the full history: every stage the payment passed, with a time and a readable message.</p>
<p><strong>Why this matters:</strong> a regulated payment system has to be able to show <em>when</em> a compliance check ran, <em>when</em> the rate was locked, and <em>when</em> settlement started. A log like this is how you show it. It's an audit trail, not full event sourcing: the payment's current status is still stored on the payment itself, and the log sits beside it.</p>
<h2>Decision 5: One Rate per Currency</h2>
<p>Instead of a table of every currency pair, each currency has one rate against the US dollar:</p>
<pre><code class="language-ts">const usdRates: Record&lt;string, number&gt; = {
    USD: 1, GBP: 0.78, EUR: 0.92,
    USDC: 1, USDT: 1, DAI: 1,
    NGN: 1640, KES: 132, GHS: 12.5, ZAR: 19.2,
};

const rate = destRate / sourceRate;
</code></pre>
<p>Any currency converts to any other in one division. Adding a currency is one line. Then a 1% fee comes off before the conversion:</p>
<pre><code class="language-ts">payment.fee = payment.amount * 0.01;

payment.destinationAmount =
    (payment.amount - payment.fee) * rate;
</code></pre>
<p><img alt="Sending 500 GBP to Nigeria: 500 minus a 5 GBP fee, times 2,102.56 (1,640 divided by 0.78), equals 1,040,769 NGN." src="https://abubakar-yinusa.vercel.app/assets/writing/what-happens-after-you-click-pay/math.webp" /></p>
<p>One thing I'd fix: a currency that's missing from the table quietly gets a rate of 1, because of <code>usdRates[code] || 1</code>. It should be an error.</p>
<h2>Decision 6: Wiring by Hand</h2>
<p>Everything is connected in <code>app.ts</code>, with plain constructors:</p>
<pre><code class="language-ts">const repository = new PaymentRepository();
const stateMachine = new PaymentStateMachine();
const complianceService = new ComplianceService();
const eventRepository = new EventRepository();
const eventService = new EventService(eventRepository);
const fxService = new FXService();
const ledgerService = new LedgerService();
const settlementService = new SettlementService();

const orchestrator = new PaymentOrchestrator(
  repository, stateMachine, complianceService,
  fxService, ledgerService, settlementService, eventService
);

const paymentService = new PaymentService(repository, orchestrator, eventService);
const paymentController = new PaymentController(paymentService, eventService);
</code></pre>
<p>No framework. No decorators. Every dependency is in plain sight. You can read the file top to bottom and understand how the whole thing fits together in 30 seconds.</p>
<p><strong>Why no framework?</strong> At this size, a tool like InversifyJS or tsyringe adds more than it gives back. The hand wiring doubles as documentation. In a codebase with hundreds of services, a container starts to earn its place. Here, simple wins.</p>
<h2>Decision 7: Error Types</h2>
<p>Errors share one base class with a status code, so a service can <code>throw new ValidationError("Amount must be greater than zero")</code> and a single middleware turns it into a JSON response. Unknown errors are meant to get a plain 500, so nothing internal leaks.</p>
<p>That's the design. Going back through the code for this post, I found it doesn't quite work. The error middleware is registered <em>before</em> the routes, and Express only hands errors to handlers registered <em>after</em> them. So my handler never runs. Express's own handler answers instead, with an HTML page. It keeps the right status code, but outside production that page includes the stack trace. The fix is one line: move <code>app.use(errorMiddleware)</code> below the routes.</p>
<h2>The Frontend</h2>
<p>The client is React, TypeScript and Vite. The <code>PaymentPipeline</code> component knows the stages for each payment type and draws them as a row of nodes. Each node's look comes from the payment's current status:</p>
<ul>
<li><strong>Done</strong> (green): stages it has already passed</li>
<li><strong>Active</strong> (purple, pulsing): the stage it's in now</li>
<li><strong>Failed</strong> (red): the stage it stopped at</li>
<li><strong>Idle</strong> (grey): stages it hasn't reached</li>
</ul>
<p>The lines between nodes animate too. Finished ones turn green, and the active one shimmers.</p>
<p>Below it, the event log lists every event newest first, with times like "just now" and "4s ago" and a readable message for each.</p>
<p><img alt="The event log for a finished payment: seven events, newest first." src="https://abubakar-yinusa.vercel.app/assets/writing/what-happens-after-you-click-pay/6.webp" /></p>
<h2>What a Real Version Would Need</h2>
<p>This is a simulator, and it's simple on purpose. A real version would need:</p>
<ol>
<li><strong>A real database.</strong> PostgreSQL for payments, and append-only tables for events.</li>
<li><strong>Push updates.</strong> WebSockets instead of asking every second.</li>
<li><strong>Idempotency keys,</strong> so a retried request can't create the same payment twice.</li>
<li><strong>A message queue.</strong> Starting the pipeline and not waiting for it works here, but in production a restart would lose the payment mid-pipeline. A queue like RabbitMQ or SQS makes sure it still gets processed.</li>
<li><strong>Live exchange rates</strong> from a real FX provider, instead of a fixed table.</li>
<li><strong>Authentication,</strong> with API keys or tokens and access scoped to each user's payments.</li>
<li><strong>Tracing,</strong> with OpenTelemetry spans across every stage, so you can see where time goes.</li>
<li><strong>A real ledger and settlement step.</strong> Today they're placeholders.</li>
</ol>
<h2>Try It Yourself</h2>
<p>The code is on GitHub. Clone it, run <code>npm install</code> in both <code>client/</code> and <code>server/</code>, start each with <code>npm run dev</code>, and send some payments.</p>
<p>GitHub: <a href="https://github.com/abubakar2906/payment-playground">https://github.com/abubakar2906/payment-playground</a></p>
<p>Live: <a href="https://payment-playground-nu.vercel.app/">https://payment-playground-nu.vercel.app/</a></p>
<p><em>If you're building in fintech and want to see how a payment system works underneath, I hope this gives you a useful place to start. Fork it, extend it, break it. That's what playgrounds are for.</em></p>]]></content:encoded>
  </item>
  <item>
    <title>I built a distributed rate limiter in Go with zero Go experience</title>
    <link>https://abubakar-yinusa.vercel.app/writing/rate-limiter-in-go/</link>
    <guid>https://abubakar-yinusa.vercel.app/writing/rate-limiter-in-go/</guid>
    <pubDate>Thu, 30 Jul 2026 12:00:00 +0000</pubDate>
    <description>from typescript to concurrent, redis-backed go in one project</description>
    <content:encoded><![CDATA[<p>I'd been hearing about Go for a while. Fast, concurrent, simple. But every time I tried to get into it, the tutorials felt written for people who already knew Go. Concepts were thrown at you before you understood why they existed.</p>
<p>So I decided to learn differently. Instead of following a tutorial, I picked a real project and built it from scratch.</p>
<p>The project chose itself after I found a post on the Uber Engineering blog: <a href="https://www.uber.com/in/en/blog/from-static-rate-limiting-to-intelligent-load-management/">From Static Rate Limiting to Intelligent Load Management</a>. It walks through how Uber's team built overload protection for databases handling tens of millions of requests per second.</p>
<p>What caught me wasn't the final system. It was why their first approach failed. They started with a simple Redis-based quota system. Every request hit Redis, quotas were set statically, and the cost model was too rough to reflect real load. It collapsed under real production traffic.</p>
<p>Their takeaway stuck with me: <em>overload management must live as close to the storage nodes as possible, and static configurations will always fight a losing battle against a dynamic system.</em></p>
<p>I wasn't going to build Uber's system. But I wanted to understand the foundation: what a rate limiter actually is before it becomes intelligent, distributed and priority-aware. So I built one. A distributed rate limiter with a sliding window, in a language I'd never written. No Go experience, just a TypeScript background and a problem worth understanding from the ground up.</p>
<p>This is everything I learned.</p>
<h2>Why a Rate Limiter?</h2>
<p>A rate limiter sounds simple until you build one. At its core it answers one question: <em>has this user made too many requests recently?</em></p>
<p>But the moment you think about it seriously, the questions pile up. What happens when several requests arrive in the same millisecond? If you run ten servers, does each one keep its own count, or do they share it? If you track every user who ever made a request, does that list grow forever?</p>
<p>These aren't theoretical problems. They're exactly the problems that push you into Go's most important ideas: concurrency, shared state, goroutines, and distributed systems.</p>
<h2>The Mental Shift From TypeScript</h2>
<p>Before a single line of Go, the biggest adjustment isn't the syntax. It's the way of thinking.</p>
<p><strong>TypeScript runs on one thread.</strong> async/await gives you the <em>illusion</em> of concurrency. Under the hood, only one thing runs at a time, and the event loop manages it for you. You rarely have to think about two pieces of code touching the same data at once.</p>
<p><strong>Go is genuinely concurrent.</strong> Goroutines really do run at the same time. So you have to think about what happens when two requests hit the same function in the same millisecond. Ignore it and things break in ways that are hard to reproduce and harder to debug.</p>
<p><strong>There's no try/catch.</strong> In TypeScript, if you don't wrap something, errors bubble up quietly. In Go, every function that can fail returns two values, the result and an error:</p>
<pre><code class="language-go">result, err := doSomething()
if err != nil {
    // you have to deal with this
}
</code></pre>
<p>It feels wordy at first. After a while you realise it's better: every failure path is visible in the code, and you can't accidentally ignore one.</p>
<p><strong>There are no classes.</strong> Go splits the class into a struct (the data) and methods (the behaviour, attached separately). This is the real struct from the project:</p>
<pre><code class="language-go">type RateLimiter struct {
    mu       sync.Mutex
    requests []time.Time   // timestamps in the current window
    limit    int           // max requests allowed
    window   time.Duration // how long the window is
}

func (r *RateLimiter) Allow() bool { … }
</code></pre>
<p>The <code>(r *RateLimiter)</code> before the function name is Go saying <em>"this function belongs to RateLimiter."</em> <code>r</code> is like <code>this</code> in TypeScript, except you name it yourself.</p>
<h2>Stage 1: The Sliding Window</h2>
<p>For every request, look back one window and count how many requests happened in that time. Under the limit? Allow it and record the timestamp. Over? Reject it.</p>
<p>The window slides with every request. A fixed window is different: everyone's count resets at the same moment on the clock. That has a nasty edge case. A client can send a full limit just before the reset and another full limit just after, doubling the allowed rate in a short burst. A sliding window doesn't fall for it.</p>
<p><img alt="A limit of 100 a minute, with 100 requests at 0:59 and 100 more at 1:00. A fixed window allows all 200, because the second 100 land in a new window. A sliding window looks back one minute from 1:00, still sees the first 100, and rejects the second 100." src="https://abubakar-yinusa.vercel.app/assets/writing/rate-limiter-in-go/boundary.webp" /></p>
<p>The implementation is a struct holding a slice of timestamps, a Mutex protecting it, and an <code>Allow()</code> method:</p>
<pre><code class="language-go">func (r *RateLimiter) Allow() bool {
    r.mu.Lock()
    defer r.mu.Unlock()

    now := time.Now()
    windowStart := now.Add(-r.window)

    // keep only the timestamps inside the window
    var valid []time.Time
    for _, t := range r.requests {
        if t.After(windowStart) {
            valid = append(valid, t)
        }
    }
    r.requests = valid

    if len(r.requests) &gt;= r.limit {
        return false
    }

    r.requests = append(r.requests, now)
    return true
}
</code></pre>
<p>Two Go things are worth understanding in this block.</p>
<p><strong><code>defer r.mu.Unlock()</code>.</strong> <code>defer</code> schedules a call to run when the surrounding function returns, however it returns. So even when <code>Allow()</code> returns <code>false</code> early, the mutex is always unlocked. This is Go's standard pattern: lock, immediately defer the unlock, then do your work. You never forget to unlock.</p>
<p><strong>The Mutex itself.</strong> Without it, two requests could read the count at the same time, both think they're under the limit, and both get through when only one should. The mutex lets one goroutine through that block at a time, like a single-occupancy door.</p>
<p>It holds up. A test that fires 1,000 goroutines at the same key at once, with a limit of 5, lets exactly 5 through. Five runs, five times out of five.</p>
<h2>Stage 2: Multiple Users</h2>
<p>A single limiter has an obvious problem: one global limit for everyone. If alice hits her limit, bob is blocked too.</p>
<p>The fix is a map with one <code>*RateLimiter</code> per key: per IP, per user, per whatever makes sense for your app.</p>
<pre><code class="language-go">type MultiLimiter struct {
    mu       sync.RWMutex
    limiters map[string]*RateLimiter
    lastSeen map[string]time.Time // when each key was last used
    done     chan struct{}         // the stop signal
    limit    int
    window   time.Duration
}
</code></pre>
<p>Notice <code>sync.RWMutex</code> instead of <code>sync.Mutex</code>. This is the first real concurrency nuance. Think of a library reading room. Many people can read at once without disturbing each other. But when someone needs to rearrange the shelves, everyone has to wait.</p>
<ul>
<li><strong>Reading:</strong> many goroutines can read the map at the same time (<code>RLock</code>).</li>
<li><strong>Writing:</strong> only one goroutine can write, and only when nobody is reading (<code>Lock</code>).</li>
</ul>
<p>In this project, <code>Allow()</code> takes the full write lock, because it may add a new key and it always updates when the key was last seen. The read lock is for reading only, like counting the keys.</p>
<h2>Stage 3: Goroutines and Channels</h2>
<p>The MultiLimiter now leaks memory. Every key stays in the map forever, even if that user hasn't made a request in hours. In a real app with thousands of users, that adds up.</p>
<p>The fix is a background goroutine that sweeps idle keys out on a timer. This is where Go's concurrency starts to feel genuinely different.</p>
<pre><code class="language-go">func (m *MultiLimiter) StartCleanup(interval, maxIdle time.Duration) {
    ticker := time.NewTicker(interval)

    go func() {
        for {
            select {
            case &lt;-ticker.C:
                m.cleanup(maxIdle)
            case &lt;-m.done:
                ticker.Stop()
                return // exits the goroutine
            }
        }
    }()
}
</code></pre>
<p>Three things are happening here.</p>
<p><strong><code>go func() { … }()</code></strong> starts an anonymous goroutine. The function is defined and immediately runs in the background. <code>StartCleanup</code> returns straight away while the goroutine keeps going.</p>
<p><strong><code>time.Ticker</code></strong> sends the current time into a channel at a regular interval. <code>ticker.C</code> is that channel.</p>
<p><strong><code>select</code></strong> listens to several channels at once and runs whichever is ready first. If the ticker fires, clean up. If the <code>done</code> channel closes (someone called <code>Stop()</code>), exit.</p>
<p>The <code>done</code> channel is a common Go pattern for telling goroutines to stop:</p>
<pre><code class="language-go">done: make(chan struct{})

// somewhere else:
close(done) // tells everyone listening
</code></pre>
<p><code>chan struct{}</code> carries no data at all. It's just a signal.</p>
<p>In the server, the sweep runs every minute and drops any key that's been idle for five. Fill the limiter with 10,000 different IPs, and one sweep after they go quiet, the map is back to 0 keys.</p>
<p>This was the moment Go's concurrency clicked for me. In TypeScript, the runtime manages concurrency for you. In Go, you write the goroutines. You write the channels. You decide when things run and when they stop. More responsibility, and much more control.</p>
<h2>Stage 4: HTTP Middleware</h2>
<p>Go's standard library includes a production-grade HTTP server. No Express, no Fastify, no framework needed.</p>
<p>The whole HTTP system is built around one interface:</p>
<pre><code class="language-go">type Handler interface {
    ServeHTTP(w http.ResponseWriter, r *http.Request)
}
</code></pre>
<p>If your type has a <code>ServeHTTP</code> method with that signature, it's a valid HTTP handler. There's no <code>implements</code> keyword. Go works it out by itself. That's what makes Go interfaces powerful: they're satisfied without being declared.</p>
<p>Middleware follows naturally. It's a handler that wraps another handler:</p>
<pre><code class="language-go">type Limiter interface {
    Allow(key string) bool
}

func Middleware(l Limiter, next http.Handler) http.Handler {
    return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
        ip, _, err := net.SplitHostPort(r.RemoteAddr)
        if err != nil {
            ip = r.RemoteAddr
        }

        if !l.Allow(ip) {
            w.WriteHeader(http.StatusTooManyRequests)
            fmt.Fprintln(w, &quot;rate limit exceeded, slow down&quot;)
            return // the request stops here
        }

        next.ServeHTTP(w, r)
    })
}
</code></pre>
<p>Notice the <code>Limiter</code> interface as the first parameter. Both <code>MultiLimiter</code> and the <code>RedisLimiter</code> coming next have the same <code>Allow(key string) bool</code> method, so both satisfy it. The middleware doesn't know or care which one it's talking to.</p>
<p>The middleware also holds a real bug I hit. <strong><code>r.RemoteAddr</code> is "IP:PORT", not just the IP.</strong> Every curl request opens a new connection on a new port, so the limiter saw every request as a different user, and nobody ever hit the limit. <code>net.SplitHostPort</code> strips the port.</p>
<p>You can see the difference plainly. Send 10 requests from one IP, each on a new port, with a limit of 5. With the port left in the key, all 10 get through, spread across 10 keys. With the port stripped, 5 get through, all on 1 key.</p>
<h2>Stage 5: Making It Actually Distributed</h2>
<p>Here's the problem with everything so far: the state lives in one server's memory. In production you run several instances behind a load balancer, and each has its own map. Alice can send five requests to instance A and five to instance B, and neither knows about the other. The rate limiter is useless.</p>
<p>The fix is Redis. Move the state out of any one server into a shared store every instance can read and write.</p>
<p>The data structure is a Redis sorted set. Every member has a score, and Redis can quickly find and delete every member with a score in a range. Each request is stored with its timestamp in milliseconds as the score, and the timestamp in nanoseconds as the member, so two requests in the same millisecond don't overwrite each other:</p>
<pre><code>Key: &quot;rate:192.168.1.1&quot;
member (nanoseconds)   score (milliseconds)
────────────────────   ────────────────────
1719000001000123000 →  1719000001000
1719000001200456000 →  1719000001200
1719000001800789000 →  1719000001800
</code></pre>
<p>To check the window: remove everything scored older than now minus the window, count what's left, compare it to the limit.</p>
<p>But done from Go, that's three separate Redis calls:</p>
<ol>
<li>remove old entries</li>
<li>count what's left</li>
<li>if under the limit, add the new entry</li>
</ol>
<p>There's a gap between steps 2 and 3. Two requests arrive together and both count 4, under a limit of 5. Both think they can go through. Both add themselves. The count becomes 6, and the limit is broken.</p>
<p><img alt="Three separate calls from Go on the left, with a gap between counting and adding where another request also reads 4. On the right, the same three steps inside one Lua script, which Redis runs as one step." src="https://abubakar-yinusa.vercel.app/assets/writing/rate-limiter-in-go/lua.webp" /></p>
<p>The solution is a Lua script. Redis runs a Lua script atomically: the whole script is one step that nothing else can interrupt. Nothing can run between the count and the add. This is the script from the project:</p>
<pre><code class="language-lua">local key      = KEYS[1]
local now_ms   = tonumber(ARGV[1])
local now_ns   = ARGV[2]
local window   = tonumber(ARGV[3])
local limit    = tonumber(ARGV[4])

redis.call('ZREMRANGEBYSCORE', key, 0, now_ms - window)

local count = redis.call('ZCARD', key)

if count &lt; limit then
    redis.call('ZADD', key, now_ms, now_ns)
    redis.call('PEXPIRE', key, window)
    return 1
end

return 0
</code></pre>
<p><code>PEXPIRE</code> deletes the whole key one window after the last allowed request, so Redis cleans up after itself.</p>
<p>How much does the gap matter? Against a local Redis, send 200 requests at once to one key with a limit of 5, five runs each. The three-call version let through 11, 21, 12, 65 and 79. The Lua script let through 5, every time.</p>
<p><img alt="Requests let through out of 200 sent at once with a limit of 5, five runs each. Three separate calls let through 11, 12, 21, 65 and 79. The Lua script let through 5 in all five runs." src="https://abubakar-yinusa.vercel.app/assets/writing/rate-limiter-in-go/race.webp" /></p>
<p>And in Go:</p>
<pre><code class="language-go">func (r *RedisLimiter) Allow(key string) bool {
    ctx := context.Background()

    nowMs := time.Now().UnixMilli() // the score
    nowNs := time.Now().UnixNano()  // the unique member
    windowMs := r.window.Milliseconds()

    result, err := r.script.Run(ctx, r.client, []string{key}, nowMs, nowNs, windowMs, r.limit).Int()
    if err != nil {
        fmt.Println(&quot;Redis error:&quot;, err)
        return true
    }

    return result == 1
}
</code></pre>
<p>Notice <code>return true</code> when Redis errors. This is <strong>failing open</strong>: if Redis is unavailable, allow the request rather than rejecting everything. A Redis outage taking your whole application down with it is almost always worse than briefly not enforcing rate limits. Swap it to <code>return false</code> if your use case needs the opposite.</p>
<h2>What I Actually Learned</h2>
<p>Looking back, the rate limiter wasn't really about rate limiting. It was a vehicle for understanding Go's actual ideas.</p>
<p><strong>Structs and pointer receivers.</strong> The <code>*</code> before a type means "a pointer to this thing, not a copy." Methods that change the struct need pointer receivers. This trips you up once before it sticks.</p>
<p><strong>Mutexes.</strong> Shared state that changes, in a concurrent program, is a bug waiting to happen. A Mutex lets one goroutine into a critical section at a time. RWMutex lets reads happen together while writes take turns.</p>
<p><strong>Goroutines and channels.</strong> Go's concurrency model is genuinely different. You write the threads, and you write how they talk. It's more work than an event loop, and much more powerful.</p>
<p><strong>Interfaces are implicit.</strong> If your type has the right methods, it satisfies the interface. No <code>implements</code>. That makes it easy to swap backends without touching the caller.</p>
<p><strong>Errors are values.</strong> Wordy, but explicit. Every failure path is visible.</p>
<h2>What's Next</h2>
<p>This project is the foundation for the second Go project in this series: a messaging system with a pub/sub broker. Everything here carries over: goroutines, channels, <code>select</code>, interfaces, structs. But there, channels stop being a cleanup mechanism and become the core of the design. Goroutines talk to each other through typed pipes in real time.</p>
<p>The full code is on GitHub: <a href="https://github.com/abubakar2906/rate-limiter">abubakar2906/rate-limiter</a>.</p>
<p>And if you're a TypeScript developer thinking about learning Go, build something real. Tutorials tell you what Go can do. A project shows you why it works the way it does.</p>
<p><em>This article is part of a series on learning Go through building real systems.</em></p>]]></content:encoded>
  </item>
  <item>
    <title>Building Courseflow: bridging the gap in university academic tracking</title>
    <link>https://abubakar-yinusa.vercel.app/writing/building-courseflow/</link>
    <guid>https://abubakar-yinusa.vercel.app/writing/building-courseflow/</guid>
    <pubDate>Wed, 24 Jun 2026 12:00:00 +0000</pubDate>
    <description>building for a role that has no existing software</description>
    <content:encoded><![CDATA[<p>Picture this. It's Week 8 of the semester. A lecturer has just finished teaching CYB401, Ethical Hacking, to a combined class of 200 students from two different programs. She needs to flag a pattern of absences in one group before it gets out of hand.</p>
<p>She opens a WhatsApp group and messages the course rep. The course rep opens a shared Google Sheet that hasn't been properly updated since Week 5. By the time the right information reaches the right person, the semester is almost over.</p>
<p>This isn't a made-up story. It's what happens in universities across the country every week, and it's the problem Courseflow was built to solve.</p>
<h2>Tracking That Was Never Built for Universities</h2>
<p>Academic tracking in most universities runs on a patchwork of informal tools. WhatsApp groups for messages. Google Sheets for attendance. Email threads for assignments. Each one works fine on its own. Stitched together, they're a mess.</p>
<p>The real problem is that the tools don't match the structure. A university has a specific shape:</p>
<ul>
<li>A <strong>faculty</strong> has several <strong>programs</strong>, like Cybersecurity and Software Engineering.</li>
<li>A program has <strong>cohorts</strong> by level, like 400L.</li>
<li>A cohort takes <strong>courses</strong>, and some courses are shared between programs.</li>
</ul>
<p>Generic tools have no idea any of this exists. They can't tell two groups of students in the same lecture hall apart. And they can't give each person, the lecturer, the course rep and the student, the view they actually need.</p>
<p>So lecturers lose the big picture. Course reps drown in manual data entry. Students chase information through channels nobody trusts. Everyone does more work and still gets worse results.</p>
<h2>Why Existing Tools Fall Short</h2>
<p>Before building anything, I wanted to be honest about what already exists. There are learning management systems: Moodle, Google Classroom, the institution's own portal. But they're usually built either for the lecturer alone, or for individual students. They rarely think about the middle layer that actually keeps a university running: <strong>the course representative</strong>.</p>
<p>A course rep is a student elected by their classmates to sit between the cohort and the lecturer. They take attendance, pass on announcements, track who submitted what, and raise problems. They're the backbone of academic communication, and almost no tool is designed for them. They inherit spreadsheets from whoever did the job last year, build their own system from scratch every semester, and hope for the best.</p>
<p>Any real solution had to start with the course rep at the centre.</p>
<h2>Built Around the Cohort</h2>
<p>Courseflow mirrors how a university actually works, not how a generic productivity tool assumes it works.</p>
<p>Everything in it hangs off one idea: the <strong>cohort</strong>. A cohort is a specific, bounded group of students, like <em>400L Cybersecurity, Faculty of Computing, 2024/2025 session</em>. It isn't just a label. It decides what each person can see, manage and change.</p>
<ul>
<li>A <strong>course rep</strong> is assigned to one cohort. They take attendance, track assignments and post updates for their group only.</li>
<li>A <strong>lecturer</strong> teaches one or more courses, and one course can be linked to several cohorts at once.</li>
<li>The <strong>bridge</strong> between them is the link between a course and a cohort. That's where the platform does its real work.</li>
</ul>
<p><img alt="The course from the opening, CYB401, linked to two 400L cohorts from two programs (for example, Cybersecurity and Software Engineering). Each cohort's course rep sees only their own cohort. The lecturer sees both." src="https://abubakar-yinusa.vercel.app/assets/writing/building-courseflow/cohorts.webp" /></p>
<p>When a lecturer opens a course, they see every cohort taking it. When a course rep opens the same course, they see only their own cohort. No noise from other groups. Just what they need to do the job.</p>
<p><img alt="A lecturer's dashboard: the courses they teach, the cohorts enrolled, and the tracking sessions so far." src="https://abubakar-yinusa.vercel.app/assets/writing/building-courseflow/3.webp" /></p>
<p><img alt="One course from the lecturer's side: average attendance across cohorts, announcements, and the attendance and assignment trackers." src="https://abubakar-yinusa.vercel.app/assets/writing/building-courseflow/4.webp" /></p>
<p>And this is a course rep's dashboard. The names and numbers in these pictures are sample data.</p>
<p><img alt="A course rep's dashboard with sample data: students, courses, attendance sessions and assignments for their cohort." src="https://abubakar-yinusa.vercel.app/assets/p/courseflow/web-1.webp" /></p>
<h2>The Tech Stack</h2>
<p>Handling this many relationships while still feeling good to use took careful choices at every layer.</p>
<p><strong>Frontend: Next.js (App Router) and React 18.</strong> Server rendering keeps the platform fast on slow connections, which matters at a university. React 18 lets the analytics dashboard load in pieces, so you see data as it arrives instead of staring at a blank screen.</p>
<p><strong>UI: Tailwind CSS and Radix UI, through shadcn.</strong> Tailwind let me build and change things quickly without losing consistency. Radix's accessible building blocks mean every modal, dropdown and table works with a keyboard and a screen reader from the start. Light and dark mode work across the whole interface.</p>
<p><strong>Backend: Node.js, Express 5 and TypeScript.</strong> TypeScript from end to end wasn't up for debate. Cohorts, courses, users and all the ways they overlap are exactly where type safety catches mistakes at compile time instead of in production. Express 5 handles errors in async code better, which keeps the API layer clean.</p>
<p><strong>Database: PostgreSQL with Prisma.</strong> A relational database is a natural fit for cohorts. Link tables, cascading deletes and joins are what it's built for. Prisma keeps the database schema and the code in sync, so changing a relationship doesn't quietly break a query somewhere else.</p>
<p>Here's the heart of the schema. A cohort has one course rep. A course has one lecturer. And courses and cohorts link to each other many-to-many:</p>
<pre><code class="language-prisma">// other fields left out
model Cohort {
  department  String
  program     String
  level       Level
  courseRepId String
  courseRep   User     @relation(&quot;RepCohorts&quot;, fields: [courseRepId], references: [id])
  courses     Course[] @relation(&quot;CohortCourses&quot;)

  @@unique([program, level, department])
}

model Course {
  code       String   @unique
  lecturerId String
  lecturer   User     @relation(&quot;LecturerCourses&quot;, fields: [lecturerId], references: [id])
  cohorts    Cohort[] @relation(&quot;CohortCourses&quot;)
}
</code></pre>
<p><strong>Sign-in: JWT and Google OAuth 2.0 through Passport.js.</strong> University users expect to sign in with their Google account. Passport makes OAuth simple, and JWTs keep sessions stateless.</p>
<p><img alt="Seven tables, 33 API routes, and three roles: lecturer, course rep and student." src="https://abubakar-yinusa.vercel.app/assets/writing/building-courseflow/counts.webp" /></p>
<h2>Challenges Along the Way</h2>
<p>No interesting problem comes without rough edges. Two worth mentioning.</p>
<p><strong>Showing the course-cohort link without confusing people.</strong> Courses and cohorts linking many-to-many is powerful, but it can easily confuse people who aren't technical. The design job was to show that in the lecturer's dashboard as clean, readable numbers, not as database rows.</p>
<p><strong>Keeping each role in its lane.</strong> A course rep in one cohort must really not be able to see or change another cohort's data. Hiding buttons in the UI isn't enough, because that can be bypassed. The check has to live on the server, in the query itself. Before a course rep can create a tracker, the server looks up the cohort and only finds it if they're its course rep, and it refuses a course that isn't linked to that cohort:</p>
<pre><code class="language-ts">const cohort = await prisma.cohort.findFirst({
  where: {
    id: cohortId,
    OR: [
      { courseRepId: userId },
      ...(joinedCohortId === cohortId ? [{ id: joinedCohortId }] : [])
    ]
  }
});
if (!cohort) return res.status(403).json({ success: false, error: 'Not authorized for this cohort' });

const course = await prisma.course.findFirst({
  where: { id: courseId, cohorts: { some: { id: cohortId } } }
});
if (!course) return res.status(400).json({ success: false, error: 'Course not linked to this cohort' });
</code></pre>
<p><img alt="Attendance for one lecture, with sample data: each student marked present or absent." src="https://abubakar-yinusa.vercel.app/assets/p/courseflow/web-2.webp" /></p>
<h2>Looking Ahead</h2>
<p>Courseflow is meant to grow with the institutions that use it. Next on the list:</p>
<ul>
<li><strong>Student dashboards.</strong> Students see their own attendance and submitted assignments, without chasing their course rep.</li>
<li><strong>Automatic alerts.</strong> Lecturers and course reps hear about it when attendance or submissions drop below a level they set.</li>
<li><strong>Sessions and semesters.</strong> Institutions set their academic calendar, finished sessions are archived automatically, and course rep assignments carry over to the next cohort.</li>
<li><strong>Exports.</strong> Department coordinators and heads of department can pull structured reports for accreditation and academic reviews.</li>
</ul>
<p>The bigger idea is a layer that sits between the generic tools universities use today and the role-based work that actually runs academic life. Not another LMS. Not another spreadsheet. Something built around how universities really operate.</p>
<h2>Final Thoughts</h2>
<p>The gap between how universities track academics and how they should is surprisingly wide. Not because the software is hard to build, but because most tools aren't designed for the people actually doing the work. The lecturer who needs to see across cohorts. The course rep who needs focused, manageable data. The student who just wants to know where they stand.</p>
<p>Courseflow is an attempt to close that gap, one cohort at a time.</p>
<p>If you work in ed-tech, build software for institutions, or just spent too many semesters watching important information disappear into a WhatsApp group, I'd love to hear what you think. Try the project and let's talk about what better academic tools look like.</p>
<p><a href="https://course-repp-tracker.vercel.app/">https://course-repp-tracker.vercel.app/</a></p>]]></content:encoded>
  </item>
  <item>
    <title>I inherited a broken codebase. Here&#x27;s what I found and what I built</title>
    <link>https://abubakar-yinusa.vercel.app/writing/inherited-a-broken-codebase/</link>
    <guid>https://abubakar-yinusa.vercel.app/writing/inherited-a-broken-codebase/</guid>
    <pubDate>Fri, 22 May 2026 12:00:00 +0000</pubDate>
    <description>the archaeology of someone else&#x27;s technical decisions</description>
    <content:encoded><![CDATA[<p>It started with a TikTok video.</p>
<p>I was in a rut. I was building solo projects, getting no traction, and wondering if any of it was actually moving the needle. Then I came across a video about a developer community. I joined the WhatsApp group and posted some of the things I'd built.</p>
<p>A few days later, someone reached out. They had a project, and they needed developers. There was no pay, but equity was on the table. More importantly, it was real experience on something that wasn't just mine.</p>
<p>I said yes.</p>
<p>The project was Chari Nexus, an all-in-one cybersecurity platform for enterprise companies. Their previous version had run into serious problems, so they were starting again from scratch. Or so I thought.</p>
<p>I was supposed to join alongside a frontend developer. She didn't show up. A pay dispute, most likely. I probably should have taken that as a sign. Instead, I thought: <em>how difficult can it be?</em></p>
<p>I was about to find out.</p>
<h2>What I Walked Into</h2>
<p>I got access to the private repository, cloned the main and update branches, and was handed a folder of documentation. The documentation was useless. I ended up writing six documents of my own just to map out what the platform was supposed to do.</p>
<p>Then I started reading the code.</p>
<ul>
<li><strong>Half-commented files.</strong> The working code started in the middle of a file. The top half was a graveyard of commented-out logic nobody had cleaned up.</li>
<li><strong>Broken import links.</strong></li>
<li><strong>Routes that led nowhere.</strong></li>
<li><strong>Mock data where real database calls should have been,</strong> passed off as if it worked.</li>
<li><strong>A UI that looked unfinished.</strong> No proper validation. No consistent error handling.</li>
</ul>
<p>This wasn't a rough draft. Someone had presented it as a working product. I now had roughly six weeks to turn it into one.</p>
<p>The scope was five modules: vulnerability management, risk management, compliance, a report engine, and incident response. Another developer would handle incident response. I owned the other four. And before I could build anything, I had to clean up everything that was already there.</p>
<h2>The Cleanup</h2>
<p>I started with triage. No new code. Just understanding the full damage before touching anything.</p>
<p>The first pass was about getting the app to run at all. I fixed the broken links, finished the incomplete routes, and ripped out the mock data. The commented-out code at the top of files got deleted. The bloat, features that were half-started and added nothing, got removed. The schema was a mess, so I redesigned it module by module as I went.</p>
<p><img alt="What was in the codebase and what happened to it: broken import links were fixed, routes that led nowhere were completed, mock data was ripped out, commented-out code was deleted, half-started features were removed, and the schema was redesigned module by module." src="https://abubakar-yinusa.vercel.app/assets/writing/inherited-a-broken-codebase/cleanup.webp" /></p>
<p>Only after that did I start building.</p>
<h2>The Redesign</h2>
<p><img alt="" src="https://abubakar-yinusa.vercel.app/assets/writing/inherited-a-broken-codebase/1.webp" /></p>
<p>The original dashboard. It worked, but it was generic.</p>
<p><img alt="" src="https://abubakar-yinusa.vercel.app/assets/writing/inherited-a-broken-codebase/2.webp" /></p>
<p>The redesigned dashboard, built to read like an enterprise security product.</p>
<h2>Module 1: Vulnerability Management</h2>
<p>This was the most technically demanding of the four. It had to do three things: find the assets, scan them for vulnerabilities, and write a plan to fix what it found.</p>
<p><strong>Finding the assets.</strong> An asset here means anything in the customer's technical setup: servers, API endpoints, database instances, cloud resources. I built a GitHub Actions workflow that scans the repository and pulls these out automatically. The platform then shows them with a simple label, asset or non-asset, that you can switch between.</p>
<p><strong>Scanning them.</strong> Once the assets were defined, the scans could run. There were three kinds:</p>
<ul>
<li><strong>SAST (static application security testing)</strong> reads the source code and the CI/CD configuration for vulnerabilities without running the app. I used Semgrep, wired straight into the GitHub Actions pipeline.</li>
<li><strong>DAST (dynamic application security testing)</strong> tests the live, deployed app by simulating real attacks against its endpoints. It needs Docker to run.</li>
<li><strong>Container scanning</strong> checks Docker images and Kubernetes clusters for known vulnerabilities in dependencies and base images.</li>
</ul>
<p>DAST gave me a problem I didn't see coming. My laptop can't run Docker, so I couldn't test it the usual way. My fix was to move DAST into CI/CD. When code is pushed, GitHub Actions starts the Docker container and runs the DAST scan there. It's not the typical setup, but it works, and the scan runs the same way no matter whose laptop the code came from.</p>
<p><strong>Fixing what it found.</strong> For each flagged vulnerability, the platform writes a structured plan: severity, affected asset, recommended fix, and priority order. It's technical enough for a developer to act on, and clear enough for a security lead to review without reading raw scan output.</p>
<h2>Module 2: Risk Management</h2>
<p>Vulnerability management looks at code and infrastructure. Risk management takes a wider view: physical and digital assets together.</p>
<p>It tracks risk signals across both. Physical servers, on-premise infrastructure and office network exposure sit next to cloud services and APIs. It works as a second layer of coverage. It catches the risk signs the vulnerability scanner might miss on its own, and it feeds a compliance signal into the next module.</p>
<h2>Module 3: Compliance</h2>
<p>This one was more straightforward. But I had to understand the frameworks well enough to implement them properly, not just display them.</p>
<p>I implemented two:</p>
<ul>
<li><strong>FATF 40,</strong> the Financial Action Task Force's forty recommendations, mostly about stopping money laundering and financial crime.</li>
<li><strong>ISO 27001,</strong> the international standard for managing information security.</li>
</ul>
<p>The module compares the customer's current setup against each framework's requirements and flags the gaps. It isn't checkbox compliance. The logic checks actual behaviour against the standard's controls.</p>
<p>It's modular on purpose. As the platform moves into other regions, like the EU and the US, frameworks such as GDPR or SOC 2 can be added without rebuilding what's already there.</p>
<h2>Module 4: Report Engine</h2>
<p>This was the module I enjoyed building most, and the one that needed the most product thinking.</p>
<p>Security data is useless if you can't get it to the people who need to act on it. A developer and a CEO need very different documents. So I built one report engine that works from a single source of truth. It pulls live data from all four modules and shapes the report for whoever is reading it.</p>
<p><img alt="One report engine pulling live data from all four modules, with two outputs: a technical report for auditors, security engineers and developers, and a non-technical report for executives, product managers and the board." src="https://abubakar-yinusa.vercel.app/assets/writing/inherited-a-broken-codebase/report.webp" /></p>
<ul>
<li><strong>Technical reports,</strong> for auditors, security engineers and developers, include raw scan output, vulnerability details, CVSS scores, affected assets and remediation steps.</li>
<li><strong>Non-technical reports,</strong> for executives, product managers and the board, show risk posture, compliance status and priority actions. Nobody has to know what a CVSS score means to read one.</li>
</ul>
<p>One engine, two outputs. The formatting and pagination were harder than I expected, because live data doesn't always sit cleanly inside a PDF layout. But the result is a report that works for everyone in the organization, not just the engineers.</p>
<h2>The Incident Response Layer</h2>
<p>Incident response was technically another developer's module. I was still closely involved, because it depended entirely on the logs coming from the four modules I'd built.</p>
<p>It works as an event listener. Each module writes structured logs as it runs. I used Ingest to generate and manage them, with a deliberate filter: not everything gets logged. Only high and critical events make it through.</p>
<p>When one of those events is detected, an incident is created automatically and escalated to the right people: the CTO, the security lead, whoever holds the authority in the customer's organization.</p>
<p><img alt="Every event from the four modules goes through a filter. Only high and critical events get through, and each one becomes an incident escalated to the CTO, the security lead, or whoever holds the authority." src="https://abubakar-yinusa.vercel.app/assets/writing/inherited-a-broken-codebase/logs.webp" /></p>
<p>The restraint was the point. Logging everything creates noise that hides the important signals. Logging only what matters means that when an alert fires, people take it seriously.</p>
<h2>What Two Months Actually Looked Like</h2>
<p>By the time I was done, I had:</p>
<ul>
<li>refactored a broken codebase into something that could actually ship</li>
<li>redesigned the database schema across four modules</li>
<li>built automated security scanning into CI/CD</li>
<li>implemented two international compliance frameworks</li>
<li>built a report engine with two outputs</li>
<li>wired in structured logging for incident escalation</li>
<li>contributed to a full UI redesign proposal and rebuilt the landing page</li>
</ul>
<p>It was a team of four, loosely coordinated, working without pay, against a deadline that kept moving. Not ideal conditions. But there's something clarifying about inheriting a mess. It forces you to understand a system completely before you can trust anything in it.</p>
<h2>What I'd Tell Another Developer in the Same Situation</h2>
<ol>
<li><strong>Don't trust the README. Read the code first.</strong> The documentation I got described a platform that didn't exist yet. The code told the truth.</li>
<li><strong>Triage before you write a single line.</strong> When you see a broken codebase, the instinct is to start fixing. Resist it. Map the damage first, or you'll fix one thing and break three others.</li>
<li><strong>Mock data is worse than no data.</strong> An empty function is honest. Mock data makes a system look like it works, so the real problem stays hidden until someone uses it in production. I'd rather inherit a skeleton than a fake.</li>
<li><strong>Document as you go.</strong> I wrote six documents just to understand what I'd inherited. By the end there was real documentation, not because anyone asked for it, but because the next developer shouldn't have to do what I did.</li>
</ol>
<p>The platform launches this month. Four modules, ready for production. Automated security scanning in CI/CD. Two compliance frameworks. A report engine that works for a developer and a board member alike.</p>
<p>No mock data. No broken links. No routes to nowhere.</p>
<p>If you've ever cloned a repo, run the install, and felt that sinking feeling as the errors started appearing, you're not alone. And for what it's worth, it's fixable.</p>
<p>It just takes longer than they told you.</p>]]></content:encoded>
  </item>
</channel>
</rss>
