<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ryan Kelly</title>
    <description>The latest articles on DEV Community by Ryan Kelly (@rykelly).</description>
    <link>https://dev.to/rykelly</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3816165%2F5f59c831-fd81-4cea-9af8-386e4ff79077.png</url>
      <title>DEV Community: Ryan Kelly</title>
      <link>https://dev.to/rykelly</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rykelly"/>
    <language>en</language>
    <item>
      <title>From Piscine to Production: What Zone01's Peer Learning Model Taught Me</title>
      <dc:creator>Ryan Kelly</dc:creator>
      <pubDate>Tue, 17 Nov 2026 11:38:22 +0000</pubDate>
      <link>https://dev.to/rykelly/from-piscine-to-production-what-zone01s-peer-learning-model-taught-me-102l</link>
      <guid>https://dev.to/rykelly/from-piscine-to-production-what-zone01s-peer-learning-model-taught-me-102l</guid>
      <description>&lt;p&gt;There is no lecturer at Zone01 Kisumu.&lt;/p&gt;

&lt;p&gt;I walked in with no programming experience at all. I expected it to be hard, and I hoped for the best. What I got was harder, and more frustrating, than I'd prepared for.&lt;/p&gt;

&lt;p&gt;In that first week, I was dropped straight into concepts I'd never seen and expected to find my own way through them. Nobody stands at a whiteboard and explains how loops work. You get a spec and a deadline, and you work it out.&lt;/p&gt;

&lt;p&gt;Asking for help wasn't as simple as I'd imagined either. Everyone around me was at a different level. Ask a teammate who'd been coding for years, and you might get an explanation so deep and technical that it went straight over your head. The help was real, but it wasn't pitched at where I was standing.&lt;/p&gt;

&lt;p&gt;It took a few weeks before I steadied myself. Even then, surviving the pool meant putting in more hours than most of the people around me, because I was starting from zero. I'm not saying that for sympathy. It's the honest starting point of this story, and it's why I think what came next is worth sharing.&lt;/p&gt;

&lt;p&gt;I've since moved from JavaScript exercises to Go backends, a DNS server, a web forum, and a Lightning Network escrow system shipped at a hackathon. Looking back, almost everything I know came from one idea: &lt;strong&gt;you learn the most when nobody hands you the answer.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This article is about what that looks like in practice: what worked, what was hard, and what I'd tell someone about to start.&lt;/p&gt;

&lt;h2&gt;
  
  
  What "peer learning" actually means
&lt;/h2&gt;

&lt;p&gt;Before the details, here is the model in plain terms.&lt;/p&gt;

&lt;p&gt;At Zone01, there's no curriculum delivered by instructors. Projects are specified, and you're expected to figure out how to build them. When you get stuck, you ask your peers. When someone else is stuck, you're expected to help, which turns out to be where a lot of the learning happens.&lt;/p&gt;

&lt;p&gt;It's project-based all the way down. You don't finish a chapter and then take a quiz. You build something, and an automated grader or a peer review tells you whether it works.&lt;/p&gt;

&lt;p&gt;That sounds simple, but it changes how you learn. In a lecture, you can feel like you understand something because the explanation made sense. In a project, you find out fast whether you do, because the code either runs or it doesn't.&lt;/p&gt;

&lt;h2&gt;
  
  
  The piscine: a month of productive confusion
&lt;/h2&gt;

&lt;p&gt;The "piscine" (French for swimming pool) is the intense entry phase: you get thrown in and learn to swim. Mine was JavaScript.&lt;/p&gt;

&lt;p&gt;Some exercises looked easy and weren't. I remember working through deep-freezing objects with &lt;code&gt;Object.freeze()&lt;/code&gt;. The first version I wrote froze the outer object and nothing else, because &lt;code&gt;Object.freeze()&lt;/code&gt; is shallow. Nested objects stayed mutable. That one bug taught me more about references and mutability than any definition could have, because I had to &lt;em&gt;see&lt;/em&gt; the mutation happen to believe it.&lt;/p&gt;

&lt;p&gt;Then came the regex exercises: &lt;code&gt;sameAmount&lt;/code&gt;, &lt;code&gt;ionOut&lt;/code&gt;, &lt;code&gt;groupPrice&lt;/code&gt;, &lt;code&gt;findIP&lt;/code&gt;. Regex is unusual in that you can't half-understand it. A pattern either matches what you meant or it doesn't. &lt;code&gt;findIP&lt;/code&gt; in particular forced me to think about edge cases: what counts as a valid octet, what the boundaries are, what the pattern should reject.&lt;/p&gt;

&lt;p&gt;The Date exercises were humbling for a different reason. Dates look simple until you hit month boundaries, leap years, and time zones. Seven projects on &lt;code&gt;Date&lt;/code&gt; taught me to distrust my assumptions about "obvious" things.&lt;/p&gt;

&lt;p&gt;By Level 12, the work moved to the DOM: &lt;code&gt;keycodes-symphony&lt;/code&gt;, &lt;code&gt;mouse-trap&lt;/code&gt;, &lt;code&gt;pick-and-click&lt;/code&gt;, &lt;code&gt;gossip-grid&lt;/code&gt;, &lt;code&gt;where-do-we-go&lt;/code&gt;. This is where JavaScript stopped being abstract. You write code and something happens on screen. Events, state, and the order things run in all start to matter. Then came object utilities like &lt;code&gt;invert&lt;/code&gt;, &lt;code&gt;pick-omit&lt;/code&gt;, and &lt;code&gt;fusion&lt;/code&gt;, which were small functions with a big lesson: when you rebuild the tools you normally take for granted, you understand what they actually do.&lt;/p&gt;

&lt;h3&gt;
  
  
  What the piscine really teaches
&lt;/h3&gt;

&lt;p&gt;The exercises are the surface. Underneath, the piscine teaches habits:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Read the spec twice.&lt;/strong&gt; Most of my early failures were me solving a problem the spec didn't ask for.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Run the grader, read the failure, change one thing.&lt;/strong&gt; Changing five things at once means you never learn which one mattered.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Get comfortable being stuck.&lt;/strong&gt; Being stuck isn't a sign you're failing. It's the state in which learning happens.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Debugging is the real curriculum
&lt;/h2&gt;

&lt;p&gt;One project stands out when I think about what this program teaches: a JavaScript crossword solver, split across multiple ES modules.&lt;/p&gt;

&lt;p&gt;It wasn't hard because of the algorithm. It was hard because of the bugs. An indexing mistake that was off by one. A variable referenced in a file where it was never defined. And my favorite, a direction check in &lt;code&gt;placeWord.js&lt;/code&gt; that was logically inverted, so words were being placed in exactly the wrong orientation.&lt;/p&gt;

&lt;p&gt;None of those bugs are impressive. Every one of them cost me hours. And every one of them made me better, because I learned to stop guessing and start tracing: print the state, check the assumption, narrow the problem down.&lt;/p&gt;

&lt;p&gt;Multi-file projects were the other lesson. Once your code is spread across modules, "where does this value come from?" becomes a real question. That's closer to real work than any single-file exercise.&lt;/p&gt;

&lt;p&gt;I also built a superhero database app in vanilla JavaScript with sorting, filtering, and pagination. Doing it without a framework was the point. I had to implement the logic that a library would normally hide, and now I understand what frameworks are saving me from.&lt;/p&gt;

&lt;h2&gt;
  
  
  Moving to Go: concurrency stops being theory
&lt;/h2&gt;

&lt;p&gt;After the JavaScript phase, the projects got bigger and the language changed to Go.&lt;/p&gt;

&lt;h3&gt;
  
  
  The TCP chat server
&lt;/h3&gt;

&lt;p&gt;My Net-Cat clone, a TCP chat server, was where Go clicked. It uses goroutines for each connection, channels for communication, and the Hub pattern: a central goroutine that owns the state and coordinates everyone else.&lt;/p&gt;

&lt;p&gt;Before this project, "concurrency" was a word. After it, I'd &lt;em&gt;felt&lt;/em&gt; what a race condition is. Two clients writing at once will find every flaw in your design.&lt;/p&gt;

&lt;p&gt;The Hub pattern also taught me something about design: instead of protecting shared state with locks everywhere, you give one goroutine ownership of that state and have everyone else talk to it through channels. It's a way of thinking, not just a technique.&lt;/p&gt;

&lt;h3&gt;
  
  
  The web forum
&lt;/h3&gt;

&lt;p&gt;Next came a web forum in Go with SQLite: authentication, posts, comments, and tests.&lt;/p&gt;

&lt;p&gt;This was my first project that felt like a real application. It had users, sessions, a database, and the dull-but-important concerns that tutorials skip: validating input, handling errors without leaking details, and keeping the database layer separate from the handlers.&lt;/p&gt;

&lt;p&gt;Writing tests for it changed how I coded. When your code is hard to test, it's usually badly structured, and the tests tell you so before anyone else does.&lt;/p&gt;

&lt;h3&gt;
  
  
  The DNS server
&lt;/h3&gt;

&lt;p&gt;I also built a DNS server in Go. DNS is one of those things you use a thousand times a day without thinking about it. Building a server meant reading about how queries and responses are structured, then writing code that speaks that protocol.&lt;/p&gt;

&lt;p&gt;It was the first time I felt the gap between &lt;em&gt;using&lt;/em&gt; the internet and &lt;em&gt;understanding&lt;/em&gt; it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Shipping under pressure
&lt;/h2&gt;

&lt;p&gt;Hackathons are where the peer-learning model shows its value, because the conditions are the same as the program: unclear problem, tight deadline, and a team that has to figure it out together.&lt;/p&gt;

&lt;p&gt;At one hackathon, I shipped &lt;strong&gt;Karanda, a Lightning Network escrow system&lt;/strong&gt;. Before that, my exposure to Bitcoin and the Lightning Network was a week-long developer bootcamp, where I worked through a Go-based blockchain explorer against a local regtest node, debugged JSON-RPC issues, configured &lt;code&gt;bitcoin.conf&lt;/code&gt;, and set up Lightning nodes for two test users.&lt;/p&gt;

&lt;p&gt;Going from "I just learned what a channel is" to "I shipped an escrow built on it" in a short time is only possible because the program trains you to learn on demand.&lt;/p&gt;

&lt;p&gt;The hackathon lasted 48 hours, and there were five of us. We didn't split into neat, fixed roles. We coordinated across everything together, picking up whatever the project needed at the moment. That's peer learning in its purest form: no one assigned the work, and no one had all the answers.&lt;/p&gt;

&lt;p&gt;It was tight. We finished with the deadline nearly on top of us. But what I remember most isn't the pressure. It's that we took an idea and turned it into something real. Lightning had been new to me, and now there was a working product built on it.&lt;/p&gt;

&lt;p&gt;The biggest lesson wasn't technical. It was scoping. Under a deadline, you learn quickly to separate "must work" from "nice to have", and to ship something small that works over something ambitious that doesn't.&lt;/p&gt;

&lt;h2&gt;
  
  
  The habits nobody warned me about
&lt;/h2&gt;

&lt;p&gt;Some of the most useful parts of Zone01 aren't coding at all.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Daily standups.&lt;/strong&gt; Logging what you did, what's blocking you, and what's next feels like paperwork at first. Over time it becomes a way to stay honest about your progress. It's hard to tell yourself you're making progress when the log says otherwise.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;OKRs and documentation.&lt;/strong&gt; Writing objectives and documenting your work felt corporate to me at first. Now I think it's what separates someone who can code from someone who can work on a team. *&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Writing publicly.&lt;/strong&gt; I started writing on dev.to, covering events and sharing what I was building. Explaining something in writing is the fastest way I know to find out whether you actually understand it. If I can't explain it clearly, I don't know it well enough yet.&lt;/p&gt;

&lt;h2&gt;
  
  
  What peer learning doesn't give you
&lt;/h2&gt;

&lt;p&gt;It would be dishonest to pretend this model is perfect.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;No one tells you if your approach is idiomatic.&lt;/strong&gt; A grader can say your code works. It can't say your code is good, or that there's a much cleaner way.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Help is uneven.&lt;/strong&gt; Who can help you depends on who's around and what they've already learned. Sometimes the answer is "nobody here knows this yet," and you're on your own.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Gaps hide easily.&lt;/strong&gt; If you can pass the grader without understanding something, it's easy to move on. You have to be disciplined about going back.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fundamentals can get skipped.&lt;/strong&gt; Project-first learning means theory (data structures, networking, how databases work) can arrive late, or only when a project forces it.
I closed those gaps by reading other people's code, contributing to open source, and writing about what I learn. None of it was assigned. All of it mattered.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Advice if you're about to start
&lt;/h2&gt;

&lt;p&gt;If you're joining a program like this, here's what I'd tell you:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Read the spec twice before you write a line.&lt;/strong&gt; Most wasted hours come from solving the wrong problem.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ask for help, but ask well.&lt;/strong&gt; Before asking, be able to say what you expected, what happened, and what you've already tried. That question usually answers itself halfway through.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Help others even when you feel unqualified.&lt;/strong&gt; Explaining a concept you've just learned is the best test of whether you understand it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Don't just pass the grader.&lt;/strong&gt; After a project works, ask: could I rebuild this without looking? Do I know why each part is there?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Build things for real people.&lt;/strong&gt; Exercises teach syntax. Projects with users teach judgment.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Document and publish as you go.&lt;/strong&gt; Future you, and anyone else who's stuck on the same problem, will thank you.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Peer learning isn't the easy way. It's slower at the start, more frustrating, and less comforting than being taught. But it builds something lectures can't: the ability to walk into a problem you've never seen and figure it out.&lt;/p&gt;

&lt;p&gt;That's the skill I took from the piscine to production, and it's the one I expect to keep using long after any specific language or framework has changed.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>programming</category>
      <category>learning</category>
      <category>career</category>
    </item>
    <item>
      <title>Building Covet: a Go backend that turns outfit photos into shoppable matches</title>
      <dc:creator>Ryan Kelly</dc:creator>
      <pubDate>Tue, 17 Nov 2026 00:00:00 +0000</pubDate>
      <link>https://dev.to/rykelly/building-covet-a-go-backend-that-turns-outfit-photos-into-shoppable-matches-36d6</link>
      <guid>https://dev.to/rykelly/building-covet-a-go-backend-that-turns-outfit-photos-into-shoppable-matches-36d6</guid>
      <description>&lt;p&gt;I keep seeing outfits I like in films and on social media, and I never know what the pieces are, what they cost, or where to buy them. &lt;strong&gt;Covet&lt;/strong&gt; is my attempt at fixing that: you upload a photo, it detects the clothing items, tags the overall style, and returns real products to buy, including cheaper alternatives.&lt;/p&gt;

&lt;p&gt;It’s a portfolio project, so the goal is to practise real backend work in Go: API design, a proper schema, third-party integrations and async processing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Scoping before coding
&lt;/h2&gt;

&lt;p&gt;The early decisions that saved me the most time were about what &lt;em&gt;not&lt;/em&gt; to build:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;No custom ML.&lt;/strong&gt; Training a clothing detector is a research project. I use existing vision models.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No user-generated data.&lt;/strong&gt; Covet works from external product data, so it needs no community to be useful.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A search engine, not a chatbot.&lt;/strong&gt; The output is structured: items, prices, retailers, links.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cut from the MVP:&lt;/strong&gt; exact visual matching, a separate price-estimate feature, and price-drop alerts.
The pipeline looks like this:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;POST /outfits -&amp;gt; save image, insert row (status: pending), return id
  background job -&amp;gt; detect items, find products, store them (status: complete)
GET /outfits/{id}/results -&amp;gt; client polls until status is complete
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The stack is Go with the standard library router, Postgres in Docker through &lt;code&gt;pgx&lt;/code&gt;, Gemini for style tags, and Lykdat for detection and product matching.&lt;/p&gt;

&lt;h2&gt;
  
  
  Foundations: config, a pool and context
&lt;/h2&gt;

&lt;p&gt;The first milestone was boring on purpose: a server that loads config from the environment, opens a &lt;code&gt;pgxpool&lt;/code&gt; connection pool, &lt;strong&gt;pings the database at startup&lt;/strong&gt; and refuses to start if that fails. Failing fast beats discovering a bad &lt;code&gt;DATABASE_URL&lt;/code&gt; on the first real request.&lt;/p&gt;

&lt;p&gt;This is also where I properly learned &lt;code&gt;context.Context&lt;/code&gt;: a cancellation and deadline signal that travels down the call chain so work stops when nobody wants the result any more. It matters again later, because the background job can’t reuse the request’s context.&lt;/p&gt;

&lt;h2&gt;
  
  
  Schema decisions
&lt;/h2&gt;

&lt;p&gt;Five tables: &lt;code&gt;users&lt;/code&gt;, &lt;code&gt;sessions&lt;/code&gt;, &lt;code&gt;outfit_uploads&lt;/code&gt;, &lt;code&gt;detected_items&lt;/code&gt; and &lt;code&gt;product_matches&lt;/code&gt;. A few choices I’d defend in an interview:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;match_type&lt;/code&gt; as text&lt;/strong&gt; (&lt;code&gt;closest_match&lt;/code&gt; or &lt;code&gt;budget_alternative&lt;/code&gt;) rather than a boolean, so a third category later doesn’t force a schema change.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;outfit_uploads.user_id&lt;/code&gt; is nullable with &lt;code&gt;ON DELETE SET NULL&lt;/code&gt;.&lt;/strong&gt; Anonymous uploads work, and deleting an account doesn’t destroy the data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;NUMERIC(10,2)&lt;/code&gt; for prices.&lt;/strong&gt; Never floats for money.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;UUID primary keys for users and sessions&lt;/strong&gt;, because they end up in cookies.
## The upload endpoint&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;POST /outfits&lt;/code&gt; does more than save a file:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;It caps the body at 10 MB.&lt;/li&gt;
&lt;li&gt;It &lt;strong&gt;detects the real content type from the first 512 bytes&lt;/strong&gt; instead of trusting the extension, then calls &lt;code&gt;Seek(0, 0)&lt;/code&gt; so the saved file isn’t missing those bytes.&lt;/li&gt;
&lt;li&gt;It saves the file under a &lt;strong&gt;UUID filename&lt;/strong&gt; so uploads can’t collide.&lt;/li&gt;
&lt;li&gt;It inserts a row with &lt;code&gt;status = 'pending'&lt;/code&gt; and returns &lt;code&gt;201&lt;/code&gt; with the id immediately.
The slow part runs in a goroutine:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;go&lt;/span&gt; &lt;span class="n"&gt;h&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;runDetection&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;uploadID&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;savePath&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Inside, I use &lt;code&gt;context.Background()&lt;/code&gt;, not &lt;code&gt;r.Context()&lt;/code&gt;. The request context is cancelled the moment the response is written, which would kill the job mid-flight. The &lt;code&gt;status&lt;/code&gt; column (&lt;code&gt;pending&lt;/code&gt;, &lt;code&gt;processing&lt;/code&gt;, &lt;code&gt;complete&lt;/code&gt;, &lt;code&gt;failed&lt;/code&gt;) is what lets the client poll honestly instead of hanging on a 10-second request.&lt;/p&gt;

&lt;h2&gt;
  
  
  Don’t trust model output
&lt;/h2&gt;

&lt;p&gt;My first design asked Gemini for structured JSON describing each garment. Models drift from schemas, so I put three defences between the model and the database:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Ask for JSON mode&lt;/strong&gt; in the API call.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Validate in Go&lt;/strong&gt; before inserting anything: at least one item, no more than ten, non-empty category and description, and a length cap.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Normalize&lt;/strong&gt; known values, so “outerwear”, “coat” and “blazer” all become &lt;code&gt;jacket&lt;/code&gt;, and style tags are lowercased and de-duplicated.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Items&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Errorf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"no items detected in image"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two smaller lessons from this stage. Model names churn: &lt;code&gt;gemini-1.5-flash&lt;/code&gt; and then &lt;code&gt;gemini-2.0-flash&lt;/code&gt; both returned 404 errors when I called them, so the model name belongs in config. And Go refuses to compile unused imports and variables, which annoyed me for a day and then started catching real mistakes.&lt;/p&gt;

&lt;h2&gt;
  
  
  The shopping search dead end
&lt;/h2&gt;

&lt;p&gt;Next I turned each detected item’s description into a Google Shopping query through SerpAPI. It failed in a way that taught me the most.&lt;/p&gt;

&lt;p&gt;Descriptions like “vibrant bright yellow cropped fleece hoodie with drawstring hood” returned nothing. SerpAPI’s response reported the results state as “Fully empty”. I shortened the queries, stripped stop words and kept only colour, one descriptor and the category. Some started returning results. Others didn’t.&lt;/p&gt;

&lt;p&gt;One bug was entirely mine. I added debug logging that read the response body with &lt;code&gt;io.ReadAll&lt;/code&gt;, then parsed it with &lt;code&gt;json.NewDecoder(resp.Body)&lt;/code&gt;. The body was already consumed, so every parse failed with &lt;code&gt;EOF&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="n"&gt;bodyBytes&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;io&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;ReadAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Body&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"response: %s"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;bodyBytes&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;// parsing resp.Body again here returns EOF, so parse the bytes instead:&lt;/span&gt;
&lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Unmarshal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;bodyBytes&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;parsed&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A response body is a stream you can read once. I also lost an evening to timeouts that turned out to be my own machine’s network, not the API.&lt;/p&gt;

&lt;p&gt;The deeper problem was the translation layer. I was flattening a rich visual understanding into a text query for a product search that expects retailer-written titles. Simplifying queries until they return results also makes them generic. “Yellow top” is something you can type into Google yourself.&lt;/p&gt;

&lt;h2&gt;
  
  
  Switching to image-native matching
&lt;/h2&gt;

&lt;p&gt;Lykdat’s Global Search API takes the &lt;strong&gt;image&lt;/strong&gt; and returns detected items with similar products (name, brand, price, currency, URL, images and a similarity score) in one call. The free plan allows 500 image searches a month, which is plenty for development.&lt;/p&gt;

&lt;p&gt;That changed the architecture. Lykdat became the source of truth for detection and matching, and Gemini shrank to one whole-outfit call that returns style tags like “streetwear” or “minimalist”. Running two independent detectors and aligning them afterwards by category name would have produced mismatches.&lt;/p&gt;

&lt;p&gt;I’d believed the shopping service was an abstraction I could swap without touching the handlers. That turned out to be false. The old method took a detected item and a country, and the new one takes an image path, so &lt;code&gt;runDetection&lt;/code&gt; had to be rewritten. &lt;strong&gt;An interface shaped around one provider’s paradigm leaks when the paradigm changes.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Making “budget alternative” mean something
&lt;/h2&gt;

&lt;p&gt;My first rule labelled the top five results as closest matches and everything after as budget alternatives. Lykdat returned up to 50 products per item, so dozens landed in the “budget” tab purely because they ranked lower, and some cost more than the closest matches.&lt;/p&gt;

&lt;p&gt;The fix: sort by similarity score and take the top eight as closest matches. Then label a lower-ranked product a budget alternative only if it’s cheaper than the average closest match &lt;strong&gt;in the same currency&lt;/strong&gt;. The total is capped at 20 per item. Now the label is true.&lt;/p&gt;

&lt;h2&gt;
  
  
  The results endpoint
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;GET /outfits/{id}/results&lt;/code&gt; returns just the status until the job completes, then the full tree. A few decisions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Filters are SQL, not API calls.&lt;/strong&gt; Changing the budget bracket never calls Lykdat or Gemini again, because everything is already stored:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;detected_item_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;ANY&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$2&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="kt"&gt;text&lt;/span&gt;    &lt;span class="k"&gt;IS&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt; &lt;span class="k"&gt;OR&lt;/span&gt; &lt;span class="n"&gt;match_type&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$3&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="kt"&gt;numeric&lt;/span&gt; &lt;span class="k"&gt;IS&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt; &lt;span class="k"&gt;OR&lt;/span&gt; &lt;span class="n"&gt;price&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="nv"&gt;$3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$4&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="kt"&gt;numeric&lt;/span&gt; &lt;span class="k"&gt;IS&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt; &lt;span class="k"&gt;OR&lt;/span&gt; &lt;span class="n"&gt;price&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="nv"&gt;$4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$5&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="kt"&gt;text&lt;/span&gt;    &lt;span class="k"&gt;IS&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt; &lt;span class="k"&gt;OR&lt;/span&gt; &lt;span class="n"&gt;currency&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Two queries, not one per item.&lt;/strong&gt; One fetches the items and one fetches all their matches with &lt;code&gt;ANY($1)&lt;/code&gt;, which avoids the N+1 pattern.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;ORDER BY&lt;/code&gt; comes from a fixed list&lt;/strong&gt;, never straight from user input, because it can’t be parameterized.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Links are built at response time.&lt;/strong&gt; The database keeps the clean retailer URL. The response adds a &lt;code&gt;shop_url&lt;/code&gt;, wrapped by an affiliate service that does nothing until it’s configured, so approval delays don’t block development.
## Auth, without ceremony&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Cookie sessions backed by a &lt;code&gt;sessions&lt;/code&gt; table: register, login, logout and a &lt;code&gt;/auth/me&lt;/code&gt; endpoint. Passwords are hashed with bcrypt (capped at 72 characters, which is all bcrypt reads), and login failures return one generic message. When the email doesn’t exist, the handler still runs a dummy bcrypt comparison so response time doesn’t reveal which emails are registered.&lt;/p&gt;

&lt;p&gt;A middleware identifies the user if a valid session exists and never rejects the request, so the app still works logged out. Owned outfits return &lt;code&gt;404&lt;/code&gt;, not &lt;code&gt;403&lt;/code&gt;, to anyone else, so ids can’t be probed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Things that bit me
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Docker data loss.&lt;/strong&gt; My Postgres container kept breaking, and each recreation wiped my tables because the data lived inside the container. A named volume is the fix.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A key in a log line.&lt;/strong&gt; An error that printed the full request URL leaked an API key into my terminal output. Log response bodies, not request URLs, and rotate anything that leaks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Wiring renames.&lt;/strong&gt; Swapping one provider for another touched config, constructors, &lt;code&gt;main.go&lt;/code&gt; and the &lt;code&gt;.env&lt;/code&gt; file, and a missed rename produced “undefined” errors in three places.
## What’s next&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The remaining Phase 1 item is the frontend, built as plain HTML, CSS and JavaScript served by the Go server so there’s no CORS to deal with. After that come a landing page with smooth scrolling, an AI stylist chat grounded in each outfit’s stored results, and a virtual try-on experiment. Whether they land depends on what the data shows.&lt;/p&gt;

&lt;p&gt;If you’re building something similar, the most useful thing I can pass on is to test the riskiest assumption first. Mine was “a text description will find the right product”, and I spent days on it before checking.&lt;/p&gt;

</description>
      <category>fashion</category>
      <category>webdev</category>
      <category>ai</category>
      <category>go</category>
    </item>
    <item>
      <title>M-pesa STK Push in Go: From Sandbox Credentials to a Working Payment Callback</title>
      <dc:creator>Ryan Kelly</dc:creator>
      <pubDate>Mon, 16 Nov 2026 20:15:02 +0000</pubDate>
      <link>https://dev.to/rykelly/m-pesa-stk-push-in-go-from-sandbox-credentials-to-a-working-payment-callback-4kdn</link>
      <guid>https://dev.to/rykelly/m-pesa-stk-push-in-go-from-sandbox-credentials-to-a-working-payment-callback-4kdn</guid>
      <description>&lt;p&gt;I'm learning Go by building a real product: &lt;strong&gt;ElimuLocal&lt;/strong&gt;, a free study-resource platform for Kenyan university students. Once it was solid, I wanted a premium tier, and in Kenya that means one thing: M-Pesa. This article walks through how I integrated Safaricom's Daraja &lt;strong&gt;STK Push&lt;/strong&gt; in Go, what broke, and what I'd do differently.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. The flow at a glance
&lt;/h2&gt;

&lt;p&gt;STK Push means your server asks Safaricom to pop up a PIN prompt on the customer's phone. Four parties are involved:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Customer phone        Your Go server           Daraja / Safaricom
      |                     |                          |
      |  taps "Pay"         |                          |
      |--------------------&amp;gt;|  1. OAuth token          |
      |                     |-------------------------&amp;gt;|
      |                     |  2. STK Push request     |
      |                     |-------------------------&amp;gt;|
      |   PIN prompt        |&amp;lt;-- 3. "accepted" + ID ---|
      |&amp;lt;---------------------------------------------- |
      |  enters PIN         |                          |
      |--------------------------------------------&amp;gt;   |
      |                     |  4. Callback (result)    |
      |                     |&amp;lt;-------------------------|
      |                     |  5. Activate premium     |
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The key insight: &lt;strong&gt;step 3 only means "request accepted", not "paid."&lt;/strong&gt; The real answer arrives later, asynchronously, at your callback URL. Everything in this article follows from that.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Sandbox setup and credentials
&lt;/h2&gt;

&lt;p&gt;Create an account at the Daraja developer portal, make an app, and enable the &lt;strong&gt;Lipa Na M-Pesa Sandbox&lt;/strong&gt; product. You get a Consumer Key and Secret. The sandbox shortcode is &lt;code&gt;174379&lt;/code&gt; and Safaricom publishes a public sandbox passkey.&lt;/p&gt;

&lt;p&gt;I keep everything in environment variables, never in code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;MPESA_CONSUMER_KEY=...
MPESA_CONSUMER_SECRET=...
MPESA_SHORTCODE=174379
MPESA_PASSKEY=&amp;lt;sandbox passkey from the portal&amp;gt;
MPESA_CALLBACK_URL=https://&amp;lt;your-public-host&amp;gt;/mpesa/callback
MPESA_ENV=sandbox
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Setting&lt;/th&gt;
&lt;th&gt;Sandbox&lt;/th&gt;
&lt;th&gt;Production&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Base URL&lt;/td&gt;
&lt;td&gt;&lt;code&gt;https://sandbox.safaricom.co.ke&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;https://api.safaricom.co.ke&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Shortcode&lt;/td&gt;
&lt;td&gt;&lt;code&gt;174379&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Your own Paybill/Till&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Passkey&lt;/td&gt;
&lt;td&gt;Public test key&lt;/td&gt;
&lt;td&gt;Issued to you after Go-Live&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Callback URL&lt;/td&gt;
&lt;td&gt;Must be public HTTPS (ngrok is fine)&lt;/td&gt;
&lt;td&gt;Your real domain&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A small struct holds the config:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="nc"&gt;DarajaClient&lt;/span&gt; &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;ConsumerKey&lt;/span&gt;    &lt;span class="kt"&gt;string&lt;/span&gt;
    &lt;span class="nc"&gt;ConsumerSecret&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;
    &lt;span class="nc"&gt;ShortCode&lt;/span&gt;      &lt;span class="kt"&gt;string&lt;/span&gt;
    &lt;span class="nc"&gt;Passkey&lt;/span&gt;        &lt;span class="kt"&gt;string&lt;/span&gt;
    &lt;span class="nc"&gt;CallbackURL&lt;/span&gt;    &lt;span class="kt"&gt;string&lt;/span&gt;
    &lt;span class="nc"&gt;BaseURL&lt;/span&gt;        &lt;span class="kt"&gt;string&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. Getting an access token
&lt;/h2&gt;

&lt;p&gt;Daraja uses OAuth. You send your key and secret as HTTP Basic auth and get a short-lived bearer token:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;d&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nc"&gt;DarajaClient&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nf"&gt;getAccessToken&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;NewRequest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"GET"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;BaseURL&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="s2"&gt;"/oauth/v1/generate?grant_type=client_credentials"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;nil&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="kc"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;creds&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;base64&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;StdEncoding&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;EncodeToString&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="kt"&gt;byte&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;ConsumerKey&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s2"&gt;":"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;ConsumerSecret&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Header&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Authorization"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Basic "&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="n"&gt;creds&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Client&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nc"&gt;Timeout&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;15&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Second&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Do&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="kc"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;defer&lt;/span&gt; &lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Body&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Close&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="n"&gt;out&lt;/span&gt; &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;AccessToken&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="sb"&gt;`json:"access_token"`&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;NewDecoder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Body&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Decode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;out&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="kc"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;out&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;AccessToken&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;nil&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note the explicit &lt;code&gt;http.Client&lt;/code&gt; timeout. Go's default client has &lt;strong&gt;none&lt;/strong&gt;, so a slow Safaricom response would hang your handler forever. Tokens last about an hour; I fetch one per payment for simplicity and would cache it in production.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Initiating the STK Push
&lt;/h2&gt;

&lt;p&gt;Two things trip people up: the &lt;strong&gt;timestamp&lt;/strong&gt; and the &lt;strong&gt;password&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Timestamp format is &lt;code&gt;YYYYMMDDHHmmss&lt;/code&gt;. In Go that's the reference layout &lt;code&gt;20060102150405&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Password is &lt;code&gt;base64(shortcode + passkey + timestamp)&lt;/code&gt;.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;d&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nc"&gt;DarajaClient&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nf"&gt;initiateSTKPush&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;phone&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;amount&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ref&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nc"&gt;STKResponse&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;token&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getAccessToken&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="kc"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;nil&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="n"&gt;timestamp&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Now&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Format&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"20060102150405"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;password&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;base64&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;StdEncoding&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;EncodeToString&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="kt"&gt;byte&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;ShortCode&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Passkey&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;timestamp&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;payload&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="k"&gt;map&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="k"&gt;interface&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="s2"&gt;"BusinessShortCode"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;ShortCode&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"Password"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;          &lt;span class="n"&gt;password&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"Timestamp"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;         &lt;span class="n"&gt;timestamp&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"TransactionType"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;   &lt;span class="s2"&gt;"CustomerPayBillOnline"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"Amount"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;            &lt;span class="n"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"PartyA"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;            &lt;span class="n"&gt;phone&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;       &lt;span class="c1"&gt;// who pays&lt;/span&gt;
        &lt;span class="s2"&gt;"PartyB"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;            &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;ShortCode&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// who receives&lt;/span&gt;
        &lt;span class="s2"&gt;"PhoneNumber"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;       &lt;span class="n"&gt;phone&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;       &lt;span class="c1"&gt;// who gets the prompt&lt;/span&gt;
        &lt;span class="s2"&gt;"CallBackURL"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;       &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;CallbackURL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"AccountReference"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;  &lt;span class="n"&gt;ref&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"TransactionDesc"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;   &lt;span class="s2"&gt;"ElimuLocal Premium"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="c1"&gt;// marshal, POST to /mpesa/stkpush/v1/processrequest with&lt;/span&gt;
    &lt;span class="c1"&gt;// "Authorization: Bearer &amp;lt;token&amp;gt;", decode STKResponse&lt;/span&gt;
    &lt;span class="c1"&gt;// (MerchantRequestID, CheckoutRequestID, ResponseCode, ...)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Phone numbers must be &lt;code&gt;2547XXXXXXXX&lt;/code&gt;&lt;/strong&gt; — no &lt;code&gt;+&lt;/code&gt;, no leading &lt;code&gt;0&lt;/code&gt;. Students type &lt;code&gt;0712…&lt;/code&gt; or &lt;code&gt;+254712…&lt;/code&gt;, so I normalise:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;normalisePhone&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;strings&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;TrimSpace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;strings&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;TrimPrefix&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"+"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;strings&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;HasPrefix&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"0"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"254"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Save before you send.&lt;/strong&gt; My handler inserts a &lt;code&gt;pending&lt;/code&gt; row in &lt;code&gt;payments&lt;/code&gt; &lt;em&gt;first&lt;/em&gt;, then calls Daraja, then stores the returned &lt;code&gt;CheckoutRequestID&lt;/code&gt;. If the callback is faster than your database write, you still have a row to match it to.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;payments&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="kt"&gt;INTEGER&lt;/span&gt; &lt;span class="k"&gt;PRIMARY&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt; &lt;span class="no"&gt;AUTOINCREMENT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;user_id&lt;/span&gt; &lt;span class="kt"&gt;INTEGER&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;phone_number&lt;/span&gt; &lt;span class="kt"&gt;TEXT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;amount&lt;/span&gt; &lt;span class="kt"&gt;INTEGER&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;account_reference&lt;/span&gt; &lt;span class="kt"&gt;TEXT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;checkout_request_id&lt;/span&gt; &lt;span class="kt"&gt;TEXT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;merchant_request_id&lt;/span&gt; &lt;span class="kt"&gt;TEXT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;mpesa_receipt_number&lt;/span&gt; &lt;span class="kt"&gt;TEXT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="kt"&gt;TEXT&lt;/span&gt; &lt;span class="k"&gt;DEFAULT&lt;/span&gt; &lt;span class="s1"&gt;'pending'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;result_code&lt;/span&gt; &lt;span class="kt"&gt;INTEGER&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;result_desc&lt;/span&gt; &lt;span class="kt"&gt;TEXT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;created_at&lt;/span&gt; &lt;span class="kt"&gt;DATETIME&lt;/span&gt; &lt;span class="k"&gt;DEFAULT&lt;/span&gt; &lt;span class="kc"&gt;CURRENT_TIMESTAMP&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;updated_at&lt;/span&gt; &lt;span class="kt"&gt;DATETIME&lt;/span&gt; &lt;span class="k"&gt;DEFAULT&lt;/span&gt; &lt;span class="kc"&gt;CURRENT_TIMESTAMP&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  5. The callback endpoint
&lt;/h2&gt;

&lt;p&gt;Safaricom POSTs the outcome to your &lt;code&gt;CallBackURL&lt;/code&gt;. The payload is nested JSON:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="nc"&gt;STKCallback&lt;/span&gt; &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;Body&lt;/span&gt; &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;StkCallback&lt;/span&gt; &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nc"&gt;MerchantRequestID&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="sb"&gt;`json:"MerchantRequestID"`&lt;/span&gt;
            &lt;span class="nc"&gt;CheckoutRequestID&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="sb"&gt;`json:"CheckoutRequestID"`&lt;/span&gt;
            &lt;span class="nc"&gt;ResultCode&lt;/span&gt;        &lt;span class="kt"&gt;int&lt;/span&gt;    &lt;span class="sb"&gt;`json:"ResultCode"`&lt;/span&gt;
            &lt;span class="nc"&gt;ResultDesc&lt;/span&gt;        &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="sb"&gt;`json:"ResultDesc"`&lt;/span&gt;
            &lt;span class="nc"&gt;CallbackMetadata&lt;/span&gt;  &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="nc"&gt;Item&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                    &lt;span class="nc"&gt;Name&lt;/span&gt;  &lt;span class="kt"&gt;string&lt;/span&gt;      &lt;span class="sb"&gt;`json:"Name"`&lt;/span&gt;
                    &lt;span class="nc"&gt;Value&lt;/span&gt; &lt;span class="k"&gt;interface&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="sb"&gt;`json:"Value"`&lt;/span&gt;
                &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="sb"&gt;`json:"Item"`&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="sb"&gt;`json:"CallbackMetadata"`&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="sb"&gt;`json:"stkCallback"`&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="sb"&gt;`json:"Body"`&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;Value&lt;/code&gt; is &lt;code&gt;interface{}&lt;/code&gt; because it's a number for amounts and a string for receipts. Only successful payments include &lt;code&gt;CallbackMetadata&lt;/code&gt;, which holds &lt;code&gt;MpesaReceiptNumber&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Result codes you'll meet:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;ResultCode&lt;/th&gt;
&lt;th&gt;Meaning&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;Success, money moved&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;Insufficient balance&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1032&lt;/td&gt;
&lt;td&gt;Customer cancelled the prompt&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1037&lt;/td&gt;
&lt;td&gt;Prompt timed out (no response)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2001&lt;/td&gt;
&lt;td&gt;Wrong PIN&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Always answer 200 with &lt;code&gt;{"ResultCode":0,"ResultDesc":"Success"}&lt;/code&gt;&lt;/strong&gt;, even for failed payments. That acknowledgement means "I received your message," not "the payment succeeded." Anything else may cause retries.&lt;/p&gt;

&lt;p&gt;Testing locally needs a public HTTPS URL, so I used &lt;strong&gt;ngrok&lt;/strong&gt; (&lt;code&gt;./ngrok http 8080&lt;/code&gt;) and pasted its URL into &lt;code&gt;MPESA_CALLBACK_URL&lt;/code&gt;. In the sandbox I mostly saw &lt;code&gt;1037&lt;/code&gt;: expected, since the simulator doesn't always wait for a PIN. It proved the plumbing worked.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Edge cases
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Designed but not yet fully implemented in ElimuLocal.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Duplicate callbacks.&lt;/strong&gt; Networks retry. Make the status transition conditional so a second delivery changes nothing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Exec&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`
    UPDATE payments
    SET status = ?, result_code = ?, result_desc = ?,
        mpesa_receipt_number = ?, updated_at = CURRENT_TIMESTAMP
    WHERE checkout_request_id = ? AND status = 'pending'`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;code&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;desc&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;receipt&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;checkoutID&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="kc"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="cm"&gt;/* log */&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;RowsAffected&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// already processed: acknowledge, do nothing else&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Only when &lt;code&gt;n == 1&lt;/code&gt; do you activate premium. That's what makes the whole thing idempotent.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Payments that never confirm.&lt;/strong&gt; Sometimes no callback arrives. Daraja offers an &lt;strong&gt;STK Query&lt;/strong&gt; endpoint (&lt;code&gt;/mpesa/stkpushquery/v1/query&lt;/code&gt;) taking the &lt;code&gt;CheckoutRequestID&lt;/code&gt;. A small background job can query any row still &lt;code&gt;pending&lt;/code&gt; after a few minutes and reconcile it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Matching a payment to a user.&lt;/strong&gt; The phone number is &lt;em&gt;not&lt;/em&gt; a safe key, since a parent might pay for a student. &lt;code&gt;CheckoutRequestID&lt;/code&gt; is the join key: you stored it alongside &lt;code&gt;user_id&lt;/code&gt; before the push, so the callback looks up the row and gets the user from there.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Double clicks.&lt;/strong&gt; A nervous student tapping twice sent me two prompts. Disable the button on submit, and reject a new push if the user already has a recent &lt;code&gt;pending&lt;/code&gt; payment.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Don't blindly trust the body.&lt;/strong&gt; For a stronger setup, verify the amount matches what you expected, and confirm via STK Query before granting access.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Activating premium after confirmation
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Illustrative; &lt;code&gt;premium_until&lt;/code&gt; is not yet in the schema.&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;ALTER&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt; &lt;span class="k"&gt;ADD&lt;/span&gt; &lt;span class="k"&gt;COLUMN&lt;/span&gt; &lt;span class="n"&gt;premium_until&lt;/span&gt; &lt;span class="kt"&gt;TEXT&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;activatePremium&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;userID&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;days&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="kt"&gt;error&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="n"&gt;current&lt;/span&gt; &lt;span class="n"&gt;sql&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;NullString&lt;/span&gt;
    &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;QueryRow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`SELECT premium_until FROM users WHERE id = ?`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;userID&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Scan&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;current&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;start&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Now&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;current&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Valid&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;RFC3339&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;current&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="kc"&gt;nil&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;After&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;start&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;start&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="c1"&gt;// extend from existing expiry, don't lose paid days&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;until&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;start&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;AddDate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;days&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Format&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;RFC3339&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;_&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Exec&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`UPDATE users SET premium_until = ? WHERE id = ?`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;until&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;userID&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Extending from &lt;code&gt;max(now, current expiry)&lt;/code&gt; matters: a student who renews early shouldn't lose days. Gating a feature is then just &lt;code&gt;premium_until &amp;gt; now&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. Gotchas and lessons learned
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;"Request accepted" is not "paid".&lt;/strong&gt; Only the callback (or STK Query) tells you the truth.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;1037&lt;/code&gt; in the sandbox is normal&lt;/strong&gt;, not a bug.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The callback URL must be public HTTPS.&lt;/strong&gt; &lt;code&gt;localhost&lt;/code&gt; will never work; use ngrok.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Phone format is strict:&lt;/strong&gt; &lt;code&gt;2547XXXXXXXX&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Save the pending row before calling Daraja.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Make state transitions conditional&lt;/strong&gt; (&lt;code&gt;AND status = 'pending'&lt;/code&gt;) so duplicates are harmless.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Set HTTP client timeouts.&lt;/strong&gt; Go's default has none.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Secrets live in environment variables&lt;/strong&gt;, never in Git.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Always return 200 to the callback&lt;/strong&gt;, even for failures.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sandbox is not production.&lt;/strong&gt; Real money needs a registered business, your own shortcode, and Go-Live approval.
## Closing&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Tutorials give you syntax; a real problem gives you understanding. Asynchronous callbacks, idempotency, and reconciliation are things I'd never have met in a to-do app, and I met all of them because a real student might one day pay for something.&lt;/p&gt;

&lt;p&gt;ElimuLocal is live at &lt;strong&gt;elimulocal.onrender.com&lt;/strong&gt; and the code is at &lt;strong&gt;github.com/Rkelly-dot/elimulocal&lt;/strong&gt;.&lt;/p&gt;

</description>
      <category>software</category>
      <category>fintech</category>
      <category>tutorial</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Seeing The Whole System: What I Learned At Zone01's System Thinking &amp; Design Mini-Conference</title>
      <dc:creator>Ryan Kelly</dc:creator>
      <pubDate>Mon, 16 Nov 2026 19:24:24 +0000</pubDate>
      <link>https://dev.to/rykelly/seeing-the-whole-system-what-i-learned-at-zone01s-system-thinking-design-mini-conference-31ba</link>
      <guid>https://dev.to/rykelly/seeing-the-whole-system-what-i-learned-at-zone01s-system-thinking-design-mini-conference-31ba</guid>
      <description>&lt;p&gt;Yesterday I attended the Systems Thinking &amp;amp; Design mini-conference at Zone01 Kisumu. I was surrounded by like-minded people who shared ideas I plan to carry into every project I build from here on. This post is my attempt to organise what I took away, add the reading I did afterwards, and show how it connects to the code I write.&lt;/p&gt;

&lt;h2&gt;
  
  
  So what is systems thinking?
&lt;/h2&gt;

&lt;p&gt;The first thing I had to do was understand the term. Systems thinking and design means looking at software not as isolated lines of code, but as an interconnected ecosystem where every piece, the user, the server and the process, affects the others.&lt;/p&gt;

&lt;p&gt;That sounds abstract until you learn the vocabulary. The work of Donella Meadows, probably the best-known writer on the subject, breaks any system into a few parts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Stocks&lt;/strong&gt; are things that accumulate: users waiting in a queue, bugs in a backlog, patients in a hospital.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Flows&lt;/strong&gt; are what fill or drain those stocks: sign-ups per hour, bugs fixed per week, admissions and discharges.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Feedback loops&lt;/strong&gt; are how a system reacts to itself. A &lt;em&gt;reinforcing&lt;/em&gt; loop amplifies change (more users bring more content, which brings more users). A &lt;em&gt;balancing&lt;/em&gt; loop pushes back and keeps things near a goal (a thermostat, a rate limiter).&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Delays&lt;/strong&gt; are the gaps between an action and its visible result. They are why systems overshoot and why people give up on interventions that were actually working.&lt;br&gt;
Once I had those words, I started seeing them in software I already knew:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A client that retries instantly when a server is struggling adds load, which makes the server struggle more. That is a reinforcing loop that can turn a small outage into a big one.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A rate limiter, a circuit breaker or a queue with a maximum size is a balancing loop. It exists to stop the first kind of loop from running away.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A message queue is a stock. If messages arrive faster than they are processed, the stock grows, and no amount of staring at a single function will explain why.&lt;br&gt;
None of these problems live in one file. That is the point of the whole discipline.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The workshop: every group got a constraint
&lt;/h2&gt;

&lt;p&gt;Beyond understanding the concept, we got to try it. The conference included a hands-on workshop where every group was handed a problem with its own constraints to think around.&lt;/p&gt;

&lt;p&gt;My group was lucky to end up with the Covid-19 and Ebola outbreaks. We joined forces and tackled the topic from its depth rather than from the surface.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why outbreaks are such a good systems problem
&lt;/h2&gt;

&lt;p&gt;Looking back, I think we were handed a perfect topic, because an outbreak is never only a medical problem. It is people, culture, logistics, information and trust, all pushing on each other. Here is what I found when I read more afterwards.&lt;/p&gt;

&lt;h3&gt;
  
  
  Ebola, 2014 to 2016
&lt;/h3&gt;

&lt;p&gt;The scale alone changed how people thought about the disease. Before 2014 the largest recorded Ebola outbreak was in Uganda in 2000 and 2001, with 425 cases and 225 deaths. The West African epidemic ended with roughly 28,600 reported cases and over 11,300 deaths, and it was the first time the virus spread across several countries at large scale.&lt;/p&gt;

&lt;p&gt;The system view explains why:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A cultural practice became a transmission loop.&lt;/strong&gt; Traditional funerals involve washing the body and close physical contact, which is a deeply human way to honour the dead and also an extremely high-risk activity during Ebola. WHO reporting linked about 80 percent of cases in Sierra Leone and 60 percent in Guinea to funeral practices, and health authorities traced 365 deaths to a single funeral in Sierra Leone.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Trust was a stock that ran low.&lt;/strong&gt; Rumours, fear and distrust of both local and foreign responders led people to avoid clinics. When people avoid care, cases go uncounted and untreated, and the outbreak grows in the dark.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Capacity was missing at the start.&lt;/strong&gt; In early summer 2014, no hospital in Liberia had an isolation ward. WHO also noted that over 70 percent of Ebola patients treated in West Africa died, compared with 26 percent of foreign medical staff who were evacuated to specialised care, a gap it called unacceptable.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Good interventions worked on the system, not just the virus.&lt;/strong&gt; Sierra Leone used an anti-malaria campaign to rebuild public trust in health workers. Responders later allowed small, safe ceremonies at the graveside, which respected the ritual while cutting the risk. Both are fixes aimed at the human parts of the system.
### Covid-19&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Covid-19 stressed a different set of connections:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Stealth.&lt;/strong&gt; Because people can pass the virus on before they feel ill, the old approach of waiting for symptoms, then isolating and tracing, struggles to keep up. By the time WHO declared a pandemic on 11 March 2020, spread was already underway in many places.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Capacity.&lt;/strong&gt; "Flatten the curve" is a stocks-and-flows idea. The aim was not only to reduce the total number of cases but to spread them out so hospital demand stayed below capacity. One operations researcher makes a sharp point: the fatality rate is not a fixed number. It depends on whether hospitals have enough beds, staff and equipment to treat people.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Supply chains.&lt;/strong&gt; Personal protective equipment shortages showed how a delay or a shortage in one part of a chain leaves frontline workers without what they need at that moment.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Side effects.&lt;/strong&gt; Hospitals that cleared space for a surge saw patients stay away out of fear and elective services pause, which created financial strain. Fixing one part of the system created pressure in another.
### Side by side&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;System element&lt;/th&gt;
&lt;th&gt;Ebola (West Africa)&lt;/th&gt;
&lt;th&gt;Covid-19&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Main transmission loop&lt;/td&gt;
&lt;td&gt;Close contact, including at funerals and in home care&lt;/td&gt;
&lt;td&gt;Spread, often before symptoms appear&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;What ran short&lt;/td&gt;
&lt;td&gt;Isolation beds, trained staff, trust&lt;/td&gt;
&lt;td&gt;Hospital capacity, testing, protective equipment&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Role of information&lt;/td&gt;
&lt;td&gt;Rumours and fear kept people away from care&lt;/td&gt;
&lt;td&gt;Mixed messages and delayed signals&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Effective lever&lt;/td&gt;
&lt;td&gt;Community engagement, safe and dignified burials&lt;/td&gt;
&lt;td&gt;Slowing spread so demand stays under capacity&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Finding the leverage
&lt;/h2&gt;

&lt;p&gt;One idea from Meadows stayed with me more than any other: &lt;strong&gt;leverage points&lt;/strong&gt;. These are the places in a system where a small push can shift the whole thing. She ranked them, and her ranking surprised me. Tweaking numbers (a budget, a threshold, a target) is the weakest move. Stronger moves include changing who has access to information, changing the rules and incentives, and letting the system organise and adapt itself. The strongest of all is changing the mindset the system grew out of.&lt;/p&gt;

&lt;p&gt;Looking at the outbreaks through that lens:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Information flows:&lt;/strong&gt; getting accurate information to people who had been uninformed, and getting case data back to decision makers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rules:&lt;/strong&gt; how burials were done, who could attend, and who was responsible.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Self-organisation:&lt;/strong&gt; community leaders and local volunteers who adapted the response to their own context.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Mindset:&lt;/strong&gt; treating a community as a partner to work with rather than a problem to manage.
## What this changes about how I build software&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The conference was about systems, but I left thinking about my own projects. These are the habits I want to build:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Map before I code.&lt;/strong&gt; Who are the users, what data moves where, and what happens when one part fails? A rough sketch on paper is enough.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Look for the loops.&lt;/strong&gt; Where does a small fault get amplified, and where is the brake? If I cannot find the balancing loop, I should probably add one.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Respect delays.&lt;/strong&gt; A change in a database, a cache or a deployment may not show its effect right away. Judging it too early leads to bad decisions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ask who is affected beyond the user.&lt;/strong&gt; Support staff, other services, people who cannot access the product at all. An outbreak response that ignores a community's customs fails, and a product that ignores real users does too.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fix the structure, not just the symptom.&lt;/strong&gt; If the same bug keeps coming back, the problem is probably in how the pieces connect.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Design for trust.&lt;/strong&gt; Ebola showed how fast a system degrades when people stop believing it. Clear errors, honest messages and predictable behaviour are part of the design.
## Closing thoughts&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I came to the conference expecting a talk about diagrams. I left with a different way of looking at the world: very little exists in isolation, and the most useful question is often not "what is broken?" but "what is connected to this?"&lt;/p&gt;

&lt;p&gt;Thank you to the Zone01 Kisumu team and everyone who spoke, facilitated and shared ideas. If you attended, I would love to hear what stayed with you. If you did not, find a mini-conference near you and go.&lt;/p&gt;

</description>
      <category>systemsthinking</category>
      <category>software</category>
      <category>design</category>
      <category>beginners</category>
    </item>
    <item>
      <title>From Paas Comfort To IaaS Reality:Deploying a Go and React App on Oracle Cloud</title>
      <dc:creator>Ryan Kelly</dc:creator>
      <pubDate>Mon, 16 Nov 2026 18:25:40 +0000</pubDate>
      <link>https://dev.to/rykelly/from-paas-comfort-to-iaas-realitydeploying-a-go-and-react-app-on-oracle-cloud-1ac0</link>
      <guid>https://dev.to/rykelly/from-paas-comfort-to-iaas-realitydeploying-a-go-and-react-app-on-oracle-cloud-1ac0</guid>
      <description>&lt;p&gt;If most of your deployment experience comes from platforms like Render, Railway, or Vercel, your mental model of "deploying" probably looks like this:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Push your code to GitHub.&lt;/li&gt;
&lt;li&gt;Paste some environment variables into a clean dashboard.&lt;/li&gt;
&lt;li&gt;Watch a build log scroll by for three minutes.&lt;/li&gt;
&lt;li&gt;Click a &lt;code&gt;*.onrender.com&lt;/code&gt; URL that already has HTTPS.
It's fast, predictable, and asks you to know almost nothing about what happens underneath your code. I loved it. Then I built something that PaaS couldn't host, and I got a crash course in everything it had been quietly doing for me.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  The Project That Broke My Comfort Zone
&lt;/h2&gt;

&lt;p&gt;I was deploying &lt;strong&gt;&lt;code&gt;dns-blocker&lt;/code&gt;&lt;/strong&gt;, a project with a Go backend (&lt;code&gt;nullify&lt;/code&gt;) and a React dashboard, onto an &lt;strong&gt;Oracle Cloud Infrastructure (OCI)&lt;/strong&gt; Always Free VM.&lt;/p&gt;

&lt;p&gt;The reason was simple: a DNS resolver needs &lt;strong&gt;port 53&lt;/strong&gt; and persistent control over the network. Web-focused PaaS platforms aren't built to give you that. So moving to Infrastructure-as-a-Service (IaaS) wasn't an experiment. It was the only option.&lt;/p&gt;

&lt;p&gt;What follows is the honest version of that journey: the silent freezes, the debugging, the fixes, and what I'd tell anyone about to make the same jump.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Mental Shift: Ordering Delivery vs. Renting a Kitchen
&lt;/h2&gt;

&lt;p&gt;Before I touched a single config file, the biggest hurdle was conceptual.&lt;/p&gt;

&lt;p&gt;On a PaaS, you're paying for an abstraction layer. Most PaaS companies don't own bare-metal data centers. They rent big pools of IaaS servers from AWS, GCP, or Oracle and build orchestration on top. When you click "Deploy," a pipeline provisions a container, injects your secrets, configures a reverse proxy, issues a TLS certificate, and wires up a GitHub webhook.&lt;/p&gt;

&lt;p&gt;On IaaS, &lt;strong&gt;you get an empty Linux box and a public IP address.&lt;/strong&gt; That's it. There's no &lt;code&gt;git push&lt;/code&gt; trigger, no automatic domain, and no friendly UI for environment variables. My first thought, while SSHing in just to run &lt;code&gt;docker compose up&lt;/code&gt;, was that this felt less like "real deployment" and more like running my app on a remote laptop.&lt;/p&gt;

&lt;p&gt;Then it clicked: &lt;strong&gt;this &lt;em&gt;is&lt;/em&gt; production.&lt;/strong&gt; Everything PaaS gave me for free is still available. I just have to assemble it myself.&lt;/p&gt;

&lt;p&gt;It's the difference between ordering delivery and renting a kitchen. The food can be just as good, but now you're the one who has to find the pans.&lt;/p&gt;

&lt;h2&gt;
  
  
  Challenge 1: The Silent SSH Freeze
&lt;/h2&gt;

&lt;p&gt;The first wake-up call came the morning after my initial setup. I'd connected to my Ubuntu instance fine the day before, set up a few things, and logged off. The next morning I ran my SSH command and got... nothing. No "permission denied." No timeout. Just a blinking cursor.&lt;/p&gt;

&lt;p&gt;If you're used to PaaS dashboards with clear status badges (&lt;code&gt;Building&lt;/code&gt;, &lt;code&gt;Live&lt;/code&gt;, &lt;code&gt;Deploy Failed&lt;/code&gt;), a silent terminal is genuinely disorienting. I even wondered whether I needed the Oracle Cloud console open while connecting. (You don't. Once an instance is running, it lives on its own on the public internet.)&lt;/p&gt;

&lt;p&gt;Instead of guessing, I reran SSH in verbose mode:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh -v -i ~/Downloads/ssh-key.key ubuntu@&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;PUBLIC_IP&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The output stopped after two crucial lines:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;debug1: Connection established.
...
debug1: Local version string SSH-2.0-OpenSSH_10.2p1 Ubuntu-2ubuntu3.8
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  What that actually meant
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;Connection established&lt;/code&gt; ruled out half the usual suspects at once. Oracle's Security List wasn't blocking me, and port 22 was open. My laptop had completed the TCP handshake and sent its SSH greeting, and it was now waiting for the server to answer with its own banner.&lt;/p&gt;

&lt;p&gt;When a Linux server accepts a TCP connection at the kernel level but never replies from userspace (&lt;code&gt;sshd&lt;/code&gt;), it usually means one thing: &lt;strong&gt;the machine is so starved for RAM that the SSH daemon can't get any CPU time to respond.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Lesson one: &lt;code&gt;ssh -v&lt;/code&gt; is your new status badge. Learn to read it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Challenge 2: Out-of-Memory Thrashing During &lt;code&gt;docker compose up&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;After force-rebooting from the Oracle console and getting back in, I wanted to see the freeze happen in real time. So I went to my &lt;code&gt;dns-blocker&lt;/code&gt; directory and ran:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker compose up -d
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Docker pulled the base images (&lt;code&gt;golang:1.26-alpine&lt;/code&gt; and &lt;code&gt;alpine:3.20&lt;/code&gt;), downloaded the Go modules, copied the source, and reached the last step:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;=&amp;gt; [builder 6/6] RUN go build -o nullify .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At &lt;code&gt;401.6s&lt;/code&gt;, the terminal froze. SSH went dead again. Mystery solved.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why PaaS hides this problem
&lt;/h3&gt;

&lt;p&gt;On a PaaS, builds often run on separate, beefier workers before your app ever lands on a small runtime container. On a 1 GB IaaS instance (&lt;code&gt;VM.Standard.E2.1.Micro&lt;/code&gt;), &lt;strong&gt;your build environment and your production environment are the same constrained machine.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;By default, &lt;code&gt;go build&lt;/code&gt; spreads work across every available CPU core and holds a lot in memory at once. Add the linker at the end, and a build can spike past what a 1 GB box can handle. With no swap configured, Linux spends nearly all its CPU time trying to free memory pages, and the whole machine locks up before the OOM killer can even step in.&lt;/p&gt;

&lt;h3&gt;
  
  
  The two-part fix
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;First&lt;/strong&gt;, I added a 2 GB swap file so memory spikes spill onto disk instead of freezing the kernel:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;'/swapfile none swap sw 0 0'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; sudo tee -a /etc/fstab
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Pro tip: double-check your terminal prompt before running system-level commands like these. Running them in the wrong tab will happily allocate swap on your &lt;em&gt;laptop&lt;/em&gt; instead of your server.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Second&lt;/strong&gt;, I changed the &lt;code&gt;Dockerfile&lt;/code&gt; to trade a few extra seconds of build time for much lower peak memory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="k"&gt;FROM&lt;/span&gt; golang:1.26-alpine AS builder

&lt;span class="k"&gt;WORKDIR&lt;/span&gt; /app

&lt;span class="k"&gt;COPY&lt;/span&gt; go.mod go.sum ./
&lt;span class="k"&gt;RUN&lt;/span&gt; go mod download

&lt;span class="k"&gt;COPY&lt;/span&gt; . .

&lt;span class="c"&gt;# -p 1: compile one package at a time (prevents parallel RAM spikes)&lt;/span&gt;
&lt;span class="c"&gt;# GOMEMLIMIT &amp;amp; GOGC=50: force aggressive garbage collection during compilation&lt;/span&gt;
&lt;span class="c"&gt;# -ldflags="-s -w": strip debug symbols to reduce linker memory &amp;amp; binary size&lt;/span&gt;
&lt;span class="k"&gt;RUN&lt;/span&gt; &lt;span class="nv"&gt;CGO_ENABLED&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;0 &lt;span class="nv"&gt;GOMEMLIMIT&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;450MiB &lt;span class="nv"&gt;GOGC&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;50 go build -p 1 -ldflags=&lt;span class="s2"&gt;"-s -w"&lt;/span&gt; -o nullify .

&lt;span class="k"&gt;FROM&lt;/span&gt; alpine:3.20
&lt;span class="k"&gt;RUN&lt;/span&gt; apk add --no-cache ca-certificates
&lt;span class="k"&gt;WORKDIR&lt;/span&gt; /app
&lt;span class="k"&gt;COPY&lt;/span&gt; --from=builder /app/nullify .
&lt;span class="k"&gt;CMD&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"./nullify"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With swap enabled and &lt;code&gt;-p 1&lt;/code&gt; limiting compiler concurrency, the build finished cleanly. No freeze, no drama, and a very satisfying green checkmark.&lt;/p&gt;

&lt;h2&gt;
  
  
  Challenge 3: Rebuilding PaaS Conveniences by Hand
&lt;/h2&gt;

&lt;p&gt;With the container running, the next question was: &lt;em&gt;how do people actually use this?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;For &lt;code&gt;dns-blocker&lt;/code&gt;, I needed two things exposed to the world:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Port 53 (TCP and UDP)&lt;/strong&gt; so devices can send DNS queries to the server.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ports 80 and 443&lt;/strong&gt; so users can open the React dashboard in a browser without typing &lt;code&gt;http://&amp;lt;IP&amp;gt;:3000&lt;/code&gt;.
On IaaS, exposing an app means touching layers PaaS never shows you:&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Two layers of firewall.&lt;/strong&gt; In Oracle Cloud, opening a port in your VCN &lt;strong&gt;Security List&lt;/strong&gt; is only half the job. Ubuntu images on OCI also ship with strict &lt;code&gt;iptables&lt;/code&gt; rules by default. Traffic has to be allowed at both the cloud perimeter &lt;em&gt;and&lt;/em&gt; the OS level. Forgetting the second one is a classic "I opened the port, why is it still closed?" moment.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A domain and a reverse proxy.&lt;/strong&gt; Point a domain (or a free dynamic DNS subdomain like DuckDNS) at your public IP with an &lt;code&gt;A&lt;/code&gt; record. Then put &lt;strong&gt;Caddy&lt;/strong&gt; in front of your containers. It routes &lt;code&gt;yourdomain.com&lt;/code&gt; to the React frontend and something like &lt;code&gt;api.yourdomain.com&lt;/code&gt; to the Go backend, and it provisions Let's Encrypt certificates automatically. That's the same HTTPS experience PaaS gives you, in a few lines of config.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Secrets and CI/CD.&lt;/strong&gt; Instead of a settings tab, secrets live in a git-ignored &lt;code&gt;.env&lt;/code&gt; file on the server, referenced by &lt;code&gt;docker-compose.yml&lt;/code&gt;. Instead of a built-in GitHub integration, a short &lt;strong&gt;GitHub Actions&lt;/strong&gt; workflow can SSH in on every push to &lt;code&gt;main&lt;/code&gt;, pull, and rebuild. Even better, build the React frontend and Go binary inside GitHub's CI runners and &lt;code&gt;scp&lt;/code&gt; the compiled artifacts over, so the 1 GB server never has to compile anything again.
None of this is hard, exactly. It's just &lt;em&gt;a lot of small things&lt;/em&gt; that a PaaS bundles into one button.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Challenge 4: Never Compile on the Server Again
&lt;/h2&gt;

&lt;p&gt;The swap file saved me, but it also felt like a bandage. A 1 GB machine shouldn't be doing the heaviest job in the whole pipeline. The better fix is to move the build somewhere with real resources and send the server only the finished product.&lt;/p&gt;

&lt;p&gt;GitHub Actions is a good fit. Its runners have far more RAM than my VM, and they're free for public repos (with a generous allowance for private ones). The plan:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;On every push to &lt;code&gt;main&lt;/code&gt;, build the Go binary and the React frontend on a GitHub runner.&lt;/li&gt;
&lt;li&gt;Copy the compiled artifacts to the server over SSH.&lt;/li&gt;
&lt;li&gt;Restart the containers, which now only &lt;em&gt;run&lt;/em&gt; code and never build it.
### Step 1: Add secrets to your repo&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Under &lt;strong&gt;Settings → Secrets and variables → Actions&lt;/strong&gt;, add three secrets:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;SSH_HOST&lt;/code&gt;: your server's public IP or domain&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;SSH_USER&lt;/code&gt;: &lt;code&gt;ubuntu&lt;/code&gt; on my instance&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;SSH_KEY&lt;/code&gt;: the full contents of your private key file
I'd strongly recommend generating a &lt;strong&gt;dedicated deploy key&lt;/strong&gt; for this instead of reusing your personal one. If it ever leaks, you revoke one key and nothing else.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step 2: Write the workflow
&lt;/h3&gt;

&lt;p&gt;Create &lt;code&gt;.github/workflows/deploy.yml&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Deploy&lt;/span&gt;

&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;push&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;branches&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;main&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;deploy&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;runs-on&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu-latest&lt;/span&gt;

    &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/checkout@v4&lt;/span&gt;

      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/setup-go@v5&lt;/span&gt;
        &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;go-version-file&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;go.mod&lt;/span&gt;

      &lt;span class="c1"&gt;# OCI's E2.1.Micro is x86_64, so target amd64
&lt;/span&gt;      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Build Go binary&lt;/span&gt;
        &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt;
          &lt;span class="s"&gt;CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \&lt;/span&gt;
          &lt;span class="s"&gt;go build -ldflags="-s -w" -o nullify .&lt;/span&gt;

      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/setup-node@v4&lt;/span&gt;
        &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;node-version&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;
          &lt;span class="na"&gt;cache&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;npm&lt;/span&gt;
          &lt;span class="na"&gt;cache-dependency-path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;frontend/package-lock.json&lt;/span&gt;

      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Build React frontend&lt;/span&gt;
        &lt;span class="na"&gt;working-directory&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;frontend&lt;/span&gt;
        &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt;
          &lt;span class="s"&gt;npm ci&lt;/span&gt;
          &lt;span class="s"&gt;npm run build&lt;/span&gt;

      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Copy artifacts to server&lt;/span&gt;
        &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;appleboy/scp-action@v0.1.7&lt;/span&gt;
        &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;host&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.SSH_HOST }}&lt;/span&gt;
          &lt;span class="na"&gt;username&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.SSH_USER }}&lt;/span&gt;
          &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.SSH_KEY }}&lt;/span&gt;
          &lt;span class="na"&gt;source&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"nullify,frontend/dist/*"&lt;/span&gt;
          &lt;span class="na"&gt;target&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"~/dns-blocker/deploy"&lt;/span&gt;

      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Restart services&lt;/span&gt;
        &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;appleboy/ssh-action@v1.0.3&lt;/span&gt;
        &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;host&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.SSH_HOST }}&lt;/span&gt;
          &lt;span class="na"&gt;username&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.SSH_USER }}&lt;/span&gt;
          &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.SSH_KEY }}&lt;/span&gt;
          &lt;span class="na"&gt;script&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt;
            &lt;span class="s"&gt;cd ~/dns-blocker&lt;/span&gt;
            &lt;span class="s"&gt;docker compose up -d --force-recreate&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Adjust the &lt;code&gt;frontend/&lt;/code&gt; paths to match your repo layout. Mine keeps the React app in its own folder.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Slim down the Dockerfile
&lt;/h3&gt;

&lt;p&gt;Since the binary arrives pre-built, the runtime image no longer needs the Go toolchain at all. The Dockerfile I sweated over in Challenge 2 shrinks to this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="k"&gt;FROM&lt;/span&gt; alpine:3.20
&lt;span class="k"&gt;RUN&lt;/span&gt; apk add --no-cache ca-certificates
&lt;span class="k"&gt;WORKDIR&lt;/span&gt; /app
&lt;span class="k"&gt;COPY&lt;/span&gt; deploy/nullify .
&lt;span class="k"&gt;CMD&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"./nullify"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No compiler, no memory spikes, and an image that builds in seconds.&lt;/p&gt;

&lt;h3&gt;
  
  
  What I like about this setup
&lt;/h3&gt;

&lt;p&gt;A push to &lt;code&gt;main&lt;/code&gt; now triggers a deploy with no SSH session from me, which is the closest thing to PaaS's "just push" feeling I could recreate. When something breaks, the Actions log tells me exactly which step failed, so I get my status badges back too (&lt;code&gt;Building&lt;/code&gt;, &lt;code&gt;Live&lt;/code&gt;, &lt;code&gt;Deploy Failed&lt;/code&gt;, just with different names).&lt;/p&gt;

&lt;p&gt;It does have rough edges. There's no automatic rollback, and &lt;code&gt;--force-recreate&lt;/code&gt; means a few seconds of downtime. For a personal DNS blocker, I'll take that trade. If you can't, look at tagging images and keeping the previous version around so you can switch back.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Trade-Offs: PaaS vs. IaaS
&lt;/h2&gt;

&lt;p&gt;After going through this, the trade-offs felt a lot clearer:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Dimension&lt;/th&gt;
&lt;th&gt;PaaS (Render, Railway)&lt;/th&gt;
&lt;th&gt;IaaS (Oracle Cloud, AWS EC2)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Setup speed&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Minutes. Connect repo, add env vars, ship.&lt;/td&gt;
&lt;td&gt;Hours. Provision the VM, harden SSH, configure swap, firewalls, and a reverse proxy.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Network and protocol control&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Restricted, usually HTTP/HTTPS on standard ports.&lt;/td&gt;
&lt;td&gt;Total control: custom DNS servers (port 53), VPNs, raw TCP/UDP sockets, background daemons.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Resource limits and cost&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Predictable tiers, but free tiers often spin down when idle and costs climb quickly.&lt;/td&gt;
&lt;td&gt;Generous always-on compute (like OCI's Always Free tier), but you manage tight RAM and CPU budgets yourself.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Build pipeline&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Handled on separate build infrastructure.&lt;/td&gt;
&lt;td&gt;Runs on your server unless you offload to GitHub Actions or cross-compile locally.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Maintenance&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;No OS patching, no SSL renewals.&lt;/td&gt;
&lt;td&gt;You own security updates, disk cleanup (&lt;code&gt;docker builder prune&lt;/code&gt;), and crash recovery.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  What I Took Away From It
&lt;/h2&gt;

&lt;p&gt;Stepping down a layer in the cloud stack came with friction, but it gave me things I couldn't get on a standard PaaS:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;True protocol freedom.&lt;/strong&gt; A custom Go DNS blocker and a React dashboard on one always-on IP, with no cold starts and no HTTP-only restrictions. That's exactly why IaaS exists.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sharper debugging instincts.&lt;/strong&gt; Reading &lt;code&gt;ssh -v&lt;/code&gt; output, recognizing OOM thrashing, adding swap, and tuning Go compiler flags (&lt;code&gt;GOMEMLIMIT&lt;/code&gt;, &lt;code&gt;-p 1&lt;/code&gt;) turned "the cloud" from a magic black box into ordinary Linux processes I can reason about.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Don't build on tiny servers.&lt;/strong&gt; Just because a small VM &lt;em&gt;can&lt;/em&gt; compile Go or bundle React doesn't mean it &lt;em&gt;should&lt;/em&gt;. Build locally or in GitHub Actions and ship lightweight binaries and static assets.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;PaaS makes more sense after IaaS.&lt;/strong&gt; You don't fully appreciate what those platforms automate until you've set up firewalls, swap, a reverse proxy, and a deploy pipeline by hand.
## So, PaaS or IaaS?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you're building a standard web app or REST API and want to focus on product features, &lt;strong&gt;stick with PaaS.&lt;/strong&gt; Paying for abstraction is a smart engineering trade.&lt;/p&gt;

&lt;p&gt;But if your app needs custom network ports, always-on background services, tight cost control, or you just want to understand how production infrastructure works under the hood, spin up a raw Linux VM. When it inevitably freezes on your first build, you'll learn more in two hours of debugging than in twenty one-click deploys.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Have you made the PaaS-to-IaaS jump? I'd love to hear what bit you first. Drop it in the comments.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>devops</category>
      <category>cloud</category>
      <category>docker</category>
      <category>go</category>
    </item>
    <item>
      <title>My First Open Source Contribution.</title>
      <dc:creator>Ryan Kelly</dc:creator>
      <pubDate>Sun, 08 Nov 2026 14:17:54 +0000</pubDate>
      <link>https://dev.to/rykelly/my-first-open-source-contribution-6a2</link>
      <guid>https://dev.to/rykelly/my-first-open-source-contribution-6a2</guid>
      <description>&lt;p&gt;A stranger approved my code, and the project's maintainer merged it. That sentence still feels strange to type, because a few weeks ago I had never sent a single pull request to anyone's project.&lt;/p&gt;

&lt;p&gt;I'm a software engineering apprentice at Zone01 Kisumu, I write mostly Go, and I had always treated open source as something other people did. This is the story of how my first contribution actually happened: the wrong turns, the red test output, and the review that made my code better. If you have been staring at a repository wondering whether you are allowed to touch it, this is for you.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why I wanted in, and what scared me
&lt;/h2&gt;

&lt;p&gt;School projects teach you to write code that only your team ever reads. I wanted to find out what happens when someone who owes me nothing reads my code and decides whether it belongs in their project.&lt;/p&gt;

&lt;p&gt;I was also afraid, and the fears were specific:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I would pick an issue I could not finish and waste a maintainer's time.&lt;/li&gt;
&lt;li&gt;I would break something in a codebase I did not understand.&lt;/li&gt;
&lt;li&gt;I would not know the rules, and someone would tell me so in public.
None of these turned out to be a reason not to try. They turned out to be a checklist of things to do carefully.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Finding a project was harder than the code
&lt;/h2&gt;

&lt;p&gt;I expected the hard part to be writing the fix. It was choosing where to write it. I went through four projects before one worked, and each dead end taught me something about how open source really runs.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Project&lt;/th&gt;
&lt;th&gt;What stopped me&lt;/th&gt;
&lt;th&gt;What I learned&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Pallets (Click)&lt;/td&gt;
&lt;td&gt;Their policy does not accept AI-assisted contributions from new contributors&lt;/td&gt;
&lt;td&gt;Read the contributing guide and any AI policy before touching code&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;cli/cli&lt;/td&gt;
&lt;td&gt;Issues need a &lt;code&gt;help wanted&lt;/code&gt; label and clear acceptance criteria, and every eligible one already had competing pull requests&lt;/td&gt;
&lt;td&gt;A popular project can be a crowded one&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Trivy&lt;/td&gt;
&lt;td&gt;The issues I found were years old, and the open ones are created and claimed by maintainers&lt;/td&gt;
&lt;td&gt;An old open issue is not necessarily an invitation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;network-doctor&lt;/td&gt;
&lt;td&gt;Nothing. It had clear issues, most unassigned, and a contributing guide&lt;/td&gt;
&lt;td&gt;Smaller, active projects can welcome you faster&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The project I landed on, network-doctor, is a Go diagnostic tool that tells you what is wrong with a network connection. It had recent activity, a maintainer who answered, and issues written clearly enough that I could tell what "done" looked like. I picked issue #422, a bug about IPv6 addresses losing part of their identity in a report.&lt;/p&gt;

&lt;h2&gt;
  
  
  The constraints I was working inside
&lt;/h2&gt;

&lt;p&gt;Every contribution happens inside limits. Naming mine early would have saved me some anxiety.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A strict repository.&lt;/strong&gt; network-doctor has its own rules: short imperative commit subjects with no prefixes like &lt;code&gt;fix:&lt;/code&gt;, no co-author trailers, no em dashes anywhere (a test fails the build if one appears), and a pull request template with fixed sections.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A newer toolchain.&lt;/strong&gt; The project needs a recent Go version, and I had to make sure my own machine matched before any result meant anything.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Guard tests I did not write.&lt;/strong&gt; The maintainer had built tests that force every field in the report to be classified, described in the schema, and proven to reach the output. They cannot be argued with, only satisfied.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Being new.&lt;/strong&gt; Everything was a first: forking, remotes, branches, pull requests, and the etiquette around all of them.
## The bug, in plain words&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Some IPv6 addresses, the ones that start with &lt;code&gt;fe80&lt;/code&gt;, only work on one local network link. Like saying "the kitchen" without saying which house, the address alone is not enough: you also need the network interface, written after a percent sign, as in &lt;code&gt;fe80::1234%eth0&lt;/code&gt;. That extra piece is called the zone.&lt;/p&gt;

&lt;p&gt;network-doctor knew about the zone while it ran its checks. But when it wrote its report, it rebuilt the target from the address alone, so you typed &lt;code&gt;[fe80::1234%eth0]:22&lt;/code&gt; and the report printed &lt;code&gt;[fe80::1234]:22&lt;/code&gt;. The zone had been dropped on the way out.&lt;/p&gt;

&lt;p&gt;My fix added an optional zone field to the report, filled it from the target, and showed it in the text output. The address field stayed clean on purpose, because the zone must never leak into name lookups. Targets without a zone print exactly as before. I also updated the published schema and the reference docs, and added tests for both the zoned and unzoned cases.&lt;/p&gt;

&lt;p&gt;The proof I was proudest of was small: I ran the real program before and after the change and pasted both lines into the pull request. Before, the zone was gone. After, it was there.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where it got hard
&lt;/h2&gt;

&lt;p&gt;The fix was a handful of lines. Almost everything difficult happened around it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A test that said &lt;code&gt;[no tests to run]&lt;/code&gt;.&lt;/strong&gt; I had pasted my new test into the wrong file, in the wrong package. Go did not complain, it just quietly ran nothing. A green or empty result is not proof, so I learned to check that the test name I wrote actually appears in the output.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Guard tests that fought back.&lt;/strong&gt; The moment I added the new field, the maintainer's tests failed three different ways: the field was unclassified, the schema did not describe it, and no scenario filled it in. Each failure message told me exactly what was missing. Reading those messages slowly turned out to be the whole skill.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Noise that was not mine.&lt;/strong&gt; A formatting check complained about a file I had never touched. I had to learn to separate "my change broke this" from "this was already like this", and to leave the second kind alone.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;An empty variable.&lt;/strong&gt; One of my before-and-after runs failed with &lt;code&gt;invalid target "[fe80::1%]:22"&lt;/code&gt; because my interface variable was empty in a fresh terminal. The program was right to reject it, and I was the bug.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Review, twice.&lt;/strong&gt; After I opened the pull request, an automated reviewer pointed out that a table in the tests still labeled the zone as deliberately left out of the report, which contradicted my change. I fixed that. Then the maintainer asked for something sharper: my test fixture used a made-up combination, a normal address with a zone attached, that the program's own parser would reject. I replaced it with a valid scoped link-local address, so the test now represents input a real person could type.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I learned
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Read the rules before the code.&lt;/strong&gt; Contributing guides, AI policies and pull request templates decide whether your work is welcome at all. A project that bans something is not being unfair; it is telling you the truth early.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pick a project by its pulse, not its fame.&lt;/strong&gt; Recent commits, replies from maintainers and clearly written issues mattered more than star counts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Prove the bug before you fix it.&lt;/strong&gt; I wrote failing tests first, so I knew the fix worked and the maintainer could see why it was needed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Make the smallest change that fully solves the issue.&lt;/strong&gt; I noticed other places with the same flaw and wrote them up as out of scope instead of widening the pull request. Maintainers review small, finished things faster.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Failing tests are instructions, not insults.&lt;/strong&gt; The project's own guard tests taught me how its authors think.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Report honestly.&lt;/strong&gt; When I was unsure whether something was my change or already broken, I said so. When an earlier explanation of mine turned out wrong, I corrected it instead of defending it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Review feedback is a gift.&lt;/strong&gt; Both the bot and the maintainer made the change better, and neither comment was about me.
## What I set out to do, and what I did&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;When I started, my goals were simple: find a project that would take me, fix a real bug, and get it merged. Here is how that went.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Objective&lt;/th&gt;
&lt;th&gt;Outcome&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Choose a suitable project and issue&lt;/td&gt;
&lt;td&gt;Done, after four tries and one clear fit&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Learn the fork, branch, commit, push and pull request flow&lt;/td&gt;
&lt;td&gt;Done, with every command run by me&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Fix issue #422 without breaking the project's own rules&lt;/td&gt;
&lt;td&gt;Done, including schema, docs and guard tests&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Satisfy automated and human review&lt;/td&gt;
&lt;td&gt;Done, in two rounds of changes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Get the pull request merged&lt;/td&gt;
&lt;td&gt;Done&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  If you are about to start
&lt;/h2&gt;

&lt;p&gt;Pick one small, clearly described issue in a project that is alive. Read its contributing guide twice. Ask in a short comment before you start if the issue is unclaimed, and be honest about how you work, including any tools that helped you.&lt;/p&gt;

&lt;p&gt;Then go slowly. Run the tests before you change anything, so you know what normal looks like. Make a small change, make it pass, and explain it plainly in the pull request. When someone asks you to change something, change it and thank them.&lt;/p&gt;

&lt;p&gt;You do not need permission to be a beginner. You need one issue, one branch and the patience to read an error message to the end. Mine is merged now, and the next one is already on my list.&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>go</category>
      <category>beginners</category>
      <category>github</category>
    </item>
    <item>
      <title>Is Software Development Cooked? A Letter To The Developer Who Can't Switch Off</title>
      <dc:creator>Ryan Kelly</dc:creator>
      <pubDate>Sun, 01 Nov 2026 20:44:13 +0000</pubDate>
      <link>https://dev.to/rykelly/is-software-development-cooked-a-letter-to-the-developer-who-cant-switch-off-mho</link>
      <guid>https://dev.to/rykelly/is-software-development-cooked-a-letter-to-the-developer-who-cant-switch-off-mho</guid>
      <description>&lt;p&gt;It's 9:47 p.m. A junior developer closes the lid of the laptop, then opens it again.&lt;/p&gt;

&lt;p&gt;The day's work is done. The tickets are closed and the pull request is merged. But something in the back of their mind won't let the day end. &lt;em&gt;Did I post this week? Should I be learning Rust? Everyone's talking about a new framework, and I haven't even opened its docs.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;So they open a tutorial and tell themselves it's only twenty minutes. Two hours later, they feel more behind than when they started.&lt;/p&gt;

&lt;p&gt;If that sounds familiar, this article is for you.&lt;/p&gt;

&lt;h2&gt;
  
  
  The door that needs a key you can't get
&lt;/h2&gt;

&lt;p&gt;Start with the job hunt, because that's where the exhaustion often begins.&lt;/p&gt;

&lt;p&gt;The listing says &lt;em&gt;Junior Developer&lt;/em&gt;. The requirements say &lt;em&gt;3+ years of experience&lt;/em&gt;. The developer reads it twice, wondering if it's a typo. It isn't. It's a puzzle with no solution: you need experience to get a job, and you need a job to get experience.&lt;/p&gt;

&lt;p&gt;Nobody talks about what this does to a person. A rejection email feels like a verdict on your worth, even though it's really a verdict on a broken hiring pipeline. Many companies want the output of a senior and the salary of a junior, and they write job descriptions as wish lists rather than honest requirements.&lt;/p&gt;

&lt;p&gt;Here is the first thing worth saying out loud: &lt;strong&gt;a lot of those requirements are not real.&lt;/strong&gt; They're aspirational. Plenty of people get hired for roles that listed years they didn't have. That doesn't make the system fair, but it does mean the wall is sometimes shorter than it looks.&lt;/p&gt;

&lt;h2&gt;
  
  
  The treadmill that never stops
&lt;/h2&gt;

&lt;p&gt;Then there's the second weight, the one that follows developers home.&lt;/p&gt;

&lt;p&gt;Think about a plumber. When the last pipe is fixed and the tools are packed, the day is over. Nobody expects the plumber to spend the evening reading about experimental pipe materials to prove they still deserve the job. An accountant closes the books and goes home. A doctor finishes the shift and, whatever else is true, isn't expected to build a side clinic on weekends for their portfolio.&lt;/p&gt;

&lt;p&gt;Software has quietly built a different culture. The work doesn't end when the workday does. There are side projects, articles, open-source contributions, hackathons, and a stream of new tools announced every week. Each one comes with an unspoken message: &lt;em&gt;if you aren't keeping up, you're falling behind.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;And the bar keeps rising. Things that were once considered senior-level (system design, cloud infrastructure, CI/CD, containers, testing strategy) now show up in junior job descriptions. A newcomer is told to learn all of it at once, on their own time, and to look cheerful while doing it.&lt;/p&gt;

&lt;p&gt;No human brain is built for that. The feeling of being overwhelmed isn't a sign that you're not cut out for this. It's a reasonable response to an unreasonable expectation.&lt;/p&gt;

&lt;h2&gt;
  
  
  So, is it cooked?
&lt;/h2&gt;

&lt;p&gt;Let's be honest, because honesty is kinder than false comfort.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The entry-level market is hard right now.&lt;/strong&gt; Competition is real, hiring has been cautious, and many companies are skeptical about juniors. Pretending otherwise would be an insult to anyone who's been sending applications into silence.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;But "cooked" is a different claim.&lt;/strong&gt; Software still runs hospitals, banks, farms, schools, and everything in between. The world still needs people who can build things and make them reliable. What's changed is that the easy on-ramp is narrower, and the people who get through are often not the ones who learned the most tools. They're the ones who learned to &lt;em&gt;finish things, explain their thinking, and keep going&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;The field isn't dead. It's &lt;em&gt;demanding&lt;/em&gt;, and that is not the same thing.&lt;/p&gt;

&lt;h2&gt;
  
  
  What nobody tells you about "keeping up"
&lt;/h2&gt;

&lt;p&gt;Here's something that might loosen your shoulders a little.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Nobody is keeping up with everything.&lt;/strong&gt; Not the senior engineer, not the conference speaker, not the person with ten thousand followers. The people who look like they know it all have usually just gone deep on a few things and gotten comfortable saying "I don't know that yet."&lt;/p&gt;

&lt;p&gt;The industry sells a story that there's a finish line where you finally know enough. There isn't one. What there is, is &lt;em&gt;depth in a few places, and the ability to learn the rest when you need it.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;A framework you haven't touched isn't a gap in your character. It's a tool you haven't needed yet.&lt;/p&gt;

&lt;h2&gt;
  
  
  A gentler way to measure yourself
&lt;/h2&gt;

&lt;p&gt;If you're a developer who goes home and still feels like you're failing, try asking different questions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Did I understand something today that I didn't yesterday?&lt;/strong&gt; That's progress, even if it's small.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Is what I'm doing in the evening building me up, or just soothing my guilt?&lt;/strong&gt; Writing an article because you enjoy sharing is wonderful. Writing one because you're afraid is just another shift without pay.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Would I tell a friend in my position to work this way?&lt;/strong&gt; If you wouldn't, don't do it to yourself.
Side projects, writing, and open source are genuinely valuable, especially when the traditional path is blocked. A portfolio can open doors a CV can't. But they should be &lt;em&gt;tools you pick up&lt;/em&gt;, not &lt;em&gt;chains you drag&lt;/em&gt;. The difference is whether you feel pulled toward them or pushed.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  For the one still staring at the screen
&lt;/h2&gt;

&lt;p&gt;To the developer reading this late at night, still wondering what you're missing:&lt;/p&gt;

&lt;p&gt;You are not behind. You are standing at the beginning of a long road, in an industry that has forgotten to be kind to beginners. The exhaustion you feel doesn't mean you chose wrong. It means you care, and in a field this loud, caring is a quiet kind of strength.&lt;/p&gt;

&lt;p&gt;Close the laptop. The tutorial will still be there tomorrow, and so will you, a little wiser than today.&lt;/p&gt;

&lt;p&gt;Rest isn't falling behind. It's how people last long enough to become the senior engineer who writes honest job descriptions and gives the next junior a real chance.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;If this resonated with you, share it with someone else or tell your story in the comments. Someone might be reading this and thinking they are the only one&lt;/em&gt;&lt;/p&gt;

</description>
      <category>career</category>
      <category>beginners</category>
      <category>programming</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Stop Trying to Be 5% Better. In the Age of AI, Builders Need a Niche Architecture, Not a Skill Stack</title>
      <dc:creator>Ryan Kelly</dc:creator>
      <pubDate>Mon, 24 Aug 2026 21:18:27 +0000</pubDate>
      <link>https://dev.to/rykelly/stop-trying-to-be-5-better-in-the-age-of-ai-builders-need-a-niche-architecture-not-a-skill-stack-338o</link>
      <guid>https://dev.to/rykelly/stop-trying-to-be-5-better-in-the-age-of-ai-builders-need-a-niche-architecture-not-a-skill-stack-338o</guid>
      <description>&lt;p&gt;&lt;em&gt;Why the only durable edge left is the one AI can't originate on its own.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Here's an uncomfortable truth nobody in tech wants to say out loud in 2026: being good at your job is no longer a career strategy. It's table stakes. For the last decade, the entire industry ran on a quiet promise — learn the stack, ship reliable code, be a little sharper than the next candidate, and you'd be fine. Grind LeetCode, get 5% better than the person next to you, climb the ladder. That promise is dead, and AI didn't kill it by taking your job. It killed it by taking your edge.&lt;/p&gt;

&lt;p&gt;I write Go for a living. I'm training at a project-based engineering school where nobody hands you a syllabus — you either figure it out or you don't graduate. And even in that environment, I've started to notice something that should worry every builder reading this: the gap between "competent" and "AI-assisted mediocre" is closing fast, because AI is very, very good at making mediocre look competent. It'll write you a working REST API. It'll debug your race condition. It'll refactor your spaghetti into something a senior engineer wouldn't be embarrassed by. The 5% you used to earn through years of grinding? A model can hand a first-year student most of it in an afternoon.&lt;/p&gt;

&lt;p&gt;So if "better" isn't the moat anymore, what is?&lt;/p&gt;

&lt;p&gt;I got nudged toward this idea by a software engineer-turned-artist I follow online called Gazi. Someone who builds ML systems by day and treats visual art as a second, equally serious discipline. Her point wasn't "learn to paint." It was sharper than that: in a world where AI has commoditized competence, the only durable advantage left is combination. Not depth in one lane. Depth in one lane plus a second, seemingly unrelated lane, fused together in a way a generalist model can't easily replicate, because it has no reason to have gone looking for that specific intersection.&lt;/p&gt;

&lt;p&gt;Call it &lt;strong&gt;niche architecture&lt;/strong&gt;: deliberately building your skill set as an intersection instead of a stack. A stack is additive — Go, plus Docker, plus Kubernetes, plus whatever's trending this quarter. An intersection is multiplicative — it's what happens when two domains that rarely talk to each other suddenly have to, and you're one of the few people fluent in both. Stacks get automated. Intersections get hired. Ten years ago, cross-domain skill was a nice-to-have that made you memorable in an interview. Today it's closer to a survival requirement, because the single-domain version of you is exactly what the model was trained to replace.&lt;/p&gt;

&lt;p&gt;But here's the part people get wrong the moment they hear "combination": they think it means picking up a hobby to look interesting on a resume. It doesn't. It means treating a second discipline — one that runs on taste, aesthetics, or storytelling instead of logic and syntax — with the same seriousness you treat your primary craft. The combination only works if both halves are real, not decorative.&lt;/p&gt;

&lt;p&gt;Picture it like this: a backend engineer who also takes fashion seriously doesn't just end up "a coder who likes clothes" — they end up positioned to build the exact kind of product a fashion-tech startup desperately needs, someone who understands fit, trend cycles, and what actually makes a garment or a drop work, not just someone who can wire up a checkout flow. A cloud engineer who also does photography doesn't just take nicer team headshots — they're the one person in the room who can turn a tangled system architecture into a visual story a non-technical exec instantly gets, because they understand how the eye reads a frame. Neither of those people is "5% better" at engineering. They're operating in a lane that barely has competition, because almost nobody bothers to go deep on both sides.&lt;/p&gt;

&lt;p&gt;Here's the actual mechanism behind why this works, and it matters because "rare" alone isn't a moat — plenty of rare skills are rare simply because nobody needs them. This is different.&lt;/p&gt;

&lt;p&gt;AI is extraordinary at pattern-completion within a domain. Feed it a well-defined problem with a large training corpus behind it — write this function, debug this stack trace, refactor this module — and it will get you most of the way there, fast. What it's structurally bad at is synthesis across domains it wasn't asked to bridge. It can write photography-adjacent code and it can write art criticism, but it has no lived taste, no accumulated instinct for why one crop feels right and another doesn't, no stake in the outcome. It can simulate the vocabulary of a discipline without ever having made the ten thousand small judgment calls that produce real fluency in it. That gap — between knowing &lt;em&gt;about&lt;/em&gt; a creative discipline and having &lt;em&gt;taste&lt;/em&gt; in it — is exactly where a model's usefulness runs out and a human's begins.&lt;/p&gt;

&lt;p&gt;So when you fuse a hardcore technical skill with a real creative one, you're not just making yourself harder to replace at the technical task. You're building a product of two fluencies that a model can approximate separately but can't originate together, because origination requires actual judgment under ambiguity — the "does this feel right" call — and that's the one thing pattern-completion doesn't do. The engineer-photographer isn't valuable because they can code &lt;em&gt;and&lt;/em&gt; shoot. They're valuable because they can look at a product decision and immediately know whether it serves the technical constraint and feels right to a human eye, in the same breath, without translating between two people in a meeting.&lt;/p&gt;

&lt;p&gt;So how do you actually build one of these intersections instead of just nodding along and doing nothing?&lt;/p&gt;

&lt;p&gt;Start by being honest about what "creative" doesn't mean. It doesn't mean scrolling design inspiration on weekends or taking a two-week Skillshare course so you can put "UI enthusiast" in your bio. It means picking a second discipline and giving it the same repetitions you gave your first one — the same willingness to be bad at it for a while, the same hours nobody's watching. If it's photography, that means actually shooting hundreds of frames, studying light, developing an eye for a composition that works, not just knowing the names of a few famous photographers.&lt;/p&gt;

&lt;p&gt;I'll be honest about where I'm at with this myself: most of my reps have gone into the hardcore side — Go, systems, protocol-level stuff like debugging JSON-RPC against a Bitcoin node or building a DNS server from scratch. But the closest thing I have to the "creative half" right now is writing. Every long-form piece I've put on dev.to — from walking through payment architecture across five different providers, to covering a hackathon, to writing up what I learned at a bootcamp — is a rep in a genuinely different skill: making a technical thing legible and even enjoyable to read, which is a taste problem as much as a technical one. It's not fashion or illustration, but it's the same underlying move: fusing "I can build this" with "I can make you feel something about it or understand it in a way that sticks." That's the muscle. The specific creative discipline matters less than actually training it seriously.&lt;/p&gt;

&lt;p&gt;The second thing: look for the adjacency, not just the interest. A random creative hobby with zero connection to your technical work is still just a hobby — good for your soul, doesn't move your career. The niche architecture only compounds when the two halves can eventually touch the same project. Photography plus backend engineering touches at image pipelines, storage, and creator tooling. Illustration plus cloud architecture touches at how you communicate systems to non-engineers. Find the discipline where your two skills could plausibly end up in the same room, and go deep there.&lt;/p&gt;

&lt;p&gt;A few ways this goes wrong, and it's worth naming them before you start.&lt;/p&gt;

&lt;p&gt;The first is &lt;strong&gt;decoration, not depth&lt;/strong&gt; — treating the creative half as a personality trait instead of a discipline. Putting "photographer" in your bio because you own a decent camera and post occasionally isn't an intersection, it's a costume. The whole thesis collapses if either half is shallow, because a shallow creative skill is exactly the kind of thing AI can fake convincingly.&lt;/p&gt;

&lt;p&gt;The second is &lt;strong&gt;picking the pairing for clout instead of adjacency&lt;/strong&gt;. Choosing a creative skill because it sounds impressive at a meetup, with no real path to ever touching your technical work, means you've built two disconnected hobbies, not one niche. It looks good on a slide. It doesn't compound.&lt;/p&gt;

&lt;p&gt;The third is &lt;strong&gt;waiting for permission&lt;/strong&gt;. Nobody is going to tell you when you've done "enough" reps to call yourself a photographer-slash-engineer or a fashion-slash-developer. The 5%-better game had clear rungs — junior, mid, senior. Niche architecture doesn't. You just start being the person who does both, out loud, in public, long before it feels earned.&lt;/p&gt;

&lt;p&gt;So, back to where we started: being 5% better than the next candidate used to be a career. Now it's a rounding error, because the model sitting next to you can close a 5% gap before you finish your coffee. That's not a reason to panic. It's a reason to stop optimizing for the wrong axis entirely.&lt;/p&gt;

&lt;p&gt;The builders who'll matter in the next decade won't be the ones who typed marginally faster or memorized one more framework before it got automated. They'll be the ones who stood at an intersection nobody else bothered to stand at — hardcore skill on one side, real creative fluency on the other — and let the two feed each other until the combination became the whole point. AI can out-code you. It can out-write you. It can probably out-photograph you on a technical level, too. What it can't do is be you, standing at your specific intersection, with your specific taste, built from your specific ten thousand hours on both sides.&lt;/p&gt;

&lt;p&gt;You don't need to be 5% better. You need to be the only one standing where you're standing. Go find that spot, and start putting in the reps in public, before you feel ready.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>What It Takes To Actually Ship A Product.</title>
      <dc:creator>Ryan Kelly</dc:creator>
      <pubDate>Wed, 29 Jul 2026 09:22:08 +0000</pubDate>
      <link>https://dev.to/rykelly/what-it-takes-to-actually-ship-a-product-17mh</link>
      <guid>https://dev.to/rykelly/what-it-takes-to-actually-ship-a-product-17mh</guid>
      <description>&lt;p&gt;Shipping a product isn't as subtle as many people may think. It requires precision, outreach, marketing skills, and having the right network. Most people think that building a product is the difficult part, but I have come to realize that is just the stepping stone of a difficult, and maybe even cumbersome, journey. I myself have experienced this first hand as a victim of many deadweight projects just sitting on my GitHub.&lt;/p&gt;

&lt;p&gt;I've got a DNS ad-blocking server I built in Go, sitting in a repo with a decent README and zero users. I've got an offline resource-sharing platform idea for university students that I still believe in, mostly unbuilt-on because I keep telling myself the code is the hard part I haven't cracked yet. I built a full-blown escrow system on the Lightning Network at a hackathon, shipped it, demoed it, felt like a genius for a weekend and then it went quiet the moment the judges stopped watching. None of these projects failed because the code was bad. They stalled because building was the only muscle I was flexing.&lt;/p&gt;

&lt;p&gt;That's the part nobody warns you about early enough. So I went looking for why this happens so consistently, not just to me, and the research lines up almost too well with the story I could have written from memory alone.&lt;/p&gt;

&lt;h2&gt;
  
  
  The build is the easy 20%
&lt;/h2&gt;

&lt;p&gt;There's a quote going around that captures this better than anything I could've come up with myself: building is the product, but distribution is the business, and most developers learn that the hard way, after launch, not before.&lt;/p&gt;

&lt;p&gt;That's the trap. When you're building, you're in control. You know what you're creating, you can measure your own progress, and every bug you fix feels like proof you're moving forward. Marketing doesn't hand you that same feedback loop. You're suddenly negotiating with the messy, unpredictable texture of human attention, and it can feel like shouting into a void while your "finished" product just sits there, technically working, practically invisible.&lt;/p&gt;

&lt;p&gt;I think this is exactly why so many of us default back to building. It's the part with a compiler that tells us when we're wrong. Outreach has no compiler. There's no error message that tells you why nobody starred the repo, no stack trace for why the launch post got three likes. The silence is the only feedback you get, and silence is genuinely hard to debug.&lt;/p&gt;

&lt;p&gt;This is also why building feels productive even when it isn't moving the needle on adoption. Refactoring a function, adding a test, fixing an edge case,all of that gives you the dopamine of visible progress. Sending a cold DM to a potential user, or posting in a community where you might get ignored, gives you nothing back except the discomfort of possibly being ignored. Given the choice between guaranteed small progress and uncertain, possibly humiliating progress, most of us pick the former every single time. I know I did, repeatedly, before I even noticed I was doing it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The numbers back up the vibe
&lt;/h2&gt;

&lt;p&gt;I wanted to know if "most startups fail because nobody wanted the thing" was just a saying people repeat, or something actually measurable. Turns out it's one of the most consistently repeated findings in startup research. CB Insights has studied this across hundreds of startup post-mortems, and the conclusion barely moves no matter how many times they refresh the dataset: the single biggest killer isn't a lack of funding or a weak team, it's building something the market never needed in the first place, a pattern that shows up in roughly four out of every ten failures.&lt;/p&gt;

&lt;p&gt;What's more interesting is what happens underneath that number. Running out of cash usually gets blamed as the final cause of death, but the more recent analysis treats that as a symptom rather than a root cause — startups don't run out of money in a vacuum, they run out of money because they couldn't convert or retain the customers they never had a real plan to reach in the first place. The founders had a product. What they didn't have was a validated line to the people who were supposed to want it.&lt;/p&gt;

&lt;p&gt;That distinction matters more than it sounds. "Ran out of cash" looks like a finance problem. It's actually a distribution problem wearing a finance costume. And it's worth sitting with how much this reframes the usual advice new builders get. We're told to "build an MVP," "iterate fast," "ship early." All of that is good advice for improving the product. None of it is advice for finding the people who are supposed to care about the product in the first place. You can iterate a beautiful MVP for two years and still fail for the exact same reason you would have failed on day one, because iteration speed was never the bottleneck.&lt;/p&gt;

&lt;p&gt;The team-related failures tell a similar story once you look closer. A team that looks dysfunctional from the outside with missed deadlines, co-founder friction, burnout  is sometimes just a team that's straining under the weight of a weak market signal. It's a lot easier to stay aligned and motivated when users are actually showing up. When they're not, every small disagreement about direction starts to feel existential, because there's no external evidence to settle it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why developers specifically get stuck here
&lt;/h2&gt;

&lt;p&gt;This isn't a universal blind spot; it's a fairly specific one for people who come from a technical background. Developers tend to want quick, measurable feedback, the kind you get from a passing test suite or a green build. Marketing and outreach are slow, iterative, and frequently ambiguous, which is close to the opposite of everything that made us comfortable writing code in the first place.&lt;/p&gt;

&lt;p&gt;There's also a trust problem baked into how developers respond to marketing, even when we're the ones doing it. Technical audiences are skeptical of anything that smells like hype, because we've all seen a shiny landing page collapse the moment you actually read the docs. That skepticism is healthy when you're the audience, but it quietly convinces a lot of builders that "real marketing" is beneath the work, that if the tool is good enough it should just spread on its own merit. It rarely does. Good technical audiences respond to proof, community, and consistent presence, not polish, but they still have to see you to respond to you at all.&lt;/p&gt;

&lt;p&gt;There's an irony in this that took me a while to notice. The same instincts that make developers good at their craft — skepticism of hype, preference for evidence over claims, discomfort with anything that feels like a sales pitch are exactly the instincts that make us undervalue the outreach work when we're the ones who need to do it. We assume other people will be as allergic to marketing as we are, so we under-market out of a kind of projected distaste, and then wonder why nobody found the thing we built.&lt;/p&gt;

&lt;p&gt;Being introverted and independent by nature doesn't help either. A lot of developers genuinely prefer heads-down solo work to the group effort that outreach usually requires like showing up in communities, replying to comments, going to meetups, cold-messaging people who might care. None of that comes naturally if your default mode is closing the laptop lid and letting the work speak for itself. Except the work almost never speaks for itself. Somebody has to say it out loud, repeatedly, in front of the right people.&lt;/p&gt;

&lt;h2&gt;
  
  
  What actually seems to work
&lt;/h2&gt;

&lt;p&gt;Reading through founder accounts and developer-marketing research, a few patterns kept repeating, and none of them are secret hacks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Distribution starts before the build finishes, not after.&lt;/strong&gt; The founders who found paying users faster weren't the ones with the most polished product; they were the ones talking to potential users while the thing was still ugly, adjusting based on what people actually said instead of what they hoped people would say. Waiting until launch day to start thinking about who wants this is waiting until the exam to start studying.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Education beats promotion, especially for technical products.&lt;/strong&gt; Writing about the problem, the trade-offs, and the way you solved it earns attention that a pitch never will. This is a big part of why I started writing dev.to articles alongside my projects instead of just pushing commits quietly. A well-explained architecture decision does more for credibility than a polished landing page ever could.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Community and consistency compound.&lt;/strong&gt; Showing up in the same places like GitHub, dev.to, X, hackathons and local tech meetups repeatedly is what turns strangers into an actual audience. One post rarely does it. Twenty posts over a year starts to. This is slow in a way that feels almost insulting to anyone used to instant compiler feedback, but it's the actual mechanism.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A network is leverage you can't code your way into.&lt;/strong&gt; Having people around you who can push your work in front of others, or who trust your name enough to vouch for it, shortens the distance between "I built something" and "people are using it" more than almost any single marketing tactic. This is part of why local ecosystems matter so much — showing up at hackathons and community events in your own tech scene isn't just for the free food and the demo slot, it's how you build the relationships that later become distribution.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ask before you build, not just after.&lt;/strong&gt; The CB Insights data makes this almost embarrassingly clear: in most of the documented failures, the information needed to avoid the outcome existed before a single line of code was written. Target users could have said the problem wasn't painful enough, or that a cheaper alternative already existed well enough. Nobody asked, or the question was framed in a way that only produced polite, misleading answers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Treat outreach like a real skill, not an afterthought.&lt;/strong&gt; It has its own literature, its own failure modes, and its own compounding returns, exactly like engineering does. Nobody expects to write good code on the first try without practice. The same patience should apply to the first cold message, the first community post, the first pitch that goes nowhere.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Sitting with the deadweight
&lt;/h2&gt;

&lt;p&gt;I'm not writing this from a position of having solved it. My GitHub still has projects that deserved more than the silence they got after I pushed the final commit. But naming the actual problem changed how I think about my next project before I write a single line of it: who is this for, where do they already hang out, and what am I going to say to them before I need them to say anything back to me.&lt;/p&gt;

&lt;p&gt;It also changed how I look at the projects already sitting there, gathering dust. Not every dead repo needs to be resurrected, but some of them failed to find users for reasons that have nothing to do with the code and everything to do with the fact that nobody outside a hackathon room ever heard about them. That's a fixable problem, if I'm willing to do the unglamorous, slow, feedback-free work of actually telling people it exists.&lt;/p&gt;

&lt;p&gt;Building will always feel like the real work because it's the part you can point to. But if nobody ever sees it, it isn't a product but just code that happens to run. Shipping is what happens after you've made peace with the part that doesn't come with a compiler.&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>startup</category>
      <category>software</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Payment APIs, Decoded: The Architecture Behind Flutterwave, Paystack, PesaPal, IntaSend, and Stripe</title>
      <dc:creator>Ryan Kelly</dc:creator>
      <pubDate>Sat, 11 Jul 2026 19:16:45 +0000</pubDate>
      <link>https://dev.to/rykelly/payment-apis-decoded-the-architecture-behind-flutterwave-paystack-pesapal-intasend-and-stripe-57mb</link>
      <guid>https://dev.to/rykelly/payment-apis-decoded-the-architecture-behind-flutterwave-paystack-pesapal-intasend-and-stripe-57mb</guid>
      <description>&lt;p&gt;If you've integrated a payment API before, you've probably followed a quickstart guide, pasted in a secret key, hit an endpoint, and shipped it. It works — until a webhook doesn't fire, a customer double-clicks "Pay Now," or a refund silently fails and support gets flooded with tickets.&lt;/p&gt;

&lt;p&gt;This article isn't a quickstart guide. It's an attempt to explain &lt;strong&gt;why payment APIs are built the way they are&lt;/strong&gt;,the failure modes they're designed around, and the tradeoffs different providers make — using five real providers as concrete reference points: &lt;strong&gt;Flutterwave, Paystack, PesaPal, IntaSend, and Stripe&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;If you're a backend engineer who's touched one payment API and wants to understand the &lt;em&gt;category&lt;/em&gt;, not just the &lt;em&gt;vendor&lt;/em&gt;, this is for you.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. What a Payment API Actually Is
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;Payment API&lt;/strong&gt; is a service that lets your application move money between two parties — a customer and a merchant — without your application ever directly touching a bank's core systems, a card network's rails, or a mobile money operator's ledger.&lt;/p&gt;

&lt;p&gt;That's the whole point: &lt;strong&gt;you are not allowed to talk to banks directly&lt;/strong&gt;, and even if you could, you wouldn't want to.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why payment APIs exist
&lt;/h3&gt;

&lt;p&gt;Banks, card networks (Visa/Mastercard), and mobile money operators (M-Pesa, Airtel Money) each expose their own proprietary, heavily regulated, and often decades-old interfaces. Integrating with each one directly would require:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Individual commercial agreements with every bank and network&lt;/li&gt;
&lt;li&gt;Compliance certification for each rail (PCI DSS, ISO 8583 for card switching, telco-specific protocols for mobile money)&lt;/li&gt;
&lt;li&gt;Handling settlement, reconciliation, and dispute resolution per rail&lt;/li&gt;
&lt;li&gt;Maintaining uptime and security to a regulator-grade standard
A payment API — usually operated by a &lt;strong&gt;payment gateway&lt;/strong&gt; or &lt;strong&gt;payment aggregator&lt;/strong&gt; — absorbs all of that complexity and exposes a single, consistent REST interface. You send JSON over HTTPS; they deal with ISO 8583 messages, telco USSD callbacks, and bank settlement files.
### Payment Aggregator vs Payment Gateway&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These terms get used interchangeably, but there's a real distinction:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Payment Gateway&lt;/strong&gt;: Routes a transaction to the correct processor/bank and returns a result. Conceptually similar to a network switch — it doesn't hold merchant funds.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Payment Aggregator&lt;/strong&gt;: Onboards many small merchants &lt;em&gt;under its own master merchant account&lt;/em&gt; with an acquiring bank, then sub-routes transactions internally. This is why you can sign up for Paystack or Flutterwave in minutes instead of weeks — you're not opening your own merchant account with a bank, you're a sub-merchant of theirs.
Flutterwave, Paystack, IntaSend, and PesaPal are all aggregators. Stripe operates as both, depending on market and product (Stripe Connect explicitly turns &lt;em&gt;you&lt;/em&gt; into an aggregator for your own sub-merchants).&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The technical contract
&lt;/h3&gt;

&lt;p&gt;Regardless of aggregator vs gateway, almost every modern payment API shares the same technical contract:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;REST over HTTPS&lt;/strong&gt; — no exceptions in 2026; TLS is non-negotiable given cardholder data sensitivity&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;JSON&lt;/strong&gt; request/response bodies&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Key-based authentication&lt;/strong&gt; — API keys, bearer tokens, or OAuth, transmitted in headers, never in the URL or body&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Idempotent, stateless requests&lt;/strong&gt; — each API call carries everything needed to process it; state lives server-side on the provider
This shared contract is exactly why, once you understand &lt;em&gt;one&lt;/em&gt; payment API deeply, the rest become 80% pattern-matching and 20% provider-specific quirks.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  2. Payment Processing Architecture
&lt;/h2&gt;

&lt;p&gt;Here's the full lifecycle of a single payment, end to end:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; Customer
    │
    ▼
 Frontend (Web / Mobile App)
    │  (collects payment method, redirects to checkout)
    ▼
 Backend Server
    │  (creates transaction via secret key — NEVER from frontend)
    ▼
 Payment API (Flutterwave / Paystack / Stripe / etc.)
    │
    ▼
 Bank / Card Network / Mobile Money Operator
    │  (actual money movement happens here)
    ▼
 Payment Result
    │
    ├──────────────► Webhook ──────► Backend ──────► Database Update
    │
    └──────────────► Redirect ─────► Frontend Confirmation (UNTRUSTED)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Breaking down each component
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Frontend&lt;/strong&gt;: Collects payment intent — amount, method, maybe card details (tokenized client-side, never touching your server) — and either redirects to a hosted checkout page or opens an embedded payment element. The frontend's job ends at &lt;em&gt;initiating&lt;/em&gt; the payment. It should never be the source of truth for whether a payment succeeded.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Backend Server&lt;/strong&gt;: This is where your secret key lives, and it's the only component authorized to create transactions and query their real status. It initializes the payment, generates a reference ID for your own reconciliation, and later verifies the outcome.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Payment API&lt;/strong&gt;: Receives the transaction request, validates it, and hands off to the actual settlement rail — a card network, a bank's account-to-account rail, or a mobile money operator's collection API (e.g., M-Pesa STK Push).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Bank / Card Network / Mobile Money&lt;/strong&gt;: This is where money &lt;em&gt;actually&lt;/em&gt; moves. Everything before this point is orchestration; this is execution.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Payment Result → Webhook&lt;/strong&gt;: The provider doesn't wait for you to ask "did it work?" — it pushes an event to a webhook URL you registered, asynchronously, the moment the result is known. This decouples payment completion from your server being "in the room" at that exact millisecond.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Backend → Database Update&lt;/strong&gt;: On receiving the webhook, your backend re-verifies the transaction (never trusts the webhook payload blindly — more on this in Section 4) and updates your own database as the single source of truth for your application.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Frontend Confirmation&lt;/strong&gt;: The user is redirected back to your app and shown a success/failure screen — but this is a &lt;em&gt;UX convenience&lt;/em&gt;, not a &lt;em&gt;trust boundary&lt;/em&gt;. The database record written from the verified webhook is what actually determines whether the order ships.&lt;/p&gt;

&lt;p&gt;This separation — frontend shows status, backend decides truth — is the single most important architectural idea in payment systems, and it's the one junior implementations get wrong most often.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. The Universal Integration Workflow
&lt;/h2&gt;

&lt;p&gt;Nearly every provider in this article — despite very different dashboards, docs, and SDKs — implements the same eleven-step sequence:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Create a merchant account&lt;/strong&gt; with the provider (KYC/KYB verification happens here)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Obtain API credentials&lt;/strong&gt; — typically a public/publishable key, a secret key, and sometimes an OAuth-issued access token or consumer key&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Authenticate requests&lt;/strong&gt; using those credentials, almost always via an &lt;code&gt;Authorization: Bearer &amp;lt;SECRET_KEY&amp;gt;&lt;/code&gt; header&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Create a payment request&lt;/strong&gt; — amount, currency, customer info, and a merchant-generated reference ID&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Provider creates a transaction record&lt;/strong&gt; and returns something you redirect the user to — a checkout URL, a Payment Intent, or a payment session&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Customer completes payment&lt;/strong&gt; via card, mobile money, bank transfer, or wallet&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Provider communicates with the underlying rail&lt;/strong&gt; (bank, card network, telco)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Transaction completes&lt;/strong&gt; (or fails) on that rail&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;API returns a response&lt;/strong&gt; to whichever party is polling or redirected&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Webhook fires&lt;/strong&gt;, notifying your backend asynchronously&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Backend verifies the payment&lt;/strong&gt; against the provider's API directly, then fulfills the order
### A representative request
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="err"&gt;POST&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;/transaction/initialize&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="err"&gt;Authorization:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Bearer&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;sk_live_xxxxxxxxxxxx&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="err"&gt;Content-Type:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;application/json&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"amount"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;5000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"currency"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"KES"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"email"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"user@email.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"reference"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"order_9f21ac"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Why the secret key never leaves your server
&lt;/h3&gt;

&lt;p&gt;The secret key can create charges, issue refunds, and initiate payouts — essentially, it can move money. If it leaks into frontend JavaScript, mobile app bytecode, or a public repo, anyone can use it to drain funds or create fraudulent transactions attributed to your account. Public/publishable keys, by contrast, are safe client-side because they can only be used to &lt;em&gt;tokenize&lt;/em&gt; payment details or &lt;em&gt;initiate&lt;/em&gt; a session — never to unilaterally move money or query sensitive account data.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why step 11 (verification) is non-negotiable
&lt;/h3&gt;

&lt;p&gt;Step 9's API response and the frontend redirect in step 6 can both be spoofed, cached, or manipulated by a malicious client. A user could, in theory, intercept the redirect and forge a "success" URL without ever paying. The only trustworthy source of truth is your backend independently asking the provider, "what is the real status of transaction &lt;code&gt;order_9f21ac&lt;/code&gt;?" — using your secret key, over a server-to-server call the client can't touch.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Core Backend Concepts
&lt;/h2&gt;

&lt;p&gt;This is where payment APIs stop being "just another REST API" and start requiring systems-level thinking.&lt;/p&gt;

&lt;h3&gt;
  
  
  Payment Initialization
&lt;/h3&gt;

&lt;p&gt;Before money moves, providers require you to &lt;em&gt;declare intent&lt;/em&gt; — create a transaction object describing what you're about to charge, for how much, in what currency, before the customer ever enters payment details.&lt;/p&gt;

&lt;p&gt;Why not just charge directly in one call? Because payments are rarely atomic in practice:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The customer might need to be redirected to a 3D Secure challenge, an OTP screen, or an STK push prompt on their phone&lt;/li&gt;
&lt;li&gt;The amount might need adjustment (tips, currency conversion) before capture&lt;/li&gt;
&lt;li&gt;You need a stable object to reference across multiple round trips (frontend polling, webhook correlation, retries)
&lt;strong&gt;Stripe&lt;/strong&gt; makes this explicit with &lt;strong&gt;Payment Intents&lt;/strong&gt; — a stateful object that moves through &lt;code&gt;requires_payment_method&lt;/code&gt; → &lt;code&gt;requires_confirmation&lt;/code&gt; → &lt;code&gt;requires_action&lt;/code&gt; → &lt;code&gt;processing&lt;/code&gt; → &lt;code&gt;succeeded&lt;/code&gt;. &lt;strong&gt;Flutterwave&lt;/strong&gt; and &lt;strong&gt;Paystack&lt;/strong&gt; achieve the same thing more implicitly: you call &lt;code&gt;/transaction/initialize&lt;/code&gt;, get back a checkout URL, and the transaction object behind that URL tracks state server-side even though it's not exposed as a rich state machine to you.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Payment Verification
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Rule: never trust a frontend "success" message.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The frontend can only tell you what the &lt;em&gt;user's browser&lt;/em&gt; observed — a redirect parameter, a client-side SDK callback. None of that is cryptographically tied to an actual settled transaction. A user can manually craft a &lt;code&gt;?status=success&lt;/code&gt; URL, a proxy can rewrite responses, or a client bug can fire a success callback without the underlying payment ever completing.&lt;/p&gt;

&lt;p&gt;The only reliable verification path is a &lt;strong&gt;server-to-server GET request&lt;/strong&gt;, authenticated with your secret key, asking the provider directly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;GET /transaction/verify/{reference}
Authorization: Bearer sk_live_xxxxxxxxxxxx
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You fulfill the order only when &lt;em&gt;this&lt;/em&gt; call — not the redirect, not the webhook payload alone — confirms &lt;code&gt;status: success&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Webhooks
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Polling vs. webhooks&lt;/strong&gt; is a classic distributed-systems tradeoff:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Polling&lt;/strong&gt; (repeatedly calling &lt;code&gt;GET /transaction/{id}&lt;/code&gt;) is simple but wasteful — you're guessing when the result will be ready, burning API quota and adding latency.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Webhooks&lt;/strong&gt; invert the model: the provider pushes an event to &lt;em&gt;you&lt;/em&gt; the instant a state change happens. This is event-driven architecture applied to payments — your backend reacts to events (&lt;code&gt;charge.completed&lt;/code&gt;, &lt;code&gt;payment.failed&lt;/code&gt;, &lt;code&gt;refund.completed&lt;/code&gt;) instead of asking "are we there yet?" in a loop.
A typical webhook backend flow:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Provider ──POST──► /webhooks/payment
                       │
                       ▼
             Verify signature (HMAC)
                       │
                       ▼
             Is this event new? (idempotency check)
                       │
                       ▼
             Re-verify via GET /verify (don't trust payload)
                       │
                       ▼
             Update database, trigger fulfillment
                       │
                       ▼
             Return 200 OK  (ack — or provider will retry)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two details matter enormously here:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Signature verification&lt;/strong&gt; — providers sign webhook payloads (usually HMAC-SHA512 over the raw body, using a webhook secret you generate). Skipping this means anyone who knows your webhook URL can forge a payment event.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Returning 200 quickly&lt;/strong&gt; — providers retry failed/timeout webhook deliveries with backoff. Your handler should acknowledge fast and do heavy processing asynchronously (queue job), or you risk duplicate deliveries piling up.
### Idempotency&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Networks fail. Clients retry. Users double-click. Any of these can cause the &lt;em&gt;same&lt;/em&gt; payment intent to be submitted twice. Without protection, that's a double charge — a direct financial loss and a trust-destroying bug.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Idempotency keys&lt;/strong&gt; solve this: the client generates a unique key per logical operation (not per HTTP call) and sends it in a header:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Idempotency-Key: order_9f21ac_attempt_1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the provider sees the same key again — whether because of a genuine retry after a timeout, or a duplicate click — it returns the &lt;em&gt;original&lt;/em&gt; result instead of creating a second charge. Stripe formalizes this as a first-class header (&lt;code&gt;Idempotency-Key&lt;/code&gt;) with a documented retention window (typically 24 hours). Providers without a formal idempotency API (common among African aggregators) push this responsibility onto you: generate your own unique &lt;code&gt;reference&lt;/code&gt; per attempt and treat duplicate references as a signal to fetch the existing transaction rather than create a new one.&lt;/p&gt;

&lt;p&gt;This matters more in payments than almost any other domain — "eventually consistent, occasionally duplicated" is fine for a like button; it is not fine for a bank transfer.&lt;/p&gt;

&lt;h3&gt;
  
  
  Authentication
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Mechanism&lt;/th&gt;
&lt;th&gt;What it is&lt;/th&gt;
&lt;th&gt;Where it's used&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;API Key (secret)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Long-lived static credential, full account privileges&lt;/td&gt;
&lt;td&gt;Backend-only, all providers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;API Key (public/publishable)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Restricted to safe client-side operations (tokenization, session creation)&lt;/td&gt;
&lt;td&gt;Frontend SDKs, Stripe/Flutterwave/Paystack&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Bearer Token&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Credential sent in &lt;code&gt;Authorization&lt;/code&gt; header&lt;/td&gt;
&lt;td&gt;Universal transport mechanism for the above&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;OAuth Access Token&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Short-lived, scoped, obtained via OAuth flow, often refreshable&lt;/td&gt;
&lt;td&gt;Stripe Connect (platform-to-connected-account), some IntaSend flows&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Consumer Key/Secret&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;OAuth 1.0/2.0-style credential pair used to obtain an access token&lt;/td&gt;
&lt;td&gt;PesaPal, and the underlying M-Pesa Daraja API that several aggregators sit on top of&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The security principle underneath all of these: &lt;strong&gt;credential scope should match blast radius&lt;/strong&gt;. A publishable key leaking is a non-event. A secret key leaking is an incident. An OAuth token scoped to a single connected account leaking is bad, but contained — unlike a platform-wide secret key.&lt;/p&gt;

&lt;h3&gt;
  
  
  PCI DSS
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;PCI DSS&lt;/strong&gt; (Payment Card Industry Data Security Standard) is a compliance framework mandated by the card networks (Visa, Mastercard, etc.) for anyone who stores, processes, or transmits cardholder data. Compliance is expensive: network segmentation, quarterly vulnerability scans, annual audits, and strict access controls.&lt;/p&gt;

&lt;p&gt;Payment APIs exist partly &lt;em&gt;to keep you out of PCI scope&lt;/em&gt;. If your server never touches raw card numbers — because the card form is hosted by the provider (a redirect/iframe) or tokenized client-side via their JS SDK before it ever reaches your backend — your PCI compliance burden drops from "full assessment" (SAQ D) to a much lighter self-assessment (SAQ A), sometimes just a checklist.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The rule for merchants: never store raw card data. Ever.&lt;/strong&gt; Not encrypted "for convenience," not in logs, not in error messages. Let the processor hold that liability.&lt;/p&gt;

&lt;h3&gt;
  
  
  Tokenization
&lt;/h3&gt;

&lt;p&gt;Tokenization replaces sensitive data (a card number) with a non-sensitive &lt;strong&gt;token&lt;/strong&gt; that's meaningless outside the system that issued it — it can't be reverse-engineered back into the original card number.&lt;/p&gt;

&lt;p&gt;It's easy to confuse with two adjacent concepts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Encryption&lt;/strong&gt;: Reversible. If you have the key, you get the original data back. The card number still &lt;em&gt;exists&lt;/em&gt;, mathematically recoverable.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hashing&lt;/strong&gt;: One-way and deterministic. Same input always produces the same output — which is exactly why hashing is &lt;em&gt;wrong&lt;/em&gt; for card numbers (you could brute-force a hash of a 16-digit number space).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tokenization&lt;/strong&gt;: The mapping between token and real value lives only in the provider's secure vault. The token itself carries zero recoverable information. Even if your database of tokens leaks, an attacker gets nothing usable.
This is why you can safely store a Stripe &lt;code&gt;pm_xxxxx&lt;/code&gt; payment method token in your own database for recurring billing, but you could never safely store the underlying card number, encrypted or not.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Payment States
&lt;/h3&gt;

&lt;p&gt;Every provider models roughly the same underlying state machine, even if the exact labels differ:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; Pending ──► Authorized ──► Captured ──► Completed
    │             │                          │
    │             └──► Cancelled             ├──► Refunded
    │                                          └──► Reversed
    └──► Failed
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Pending&lt;/strong&gt;: Transaction created, awaiting customer action or processing&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Authorized&lt;/strong&gt;: Funds reserved on the customer's account/card, not yet moved (common in card payments; less common in mobile money, which is usually a single-step debit)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Captured&lt;/strong&gt;: Merchant confirms the authorized amount should actually be collected&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Completed&lt;/strong&gt;: Funds have settled to the merchant&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Failed&lt;/strong&gt;: Payment attempt did not succeed (insufficient funds, declined, timeout)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cancelled&lt;/strong&gt;: Authorized but voided before capture&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Refunded&lt;/strong&gt;: Completed payment returned to customer, fully or partially&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reversed&lt;/strong&gt;: Provider- or bank-initiated reversal, often for fraud or disputes
Understanding this state machine matters because your own database schema should mirror it — a transactions table with a loosely-typed &lt;code&gt;status: string&lt;/code&gt; column and no enforced transitions is a recipe for "refunded" orders that still show as "completed" in your admin panel.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  5. Provider Deep Dives
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Flutterwave
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Overview&lt;/strong&gt;: Pan-African payment infrastructure company, headquartered with operations spanning Nigeria, Kenya, Ghana, Uganda, South Africa, and beyond, with growing support for cross-border and international card payments.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Supported countries&lt;/strong&gt;: 30+ African countries, plus international card acceptance for global customers paying African merchants.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Payment methods&lt;/strong&gt;: Cards (Visa/Mastercard/Verve), bank transfers, USSD, mobile money (M-Pesa, MTN MoMo, Airtel Money), Barter (Flutterwave's own wallet), virtual accounts, and payment links.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Technical architecture&lt;/strong&gt;: REST/JSON over HTTPS, secret + public key authentication, sandbox and live environment separation, SDKs for Node.js, PHP, Python, and mobile (React Native, Flutter). Webhooks are HMAC-signed with a &lt;code&gt;verif-hash&lt;/code&gt; header you compare against a secret you set in the dashboard.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Representative endpoints&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;POST /v3/payments              &lt;span class="c"&gt;# Initialize a transaction, get a checkout link&lt;/span&gt;
GET  /v3/transactions/&lt;span class="o"&gt;{&lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt;/verify   &lt;span class="c"&gt;# Verify actual transaction status&lt;/span&gt;
POST /v3/transfers             &lt;span class="c"&gt;# Payout to a bank account or mobile money wallet&lt;/span&gt;
POST /v3/refunds               &lt;span class="c"&gt;# Refund a completed transaction&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Strengths&lt;/strong&gt;: Broad multi-country and multi-rail coverage in a single integration; strong mobile money support, which matters enormously for African markets where card penetration is low; virtual account and payment link features reduce custom checkout UI work.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Weaknesses&lt;/strong&gt;: Documentation consistency has historically varied across API versions (v2 vs v3 migration pain is a known community complaint); error messages can be less granular than Stripe's.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ideal use case&lt;/strong&gt;: Multi-country African e-commerce or marketplace platforms that need one integration to reach customers across several currencies and payment rails, including mobile money.&lt;/p&gt;




&lt;h3&gt;
  
  
  Paystack
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Overview&lt;/strong&gt;: Nigerian-born payment gateway (acquired by Stripe in 2020), strongest in Nigeria and Ghana, expanding across the continent, widely praised for developer experience.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Supported countries&lt;/strong&gt;: Nigeria, Ghana, South Africa, Kenya (growing), with card acceptance from a wider set of countries.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Payment methods&lt;/strong&gt;: Cards, bank transfers, USSD, mobile money (Ghana), QR, and Paystack's own virtual accounts.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Technical architecture&lt;/strong&gt;: Clean REST/JSON API, single secret-key bearer auth, extremely readable documentation with copy-pasteable examples in most major languages, well-maintained SDKs. Sandbox uses test-mode keys (&lt;code&gt;sk_test_...&lt;/code&gt;) that mirror live behavior closely, making local development fast.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Representative endpoints&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;POST /transaction/initialize   &lt;span class="c"&gt;# Create transaction, get authorization_url&lt;/span&gt;
GET  /transaction/verify/&lt;span class="o"&gt;{&lt;/span&gt;reference&lt;span class="o"&gt;}&lt;/span&gt;  &lt;span class="c"&gt;# The canonical "did this actually work" check&lt;/span&gt;
POST /transfer                 &lt;span class="c"&gt;# Send money out (payouts)&lt;/span&gt;
GET  /customer/&lt;span class="o"&gt;{&lt;/span&gt;code&lt;span class="o"&gt;}&lt;/span&gt;          &lt;span class="c"&gt;# Customer object for recurring billing&lt;/span&gt;
POST /refund                   &lt;span class="c"&gt;# Full or partial refund&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Strengths&lt;/strong&gt;: Arguably the best developer experience of the African providers covered here — predictable naming, consistent error shapes, a Customers API that makes recurring billing straightforward, and a verification endpoint that's simple to reason about.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Weaknesses&lt;/strong&gt;: Narrower country coverage than Flutterwave; mobile money support is less comprehensive outside specific markets.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ideal use case&lt;/strong&gt;: Nigeria/Ghana-first products, or teams that prioritize integration speed and clean documentation over maximal geographic reach.&lt;/p&gt;




&lt;h3&gt;
  
  
  PesaPal
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Overview&lt;/strong&gt;: East African payment gateway, one of the earliest players in the region, historically strong in Kenya, Uganda, Tanzania, with particular traction in hospitality (hotels, travel) and education (school fee payments).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Supported countries&lt;/strong&gt;: Kenya, Uganda, Tanzania, Malawi, Zambia, with a regional East/Southern Africa focus rather than pan-continental breadth.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Payment methods&lt;/strong&gt;: Cards, M-Pesa and other regional mobile money, bank transfers, and PesaPal's own wallet.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Technical architecture&lt;/strong&gt;: OAuth-based authentication (consumer key/secret exchanged for a bearer token) rather than a static secret key — an important difference from Flutterwave/Paystack's simpler model. IPN (Instant Payment Notification) is PesaPal's term for what other providers call a webhook — you register an IPN URL that receives callback notifications on transaction status change.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Representative endpoints&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;POST /api/Auth/RequestToken         &lt;span class="c"&gt;# Exchange consumer key/secret for bearer token&lt;/span&gt;
POST /api/URLSetup/RegisterIPN      &lt;span class="c"&gt;# Register your callback/webhook URL&lt;/span&gt;
POST /api/Transactions/SubmitOrderRequest  &lt;span class="c"&gt;# Create a payment request&lt;/span&gt;
GET  /api/Transactions/GetTransactionStatus  &lt;span class="c"&gt;# Verify status&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Strengths&lt;/strong&gt;: Deep, longstanding integrations in hospitality and education verticals in East Africa; reliable for recurring institutional use cases like school fees, which have specific reconciliation needs (matching payments to specific students/invoices).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Weaknesses&lt;/strong&gt;: The OAuth token exchange step adds integration complexity versus a single static bearer key; smaller developer community and fewer third-party SDKs/tutorials than Paystack or Stripe; documentation is functional but less polished.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ideal use case&lt;/strong&gt;: Institutional East African use cases — schools, hotels, travel bookings — where PesaPal's existing vertical relationships and IPN reliability outweigh the extra OAuth complexity.&lt;/p&gt;




&lt;h3&gt;
  
  
  IntaSend
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Overview&lt;/strong&gt;: Kenyan payment infrastructure provider, positioned as a developer-friendly alternative for Kenya-specific and East African collections and payouts, with a strong focus on M-Pesa.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Supported countries&lt;/strong&gt;: Primarily Kenya, with expanding regional support.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Payment methods&lt;/strong&gt;: M-Pesa (STK Push is a headline feature — the "enter your PIN" prompt that pops up on the customer's phone), cards, bank transfers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Technical architecture&lt;/strong&gt;: REST/JSON, API key + publishable key pair similar to Paystack's model, dedicated &lt;strong&gt;Collections API&lt;/strong&gt; (money coming in) and &lt;strong&gt;Payouts API&lt;/strong&gt; (money going out) as clearly separated concerns rather than a single generic "transactions" endpoint. Sandbox environment available for testing STK Push flows without real Safaricom charges.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Representative endpoints&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;POST /api/v1/payment/mpesa-stk-push/   &lt;span class="c"&gt;# Trigger STK push to customer's phone&lt;/span&gt;
GET  /api/v1/payment/status/&lt;span class="o"&gt;{&lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt;/      &lt;span class="c"&gt;# Check payment status&lt;/span&gt;
POST /api/v1/send-money/mpesa/         &lt;span class="c"&gt;# B2C payout via M-Pesa&lt;/span&gt;
POST /api/v1/send-money/bank/          &lt;span class="c"&gt;# Payout to bank account&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Strengths&lt;/strong&gt;: Excellent for M-Pesa-first products — the STK Push flow is well-documented and the separation of Collections vs. Payouts APIs maps cleanly onto how most businesses think about cash flow (money in vs. money out are genuinely different operational concerns, often owned by different teams). Good fit for Kenyan fintech and SME tooling.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Weaknesses&lt;/strong&gt;: Narrower geographic and payment-method scope than Flutterwave or Stripe — if you need broad card acceptance outside Kenya or multi-country mobile money, you'll likely need a second provider alongside it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ideal use case&lt;/strong&gt;: Kenya-first products where M-Pesa collections and payouts (e.g., a savings app, a gig-economy payout system, a merchant till replacement) are the core transaction type — which is directly relevant if you're building something like a creator-payout or livestreaming monetization flow with M-Pesa as a primary rail.&lt;/p&gt;




&lt;h3&gt;
  
  
  Stripe
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Overview&lt;/strong&gt;: The global reference implementation for modern payment infrastructure. If you're trying to understand "how should a payment API be designed," Stripe's API is usually the answer, and it's worth studying even if you never integrate it, because most other providers' newer API versions are visibly influenced by its patterns.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Supported countries&lt;/strong&gt;: 40+ countries for full merchant accounts, with broader reach for accepting international cards.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Payment methods&lt;/strong&gt;: Cards, bank debits (ACH, SEPA), wallets (Apple Pay, Google Pay), buy-now-pay-later options, and — through &lt;strong&gt;Stripe Connect&lt;/strong&gt; — the ability to build your own multi-sided marketplace with sub-merchants.&lt;/p&gt;

&lt;h4&gt;
  
  
  Technical architecture — the deepest of the five, deliberately
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Payment Intents API&lt;/strong&gt;: Rather than a single "charge" call, Stripe models a payment as an object that moves through an explicit state machine (&lt;code&gt;requires_payment_method&lt;/code&gt; → &lt;code&gt;requires_confirmation&lt;/code&gt; → &lt;code&gt;requires_action&lt;/code&gt; → &lt;code&gt;processing&lt;/code&gt; → &lt;code&gt;succeeded&lt;/code&gt;/&lt;code&gt;requires_capture&lt;/code&gt;). This exists because modern card payments frequently require &lt;em&gt;multi-step&lt;/em&gt; customer interaction — 3D Secure authentication being the most common — and Stripe's model was purpose-built to represent "this payment is in progress and waiting on the customer" as a first-class state, not an edge case bolted on afterward.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Setup Intents&lt;/strong&gt;: For saving a payment method &lt;em&gt;without&lt;/em&gt; charging anything yet — critical for free trials, "add a card" flows, or authorizing future off-session charges.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Checkout Sessions&lt;/strong&gt;: A hosted, Stripe-managed checkout page — the fastest path to PCI-light integration, similar in spirit to Flutterwave/Paystack's hosted checkout URLs, but with deep customization options.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Billing &amp;amp; Subscriptions&lt;/strong&gt;: A full subscription engine — proration, metered billing, trial periods, dunning (automatic retry logic for failed recurring charges) — that most African providers don't attempt to replicate at the same depth.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Connect&lt;/strong&gt;: Turns your platform into a marketplace. You can onboard &lt;em&gt;your own&lt;/em&gt; sub-merchants (creators, sellers, drivers) each with their own Stripe-managed account, and split payments between platform and seller programmatically. This is directly the pattern underneath most creator-economy and marketplace platforms.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Webhooks&lt;/strong&gt;: Same event-driven model as other providers, but with a notably larger, more granular event taxonomy (&lt;code&gt;payment_intent.succeeded&lt;/code&gt;, &lt;code&gt;charge.dispute.created&lt;/code&gt;, &lt;code&gt;invoice.payment_failed&lt;/code&gt;, etc.) and official libraries for signature verification in every major language.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Idempotency&lt;/strong&gt;: First-class &lt;code&gt;Idempotency-Key&lt;/code&gt; header support baked into the core API, not something you have to simulate with your own reference field.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Radar&lt;/strong&gt;: Stripe's built-in fraud detection engine, using machine learning trained across Stripe's entire transaction graph — an advantage of scale that's very hard for smaller regional providers to replicate.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Payment Element&lt;/strong&gt;: A single embeddable UI component that automatically shows the right payment methods for the customer's location and adapts to Stripe's evolving method support without you shipping new frontend code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Representative endpoints&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;POST /v1/payment_intents             &lt;span class="c"&gt;# Create a Payment Intent&lt;/span&gt;
POST /v1/payment_intents/&lt;span class="o"&gt;{&lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt;/confirm  &lt;span class="c"&gt;# Confirm with a payment method&lt;/span&gt;
GET  /v1/payment_intents/&lt;span class="o"&gt;{&lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt;         &lt;span class="c"&gt;# Verify current status&lt;/span&gt;
POST /v1/refunds                      &lt;span class="c"&gt;# Refund a charge&lt;/span&gt;
POST /v1/transfers                    &lt;span class="c"&gt;# Move funds to a connected account (Connect)&lt;/span&gt;
POST /v1/subscriptions                &lt;span class="c"&gt;# Create a recurring billing subscription&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Strengths&lt;/strong&gt;: Unmatched documentation quality, the richest state-modeling of any provider here, native idempotency, built-in fraud detection at scale, and Connect for marketplace architectures — this is genuinely the deepest, most "engineered" API in this comparison.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Weaknesses&lt;/strong&gt;: Limited or no direct support for African mobile money rails (M-Pesa, Airtel Money) — you'd pair Stripe for global card/wallet coverage with a regional provider for mobile money if building for African markets specifically; pricing and payout timelines can be less favorable in some emerging markets.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ideal use case&lt;/strong&gt;: Global SaaS billing, marketplaces needing split payments (Connect), or any product where subscription logic, fraud tooling, and API maturity matter more than direct mobile money support.&lt;/p&gt;




&lt;h2&gt;
  
  
  6. Flow Diagrams
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Payment Request Flow
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Frontend            Backend              Payment API           Bank/Telco
   │                   │                      │                    │
   │  "Pay $50"        │                      │                    │
   ├──────────────────►│                      │                    │
   │                   │  Initialize (secret key)                  │
   │                   ├─────────────────────►│                    │
   │                   │                      │  Route to rail     │
   │                   │                      ├───────────────────►│
   │                   │  checkout_url        │                    │
   │                   │◄─────────────────────┤                    │
   │  Redirect to      │                      │                    │
   │◄──────────────────┤                      │                    │
   │  checkout_url     │                      │                    │
   │───────────────────┴─────────────────────►│  Customer pays     │
   │                                           ├───────────────────►│
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Webhook Flow
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Bank/Telco ──► Payment API ──► POST /webhooks/payment ──► Your Backend
                                                               │
                                                    ┌──────────┴──────────┐
                                                    │ Verify HMAC signature│
                                                    └──────────┬──────────┘
                                                               │
                                                    ┌──────────┴──────────┐
                                                    │  GET /verify/{ref}   │
                                                    │  (re-check via API)  │
                                                    └──────────┬──────────┘
                                                               │
                                                    ┌──────────┴──────────┐
                                                    │  Update DB, fulfill  │
                                                    └──────────┬──────────┘
                                                               │
                                                          Return 200 OK
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Refund Flow
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Merchant Backend                 Payment API                    Bank/Card Network
       │                              │                                │
       │  POST /refund {tx_id, amt}   │                                │
       ├─────────────────────────────►│                                │
       │                              │  Reverse settlement request     │
       │                              ├───────────────────────────────►│
       │                              │  Refund confirmed               │
       │                              │◄───────────────────────────────┤
       │  refund.completed (webhook)  │                                │
       │◄─────────────────────────────┤                                │
       │  Update order status         │                                │
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Payout Flow (e.g., paying a creator/driver/vendor)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Merchant Backend               Payment API                Bank / Mobile Money
       │                            │                              │
       │  POST /transfer            │                              │
       │  {amount, destination}     │                              │
       ├───────────────────────────►│                              │
       │                            │  Disburse funds               │
       │                            ├─────────────────────────────►│
       │                            │  transfer.completed webhook   │
       │◄───────────────────────────┤◄──────────────────────────────┤
       │  Reconcile payout ledger   │                              │
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Subscription Flow (Stripe-style, conceptually generalizable)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Customer          Backend            Payment API
   │                 │                    │
   │  Sign up         │                    │
   ├────────────────►│                    │
   │                 │ Create Customer     │
   │                 ├───────────────────►│
   │                 │ Attach payment method (Setup Intent)
   │                 ├───────────────────►│
   │                 │ Create Subscription │
   │                 ├───────────────────►│
   │                 │                    │  Billing cycle triggers
   │                 │                    │  invoice.payment_succeeded
   │                 │◄───────────────────┤  (or _failed → dunning retries)
   │                 │ Update entitlement  │
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Payment Verification Flow
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;             ┌────────────────────────────────────┐
             │  NEVER trust frontend redirect alone │
             └────────────────────────────────────┘
                             │
Frontend redirect ──►  Backend  ──►  GET /verify/{reference}  ──►  Payment API
                             │                                          │
                             │◄─────────────── status: success ────────┤
                             │
                    Only NOW: fulfill order
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  8. Closing Thoughts
&lt;/h2&gt;

&lt;p&gt;Strip away the branding, the dashboards, and the marketing copy, and every payment API in this article is solving the same handful of hard problems:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;How do we let two parties who don't trust each other exchange money safely?&lt;/strong&gt; (Aggregation, PCI scope reduction, tokenization)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;How do we know a payment actually happened, when the client can lie?&lt;/strong&gt; (Server-side verification, never trusting redirects)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;How do we react to money movement without polling forever?&lt;/strong&gt; (Webhooks, event-driven design)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;How do we prevent a network hiccup from charging someone twice?&lt;/strong&gt; (Idempotency)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;How do we model something as messy as "a payment" as clean software state?&lt;/strong&gt; (Payment state machines — pending, authorized, captured, refunded)
Flutterwave and IntaSend lean into African payment rails and mobile money. Paystack optimizes for developer velocity in West Africa. PesaPal owns institutional East African verticals. Stripe pushes the ceiling on what a payment API's &lt;em&gt;engineering&lt;/em&gt; can look like — richer state, native idempotency, built-in fraud detection, and a real subscription/marketplace layer.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;None of them is "the best" in the abstract. The right provider is the one whose rails match your users' money and once you understand the shared architecture underneath all of them, switching providers, or running two in parallel, stops being a rewrite and starts being a config change.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;If you're building payment infrastructure for African markets specifically — say, a platform combining M-Pesa collections with a token-based creator economy — the practical pattern that emerges from this comparison is: pick a mobile-money-native provider (Flutterwave or IntaSend) for local collections/payouts, and reserve Stripe-style depth (Connect, subscriptions, Radar) for the parts of your system dealing with global cards or platform-level fund splitting. Very few products need to build all of that state-machine complexity themselves — that's exactly the point of these APIs existing.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>tutorial</category>
      <category>api</category>
      <category>fintech</category>
    </item>
    <item>
      <title>The Best Career Guidance Is a Tech Event You Didn't Want to Attend</title>
      <dc:creator>Ryan Kelly</dc:creator>
      <pubDate>Sat, 13 Jun 2026 19:55:01 +0000</pubDate>
      <link>https://dev.to/rykelly/the-best-career-guidance-is-a-tech-event-you-didnt-want-to-attend-51n3</link>
      <guid>https://dev.to/rykelly/the-best-career-guidance-is-a-tech-event-you-didnt-want-to-attend-51n3</guid>
      <description>&lt;p&gt;I have a confession: I almost didn't go to any of them.&lt;/p&gt;

&lt;p&gt;Each time, there was a reason not to. Too far. Too expensive. Too early on a Saturday. Too many things on my plate. Too much imposter syndrome whispering &lt;em&gt;what would you even say to a Google recruiter?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;But I went. And every single time, I walked away with something that no tutorial, no documentation, no YouTube video had ever given me — a clear picture of where I stood, where the industry was moving, and exactly what I needed to do next.&lt;/p&gt;

&lt;p&gt;This is the story of four events that quietly rewired how I think about my career as a developer. Not all at once. Not dramatically. But brick by brick, event by event — a map started taking shape.&lt;/p&gt;




&lt;h2&gt;
  
  
  Event 1: The Cursor × Claude Hackathon — The Day I Stopped Just Writing Code
&lt;/h2&gt;

&lt;p&gt;I want to be honest: I signed up mostly because it was free.&lt;/p&gt;

&lt;p&gt;The pitch was something about "agentic engineering" and "AI workflows," and I had a vague sense that I should probably know what those words meant. What I didn't expect was that within the first hour, my entire mental model of what it means to be a developer would be gently — and then violently — shaken.&lt;/p&gt;

&lt;p&gt;The format was a one-hour build challenge. Ship a working, deployed prototype. In sixty minutes. Using Cursor and Claude.&lt;/p&gt;

&lt;p&gt;I remember thinking: &lt;em&gt;that's not possible.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;And then watching a team beside me finish in forty-three.&lt;/p&gt;

&lt;p&gt;What happened in that room wasn't just about speed. It was about a shift in how you relate to code. Up until that day, I had been — and I say this with zero shame — &lt;strong&gt;vibecoding&lt;/strong&gt;. Generating, accepting, tweaking, generating again. Treating AI as a very fast autocomplete. The code shipped, sure, but &lt;em&gt;I&lt;/em&gt; wasn't growing.&lt;/p&gt;

&lt;p&gt;The hackathon exposed the ceiling on that approach.&lt;/p&gt;

&lt;p&gt;The facilitators introduced a concept I hadn't heard articulated so cleanly before: &lt;strong&gt;agentic engineering&lt;/strong&gt; — the practice of thinking in workflows, not lines. Instead of asking an AI to write a function, you define a system: what the agent needs to know, what tools it has access to, what a successful outcome looks like, and where &lt;em&gt;you&lt;/em&gt; sit in the loop as the supervisor, not the typist.&lt;/p&gt;

&lt;p&gt;The distinction they drew — and it stuck with me — was between &lt;strong&gt;Cursor&lt;/strong&gt; and &lt;strong&gt;Claude Code&lt;/strong&gt; as two philosophies. Cursor is the intelligent collaborator inside your IDE, human-in-the-loop at every step. Claude Code is the autonomous agent in your terminal, capable of reading, modifying, and reasoning over an entire codebase while you review rather than write. Neither is better. But understanding &lt;em&gt;when&lt;/em&gt; to use which, and &lt;em&gt;how&lt;/em&gt; to structure your prompts as architecture rather than requests — that's the skill.&lt;/p&gt;

&lt;p&gt;I left with a deployed prototype, yes. But more importantly, I left with a question I've been sitting with since: &lt;strong&gt;Am I building with AI, or am I just letting AI build for me?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;There's a version of every developer's future where they become an orchestrator — someone who designs multi-agent workflows, defines constraints, reviews outputs, and ships faster than any solo engineer ever could. That future was previewed in that room and I realised I needed to start preparing for it now.&lt;/p&gt;




&lt;h2&gt;
  
  
  Event 2: Nation.dev — The Uncomfortable Mirror
&lt;/h2&gt;

&lt;p&gt;If the hackathon told me &lt;em&gt;how&lt;/em&gt; to build better, Nation.dev showed me &lt;em&gt;where&lt;/em&gt; I stood in the global picture.&lt;/p&gt;

&lt;p&gt;And the global picture was not flattering — for any of us.&lt;/p&gt;

&lt;p&gt;Nation.dev was a community-forward tech event focused squarely on the question that's haunting every developer right now but most of us are too proud to ask out loud: &lt;strong&gt;What is our place in the age of AI?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The opening speaker didn't waste time. The slide that stopped the room read something like: &lt;em&gt;"The average software developer job description is being rewritten. Not next year. Now."&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;They weren't being paranoid. They were being precise. The data they walked us through painted a picture I had been half-aware of but hadn't confronted:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Global demand for junior developers is compressing&lt;/strong&gt; as AI handles increasing amounts of boilerplate and scaffolding logic.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The developers who are thriving&lt;/strong&gt; are those who moved up the value chain — closer to product, architecture, and business logic — while letting AI handle the mechanical layers below.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Africa, and Kenya specifically&lt;/strong&gt;, is at an inflection point. We have one of the fastest-growing developer communities on the continent, a young population, and genuinely world-class talent coming out of programs like Zone01, Moringa, and others. But we're also at risk of building a generation of developers who are highly skilled at a layer of abstraction that AI is rapidly commoditising.
The conversation that hit hardest was about &lt;strong&gt;positioning&lt;/strong&gt;. Not skills — positioning. The speaker argued that the question isn't whether you can write Go, Python, or TypeScript. The question is: &lt;em&gt;what problem do you uniquely understand?&lt;/em&gt; An African developer who deeply understands M-Pesa integration, informal financial systems, low-bandwidth UX, or cross-border remittance flows has a competitive advantage that no model trained on Stack Overflow can replicate. &lt;strong&gt;Your context is your moat.&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I walked out of Nation.dev slightly bruised but newly focused. I stopped thinking about my career as a list of languages and started thinking about it as a set of problems I was uniquely positioned to solve.&lt;/p&gt;




&lt;h2&gt;
  
  
  Event 3: Build From Here Conference — The Room Where They Told You the Truth.
&lt;/h2&gt;

&lt;p&gt;Most career advice is sanitised. "Keep learning." "Build your portfolio." "Network." "Be passionate." It's not wrong. It's just not particularly useful.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Build From Here&lt;/strong&gt; was the first event where I heard people with actual hiring power and actual war stories speak without a filter.&lt;/p&gt;

&lt;p&gt;The lineup was stacked in a way I hadn't seen at a local event before: Google recruiters, CTOs, PMs, and founders — not as distant keynote speakers, but in a format that felt genuinely conversational. These were people who had interviewed thousands of candidates, built products from zero to scale, and made or missed critical career bets. And they were telling you exactly what they wished candidates understood.&lt;/p&gt;

&lt;p&gt;A few things I scribbled down and haven't stopped thinking about:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;On interviews:&lt;/strong&gt;&lt;br&gt;
The Google recruiters were refreshingly direct. They're not primarily looking for people who know everything. They're looking for evidence of how you think when you &lt;em&gt;don't&lt;/em&gt; know something. The candidate who walks through their reasoning — even imperfectly — consistently outranks the one who either knows the answer cold or goes blank. Thinking out loud is a skill. Practice it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;On what companies actually look for:&lt;/strong&gt;&lt;br&gt;
One CTO put it plainly: &lt;em&gt;"I can teach almost any technical skill in six months. I cannot teach curiosity, ownership, or the ability to sit with ambiguity without panicking."&lt;/em&gt; The traits that get you through the door are trainable. The traits that get you promoted are harder to fake. Know which you're developing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;On sneaking into the job market:&lt;/strong&gt;&lt;br&gt;
This is the part that felt almost too honest. Multiple speakers talked about the myth of the "perfect application" — that idea that you need every checkbox ticked before you apply. One founder said she'd hired some of her best engineers because they reached out directly, had done homework on the company's actual problems, and proposed a specific idea for how they could help. Cold. Unsolicited. Hired.&lt;/p&gt;

&lt;p&gt;The lesson: &lt;strong&gt;the formal application pipeline is one path, not the only path.&lt;/strong&gt; GitHub contributions to projects a company uses. Public writing about problems in their domain. A cold email with a specific, well-researched observation. These are not shortcuts — they're alternate routes that most candidates never take because they require more initiative.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;On positioning yourself:&lt;/strong&gt;&lt;br&gt;
A PM who'd hired across multiple companies offered a framing I've used since: &lt;em&gt;think of your resume not as a history of what you've done, but as a prediction of what you'll do next.&lt;/em&gt; Every line should answer the implicit question: "Why is this person the right bet for where we're going?"&lt;/p&gt;

&lt;p&gt;Build From Here didn't give me a job. It gave me a map of how the game is actually played — and the confidence to play it intentionally rather than just hoping to get lucky.&lt;/p&gt;




&lt;h2&gt;
  
  
  Event 4: Africa Free Routing — Bitcoin, the Lightning Network, and Building for Your Continent
&lt;/h2&gt;

&lt;p&gt;I'll be honest again: I almost skipped this one too.&lt;/p&gt;

&lt;p&gt;"Bitcoin developer bootcamp" felt far from where I was focused. I was deep in Go backends, API design, concurrency — the usual Zone01 territory. What did I need with wallets and mining?&lt;/p&gt;

&lt;p&gt;Everything, as it turns out.&lt;/p&gt;

&lt;p&gt;Africa Free Routing is, in their own words, a network of lightning nodes across Africa — built by Bitcoiners who believe that the Lightning Network can do for payments in Africa what mobile money did a decade ago, but faster, cheaper, and without the gatekeeping. Their five-day developer bootcamp in Kisumu was one of the most technically dense and philosophically rich experiences I've had.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Day one: what Bitcoin actually is.&lt;/strong&gt; Not the price. Not the hype. The protocol. How transactions are constructed, signed, and broadcast. How the blockchain actually works as a data structure. And why, in a continent where a significant percentage of the population remains unbanked or underbanked, a permissionless, programmable money layer is not an abstract concept — it's infrastructure.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Lightning Network&lt;/strong&gt; was where things got deeply interesting for a backend developer. The Lightning Network is Bitcoin's Layer 2 — a system of payment channels that let two parties transact off-chain at high speed and extremely low cost, settling to the main chain only when they need to. Building on Lightning means thinking about channel capacity, routing, node management, and liquidity — problems that are architecturally fascinating and genuinely unsolved at scale in Africa.The bootcamp wasn't just teaching you about Bitcoin. It was recruiting you into building the infrastructure that doesn't exist yet.&lt;/p&gt;

&lt;p&gt;By day three, we were creating wallets, managing channels, and by day four, exploring how to build applications — payment systems, micropayment platforms, remittance tools — on top of the Lightning stack.&lt;/p&gt;

&lt;p&gt;The insight that landed hardest wasn't technical. It was strategic. The Afrobitcoin Fellowship and organisations like Btrust Builders and Chaincode Labs are actively backing developers and enthusiasts building in the African Bitcoin space — and the talent pool is still very thin. Thin talent pool in a growing, well-funded ecosystem means &lt;strong&gt;opportunity&lt;/strong&gt;. The developers who understand this infrastructure deeply, who know how to connect M-Pesa flows to Lightning channels, who can build custody solutions that work on 2G — those developers are not competing against the global market. They're building the market.&lt;/p&gt;

&lt;p&gt;I left with a working Lightning wallet, a GitHub repo with a basic payment app skeleton, and a radically expanded sense of what "backend development" could mean.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Thread Connecting All Four
&lt;/h2&gt;

&lt;p&gt;Step back and look at these four events together, and a single story emerges:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Cursor/Claude hackathon&lt;/strong&gt; told me that the craft of software engineering is changing faster than most of us have admitted. The developers who survive and thrive will be the ones who learn to think in systems and workflows, not just functions and files.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Nation.dev&lt;/strong&gt; told me that the global market is brutal and honest: AI is compressing the value of generic technical skill, and the developers who win will be the ones who combine technical ability with deep domain knowledge — particularly the kind of domain knowledge that comes from living in Africa and understanding African markets.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Build From Here&lt;/strong&gt; gave me the tactical layer — the unfiltered view of how hiring actually works, how to position myself, and how to take the initiative instead of waiting for permission.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Africa Free Routing&lt;/strong&gt; showed me an entire frontier — financial infrastructure, Bitcoin, the Lightning Network — where skilled developers are scarce, the problems are real, and the impact potential is enormous.&lt;/p&gt;

&lt;p&gt;None of these insights came from a course. None of them came from a YouTube video, a Twitter thread, or a dev.to article. They came from being in a room with people who were building real things and were willing to be honest about it.&lt;/p&gt;




&lt;p&gt;The best career guidance I've ever received didn't come from a mentor sitting across a table, telling me what to do. It came from showing up, slightly unsure, to a room full of people who were a few steps ahead — and paying attention.&lt;/p&gt;

&lt;p&gt;Go to the event. Especially the one you almost didn't.&lt;/p&gt;




</description>
      <category>productivity</category>
      <category>career</category>
      <category>software</category>
      <category>learning</category>
    </item>
    <item>
      <title>I Built a TCP Chat Server in Go Before I Understood Concurrency — Here's What Taught Me Goroutines, Channels, and Mutexes.</title>
      <dc:creator>Ryan Kelly</dc:creator>
      <pubDate>Fri, 05 Jun 2026 19:04:17 +0000</pubDate>
      <link>https://dev.to/rykelly/i-built-a-tcp-chat-server-in-go-before-i-understood-concurrency-heres-what-taught-me-goroutines-1ggd</link>
      <guid>https://dev.to/rykelly/i-built-a-tcp-chat-server-in-go-before-i-understood-concurrency-heres-what-taught-me-goroutines-1ggd</guid>
      <description>&lt;p&gt;&lt;em&gt;How building a Net-Cat clone became my crash course in Go concurrency.&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Where It Started
&lt;/h2&gt;

&lt;p&gt;When I first received the Net-Cat project, I thought it sounded pretty straightforward: build a TCP chat server, allow multiple clients to connect, let users choose usernames, broadcast messages, store chat history, and display join and leave notifications.&lt;/p&gt;

&lt;p&gt;Simple enough, right? Not quite.&lt;/p&gt;

&lt;p&gt;At the time, I knew some Go. I could write functions, work with structs, create packages, and build basic applications. What I didn't understand was concurrency.&lt;/p&gt;

&lt;p&gt;I had heard people talk about it constantly — "Go is great because of concurrency," "use goroutines," "channels are amazing," "watch out for race conditions." I had heard all of those phrases. The problem was that if someone had stopped me and asked:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;em&gt;"What exactly is a goroutine?"&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;"Why would you use a channel?"&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;"What problem does a mutex solve?"&lt;/em&gt;
I wouldn't have had a good answer. Building this chat server changed that.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This wasn't just a networking project. It became the project that finally made Go's concurrency model click for me.&lt;/p&gt;




&lt;h2&gt;
  
  
  The First Question I Had to Answer
&lt;/h2&gt;

&lt;p&gt;Before thinking about goroutines, channels, or mutexes, I had to answer a simpler question: how should the application be structured?&lt;/p&gt;

&lt;p&gt;After several redesigns, I landed on this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.
├── main.go
├── server/
│   ├── server.go
│   ├── client.go
│   ├── room.go
│   ├── hub.go
│   ├── message.go
│   └── format.go
└── utils/
    └── ascii.go
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Looking at this now, it seems obvious. It definitely wasn't obvious while building it. The architecture only emerged after I started running into problems — and those problems are what taught me concurrency.&lt;/p&gt;




&lt;h2&gt;
  
  
  Concurrency Was Just a Buzzword Until This Project
&lt;/h2&gt;

&lt;p&gt;Before this project, concurrency felt like one of those concepts everyone talks about but nobody explains in a way that sticks.&lt;/p&gt;

&lt;p&gt;Then I started thinking about my server. If one client connects and starts chatting, what happens when another client connects? And another? And another? Surely the server can't just stop talking to one client every time a new one arrives.&lt;/p&gt;

&lt;p&gt;That was the first time I encountered a real concurrency problem: multiple things needed to happen at the same time. That's where goroutines entered the picture.&lt;/p&gt;




&lt;h2&gt;
  
  
  What Is a Goroutine?
&lt;/h2&gt;

&lt;p&gt;The simplest explanation I can give: &lt;strong&gt;a goroutine is a lightweight task that runs independently.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Without goroutines, a program typically runs one instruction after another:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Do A → Do B → Do C → Done
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But a chat server doesn't work like that. A chat server has many users connected simultaneously, each able to send messages whenever they want. If the server handled one client at a time, everybody else would be stuck waiting.&lt;/p&gt;

&lt;p&gt;Instead:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;go&lt;/span&gt; &lt;span class="n"&gt;handleClient&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;conn&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That single keyword — &lt;code&gt;go&lt;/code&gt; — creates a new goroutine. Now each client gets its own independent execution flow:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Server
 ├── Client 1
 ├── Client 2
 ├── Client 3
 └── Client 4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The moment I understood this, something clicked. The server wasn't one program anymore. It was lots of little workers running concurrently.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Moment Goroutines Became Real
&lt;/h2&gt;

&lt;p&gt;One of the biggest realizations came when implementing clients. Every client ended up needing two goroutines — one for reading messages, one for writing messages.&lt;/p&gt;

&lt;p&gt;At first I thought: &lt;em&gt;"Why two?"&lt;/em&gt; Then I realized both operations block. Reading blocks while waiting for user input. Writing blocks while waiting for outgoing messages. Those are completely independent activities.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;go&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Read&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="k"&gt;go&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Write&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now both can happen simultaneously. The client can receive messages while also sending them. That sounds obvious now. It wasn't obvious to me then.&lt;/p&gt;




&lt;h2&gt;
  
  
  What Is a Channel?
&lt;/h2&gt;

&lt;p&gt;The best explanation I found: &lt;strong&gt;a channel is a pipe/pathway&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;One goroutine puts data in. Another goroutine takes data out.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="n"&gt;messages&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="nb"&gt;make&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;chan&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c"&gt;// Send&lt;/span&gt;
&lt;span class="n"&gt;messages&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;-&lt;/span&gt; &lt;span class="s"&gt;"Hello"&lt;/span&gt;

&lt;span class="c"&gt;// Receive&lt;/span&gt;
&lt;span class="n"&gt;msg&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;-&lt;/span&gt;&lt;span class="n"&gt;messages&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The sender doesn't need to know who's receiving. The receiver doesn't need to know who's sending. The channel sits between them — like a mailbox:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Sender → Channel → Receiver
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  How Channels Powered My Chat Rooms
&lt;/h2&gt;

&lt;p&gt;Once I understood channels, the room architecture started making sense. A room wasn't just storing data — it was receiving events.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="n"&gt;Room&lt;/span&gt; &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;broadcast&lt;/span&gt; &lt;span class="k"&gt;chan&lt;/span&gt; &lt;span class="n"&gt;Message&lt;/span&gt;
    &lt;span class="n"&gt;join&lt;/span&gt;      &lt;span class="k"&gt;chan&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;Client&lt;/span&gt;
    &lt;span class="n"&gt;leave&lt;/span&gt;     &lt;span class="k"&gt;chan&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;Client&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Suddenly everything became event-driven:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="n"&gt;room&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;join&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;-&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;      &lt;span class="c"&gt;// Client joins&lt;/span&gt;
&lt;span class="n"&gt;room&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;leave&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;-&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;     &lt;span class="c"&gt;// Client leaves&lt;/span&gt;
&lt;span class="n"&gt;room&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;broadcast&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;-&lt;/span&gt; &lt;span class="n"&gt;msg&lt;/span&gt;    &lt;span class="c"&gt;// New message arrives&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The room simply listens for events:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;Room&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;Run&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;select&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;-&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;join&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;
            &lt;span class="c"&gt;// handle join&lt;/span&gt;

        &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;-&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;leave&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;
            &lt;span class="c"&gt;// handle leave&lt;/span&gt;

        &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="n"&gt;msg&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;-&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;broadcast&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;
            &lt;span class="c"&gt;// handle message&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Before this project, &lt;code&gt;select&lt;/code&gt; looked like weird Go syntax. After building the room system, it finally made sense. The room wasn't constantly checking for work — it was sleeping until something happened, waking up to handle it, then waiting again.&lt;/p&gt;

&lt;p&gt;That was probably my first real "aha" moment with channels.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Bug That Taught Me About Blocking
&lt;/h2&gt;

&lt;p&gt;Then I hit a very important bug. My first broadcast implementation looked like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="k"&gt;range&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Clients&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Send&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;-&lt;/span&gt; &lt;span class="n"&gt;msg&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Looks fine, and it worked — until I started thinking about slow clients. What if somebody stops reading messages? Eventually their channel fills up. Then this line blocks. And once it blocks, the room blocks, the broadcasts block, and the entire chat freezes.&lt;/p&gt;

&lt;p&gt;One slow client could affect everyone.&lt;/p&gt;

&lt;p&gt;The solution:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="k"&gt;range&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Clients&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;select&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Send&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;-&lt;/span&gt; &lt;span class="n"&gt;msg&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;default&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;
        &lt;span class="nb"&gt;close&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Send&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="nb"&gt;delete&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Clients&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now one problematic client can't bring down the entire room. This taught me an important lesson: &lt;strong&gt;concurrent systems must be designed around the possibility that things will fail.&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Then I Met My First Race Condition
&lt;/h2&gt;

&lt;p&gt;At this point I thought channels solved everything. They didn't.&lt;/p&gt;

&lt;p&gt;The Hub stored rooms:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="n"&gt;Hub&lt;/span&gt; &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;rooms&lt;/span&gt; &lt;span class="k"&gt;map&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;Room&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Imagine: Client A creates a room, Client B reads a room, and Client C deletes a room — all simultaneously. Multiple goroutines touching the same data. This is called a &lt;strong&gt;race condition&lt;/strong&gt;, and that's where mutexes entered my life.&lt;/p&gt;




&lt;h2&gt;
  
  
  What Is a Mutex?
&lt;/h2&gt;

&lt;p&gt;The simplest explanation: &lt;strong&gt;a mutex is a lock.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Think of a bathroom key. If one person has it, everyone else waits. When they're done, they return it, and someone else can enter.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="n"&gt;mu&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Lock&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;rooms&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"general"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;room&lt;/span&gt;
&lt;span class="n"&gt;mu&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Unlock&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;While the lock is held, nobody else can modify the shared data. This prevents corruption and inconsistent state.&lt;/p&gt;




&lt;h2&gt;
  
  
  How Mutexes Saved My Hub
&lt;/h2&gt;

&lt;p&gt;The Hub became the single source of truth for rooms:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="n"&gt;Hub&lt;/span&gt; &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;rooms&lt;/span&gt; &lt;span class="k"&gt;map&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;Room&lt;/span&gt;
    &lt;span class="n"&gt;mu&lt;/span&gt;    &lt;span class="n"&gt;sync&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;RWMutex&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Whenever rooms were created or modified:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="n"&gt;h&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;mu&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Lock&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="k"&gt;defer&lt;/span&gt; &lt;span class="n"&gt;h&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;mu&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Unlock&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Whenever rooms were simply being read:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="n"&gt;h&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;mu&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;RLock&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="k"&gt;defer&lt;/span&gt; &lt;span class="n"&gt;h&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;mu&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;RUnlock&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Before this project, mutexes felt mysterious. After this project, they felt practical. They solve a very specific problem: &lt;strong&gt;protecting shared data.&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  The Mental Model That Finally Clicked
&lt;/h2&gt;

&lt;p&gt;This is the explanation I wish someone had given me at the beginning:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Need multiple things happening at once?  →  Use Goroutines
Need goroutines to communicate?          →  Use Channels
Need to protect shared data?             →  Use Mutexes
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For a long time I treated these as separate, unrelated concepts. They're actually different tools solving different parts of the same problem.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Hub: My Biggest Architectural Lesson
&lt;/h2&gt;

&lt;p&gt;One thing I learned that had nothing to do with syntax was &lt;strong&gt;ownership&lt;/strong&gt;. Initially the server managed rooms, and that became messy very quickly. Eventually I introduced a Hub, which became solely responsible for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Creating rooms&lt;/li&gt;
&lt;li&gt;Finding rooms&lt;/li&gt;
&lt;li&gt;Moving clients between rooms&lt;/li&gt;
&lt;li&gt;Cleaning up rooms
Nothing else could do those things. Everything went through the Hub.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The lesson was simple: &lt;strong&gt;when many parts of a system need access to something, create one source of truth.&lt;/strong&gt; It makes concurrent systems much easier to reason about.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Import Cycle That Taught Me About Package Design
&lt;/h2&gt;

&lt;p&gt;At one point I accidentally created this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;server → utils
utils  → server
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Go immediately refused to compile:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import cycle not allowed
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At first this was frustrating. Then I realized Go was protecting me. The formatter belonged next to the &lt;code&gt;Message&lt;/code&gt; type, not in &lt;code&gt;utils&lt;/code&gt;. Moving it into the server package solved everything.&lt;/p&gt;

&lt;p&gt;Sometimes compiler errors are actually architecture lessons.&lt;/p&gt;




&lt;h2&gt;
  
  
  Testing Changed How I Thought About Code
&lt;/h2&gt;

&lt;p&gt;The race detector was one of the most useful tools I discovered:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;go &lt;span class="nb"&gt;test&lt;/span&gt; &lt;span class="nt"&gt;-race&lt;/span&gt; ./...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It caught problems I didn't even know existed. Running with &lt;code&gt;-race&lt;/code&gt; has become automatic whenever I'm working on concurrent code. If you're learning Go concurrency, use it early — it will save you hours.&lt;/p&gt;




&lt;h2&gt;
  
  
  Concurrency Cheat Sheet
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Tool&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;th&gt;Mental model&lt;/th&gt;
&lt;th&gt;Example&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Goroutine&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Run work concurrently&lt;/td&gt;
&lt;td&gt;A lightweight worker&lt;/td&gt;
&lt;td&gt;&lt;code&gt;go handleClient(conn)&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Channel&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Allow goroutines to communicate&lt;/td&gt;
&lt;td&gt;A pipe or mailbox&lt;/td&gt;
&lt;td&gt;&lt;code&gt;messages &amp;lt;- msg&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Mutex&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Protect shared data&lt;/td&gt;
&lt;td&gt;A lock on a door&lt;/td&gt;
&lt;td&gt;&lt;code&gt;mu.Lock(); defer mu.Unlock()&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  What I Know Now That I Didn't Know Then
&lt;/h2&gt;

&lt;p&gt;When I started this project, concurrency was just a word I heard experienced developers use. I didn't know what goroutines actually were. I didn't understand channels. I had never used a mutex.&lt;/p&gt;

&lt;p&gt;By the end, those concepts weren't just definitions anymore — they were solutions to problems I had personally encountered:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Goroutines helped me handle multiple clients simultaneously.&lt;/li&gt;
&lt;li&gt;Channels helped components communicate safely.&lt;/li&gt;
&lt;li&gt;Mutexes protected shared state from corruption.
Most importantly, I learned that concurrency isn't really about goroutines or channels. It's about &lt;strong&gt;coordination&lt;/strong&gt; — deciding who owns data, how information flows, and what happens when something goes wrong.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Building this chat server didn't just teach me how to write concurrent Go code. It taught me &lt;em&gt;why&lt;/em&gt; those concurrency tools exist in the first place. And that's a lesson I don't think I would have learned from a tutorial alone.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Built during my Go learning journey at Zone01 Kisumu, Kenya. If you're learning Go and concepts like goroutines, channels, and mutexes still feel abstract — build something that forces multiple things to happen at the same time. For me, this chat server was the project that finally made everything click.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>programming</category>
      <category>beginners</category>
      <category>software</category>
      <category>learning</category>
    </item>
  </channel>
</rss>
