<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Naim Sakaamini on Medium]]></title>
        <description><![CDATA[Stories by Naim Sakaamini on Medium]]></description>
        <link>https://medium.com/@naim_70870?source=rss-bb248785ec85------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*1ZcWEOOaGV4CHdlLBUkguA.jpeg</url>
            <title>Stories by Naim Sakaamini on Medium</title>
            <link>https://medium.com/@naim_70870?source=rss-bb248785ec85------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 20:04:40 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@naim_70870/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How We Built a Real-Time Card Authorization System (<1s) to Fight Fraud and Empower Users]]></title>
            <link>https://medium.com/relay-financial/how-we-built-a-real-time-card-authorization-system-1s-to-fight-fraud-and-empower-users-9977cfbef897?source=rss-bb248785ec85------2</link>
            <guid isPermaLink="false">https://medium.com/p/9977cfbef897</guid>
            <dc:creator><![CDATA[Naim Sakaamini]]></dc:creator>
            <pubDate>Thu, 10 Apr 2025 14:49:54 GMT</pubDate>
            <atom:updated>2025-04-10T14:49:54.796Z</atom:updated>
            <content:encoded><![CDATA[<p>Card payments demand an approve/decline decision in under 1 second. Failing to meet this, means losing the opportunity to apply crucial intelligence and risk giving a pass to fraudulent transactions or blocking legitimate customer spending. Relay built a system, Card Authorization Controls <strong>(CAC)</strong>, that plugs directly into this critical moment. Handling thousands of transactions per day, it evaluates complex rule sets, detects fraud patterns, enforces user-defined spending controls, and performs just-in-time fund transfers, all within a latency budget typically under 700ms end-to-end. This article details the architecture, technical decisions, performance, and challenges involved.</p><h3>Core Capabilities:</h3><p>The system translates security policies and user preferences into real-time actions:</p><ul><li><strong>Real-Time Fraud Prevention<br></strong>The system checks every transaction against rules defined by our Risk team, using an internal rules engine. We chose a rule-based approach over pure machine learning for predictability and full control. These rules look at transaction details like amount, merchant, category code, geographic data, location, payment type, time-of-day patterns, and known fraud lists. Enriched data from our enrichment service provides cleaner signals, such as verified merchant names and categories. The engine processes multiple fraud and policy rules per transaction, typically staying within a 100ms budget in the handler.</li><li><strong>User-Defined Spend Controls<br></strong>Users can set up their own spending rules through our application, such as blocking transactions in the gambling category, allowing only grocery store purchases, or setting a limit for single transactions over $1000. These preferences are stored in the rule definition database, loaded into the fast in-memory rule cache with a write-through caching policy, and evaluated alongside risk rules during the authorization flow. This setup ensures user-defined controls are applied instantly when a transaction is being processed.</li><li><strong>Just-in-Time Fund Sweeps<br></strong>Sometimes, valid transactions fail because the card’s primary account doesn’t have enough funds, even though the customer has money in another account. To prevent this, we use pre-configured rules that let users specify a sweep account. When the system detects insufficient funds, the handler makes a real-time API call to check the balance of the sweep account. If there’s enough to cover the transaction, the system instantly moves funds between the accounts and proceeds to approve the original authorization request. This flow adds a few critical steps but stays within our latency budget, helping avoid unnecessary declines while keeping the experience seamless for the customer.</li></ul><h3>System Architecture:</h3><p>The architecture prioritizes low latency on the critical synchronous path while offloading other tasks asynchronously.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xWQPU79dAkbSp31i2bmALg.png" /><figcaption>System Architecture</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wg1NvqBsWtM9wvQBAwl7rQ.png" /><figcaption>A step-by-step view of how a card transaction flows through our system, from authorization event to decision and post-processing.</figcaption></figure><h3>Authorization Request Handler:</h3><p>This stateless compute service is the core orchestrator. We went with stateless to enable easy horizontal auto scaling under unpredictable transaction spikes. Key considerations:</p><p><strong>Latency Budget Breakdown (Typical Target: p99 &lt; 700ms):</strong></p><ul><li>Network/Request Validation: ~50ms</li><li>Cache Read (Rules): ~25ms</li><li>Enrichment Service Call: ~200ms ****</li><li>Rules Engine Execution: ~75ms</li><li>Banking API Calls (Balance Check/Sweep): ~300ms</li><li>Response Generation/Queueing/Network: ~75ms</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z9OJdRZF9ARVUrknpdjkQw.png" /><figcaption>Latency breakdown of a typical authorization request, showing critical steps within the sub-second</figcaption></figure><p><strong>Fallbacks, Latency Management, and Failure Handling</strong></p><ul><li>To stay within our tight latency target, we design all paths for fast failover and fallback.</li><li>Cache warming and maintenance keep misses extremely rare. On miss, the handler falls back to the rule definition database.</li><li>If the enrichment service does not respond within the timeout, the handler continues with raw merchant data. In these cases, the Rules Engine relies on smart string matching to compare merchant names. (More on this in the next section.)</li><li>Internal errors are caught centrally. If recovery isn’t possible within latency budget, we return a fail-safe decision and trigger alerts.</li><li>Asynchronous tasks (logging, downstream processing) use retries and dead-letter queues. These failures do not impact the critical decision path.</li></ul><h3>The Rules Engine &amp; Smart Matching</h3><p>Our custom Rules Engine processes transaction facts and runs prioritized rules to reach a decision.</p><p>When enrichment completes, the engine uses clean merchant data. If enrichment times out, we switch to smart string matching inside the Rules Engine to still evaluate merchant name conditions reliably.</p><p>For example:</p><ul><li>Rule: Block transactions at <strong>“</strong>Starbucks Coffee<strong>”</strong></li><li>Raw merchant name: <em>“sq* STRBX-45ic”</em></li><li>Smart matching evaluates using: Levenshtein Distance, Jaro-Winkler Similarity, and Phonetic matching</li><li>These scores feed into a logistic regression model, which weighs each algorithm’s output to compute a confidence score.</li><li>If the score exceeds our threshold, the rule evaluates to true, and the transaction is blocked.</li></ul><p>The logistic regression model is trained on labeled data of matches and mismatches to learn the best weightings for different string patterns. This balances precision and recall, ensuring robust matches even when transaction data is messy.</p><h3>Monitoring &amp; Alerting</h3><p>Monitoring is tightly integrated at every layer:</p><ul><li>Critical path latency is monitored at each step (cache read, enrichment, fund sweep, response time). Alerts trigger if we breach thresholds.</li><li>All fallback activations are logged and monitored. High-frequency fallback patterns trigger alerts for investigation.</li><li>Internal errors and dependency failures are captured centrally with alerts sent to engineering and risk teams.</li><li>We monitor decision logs and compare expected versus actual outcomes to catch mismatches early.</li></ul><h3>Conclusion: Performance at Scale, Decisions at Speed</h3><p>CAC processes real-time payment flows under extreme latency constraints, handling complex rules and risk evaluations in under a second. The system operates continuously at high scale, with the following results:</p><ul><li>Processes <strong>~30,000</strong> authorization requests per day, load tested to sustain 250,000+ with provisioned concurrency.</li><li>Contributes to a <strong>~$100,000</strong> reduction in card-related fraud per month.</li><li>Evaluates <strong>~5,000</strong> transactions per month against user-defined spend controls.</li><li>Enables <strong>~$85,000</strong> in card spend per week through automated fund sweeps</li><li>Evaluates an average of <strong>~50</strong> rules per transaction, including fraud controls, and user-defined preferences.</li><li>Achieves <strong>p99 of ~450ms</strong> from request to response, across thousands of concurrent transactions.</li><li>Maintains <strong>99.9X%</strong> availability for authorization decisions.</li></ul><p>The core trade-off remains balancing rule complexity and feature depth against our sub-second SLA. Through tight engineering, strict latency budgeting, and robust fallback mechanisms, we ensure decisions happen fast, reliably, and at scale.</p><p>If you’re excited about building high-scale high-impact systems like this, take a look at our open roles. we’re always looking for great engineers.<br><a href="https://jobs.ashbyhq.com/relayfi?departmentId=484e1c05-7fe1-482b-a28a-c1ef0b119fda">https://jobs.ashbyhq.com/relayfi?departmentId=484e1c05-7fe1-482b-a28a-c1ef0b119fda</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9977cfbef897" width="1" height="1" alt=""><hr><p><a href="https://medium.com/relay-financial/how-we-built-a-real-time-card-authorization-system-1s-to-fight-fraud-and-empower-users-9977cfbef897">How We Built a Real-Time Card Authorization System (&lt;1s) to Fight Fraud and Empower Users</a> was originally published in <a href="https://medium.com/relay-financial">Relay Financial</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How We 20x’d (so far) Our Deploys To Production]]></title>
            <link>https://medium.com/relay-financial/how-we-20xd-so-far-our-deploys-to-production-e1c16bbb1201?source=rss-bb248785ec85------2</link>
            <guid isPermaLink="false">https://medium.com/p/e1c16bbb1201</guid>
            <category><![CDATA[trunk-based-development]]></category>
            <category><![CDATA[continuous-integration]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[continous-delivery]]></category>
            <dc:creator><![CDATA[Naim Sakaamini]]></dc:creator>
            <pubDate>Thu, 13 Mar 2025 12:37:45 GMT</pubDate>
            <atom:updated>2025-03-13T12:54:19.352Z</atom:updated>
            <content:encoded><![CDATA[<p>There was a time at Relay when shipping to production used to be a deliberate and time-consuming process. We’d deploy 5–7 times a week, carefully coordinating across teams, resolving merge conflicts, and waiting for QA to give the green light. While it worked, there was plenty of room to make it faster, smoother, and less stressful.</p><p>Today, we’re shipping over 100 times a week, a massive leap from our old pace. We’re not bundling huge features; we’re delivering small, independently shippable pieces that let us test, iterate, and learn without piling on risk.</p><p>This transformation didn’t happen overnight. It took a deliberate effort to accelerate our learning by changing how we work and levelling up our deployment machinery, making continuous delivery not just possible, but sustainable.</p><p>In this article, we’ll explore:</p><ol><li><strong>The mindset shift:</strong> how we moved from big, risky releases to fast, iterative deployments.</li><li><strong>The technical upgrades:</strong> from automation to observability, the systems that power our speed.</li><li>How this played out with a real release</li></ol><p>Let’s dive in and share what we learned along the way.</p><p>Where we started: Just over 6 deployments per week before we transformed our process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JLVQGFFC-G0fTO1pT2qreQ.png" /><figcaption><strong>(September 2024 – 5 deployments per week)</strong></figcaption></figure><p>Our current deployment frequency: Shipping at scale with over 95 deploys per week.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fGPvTW3e6-6YoR8Susd4eg.png" /><figcaption><strong>After (February 2025–101 deployments per week)</strong></figcaption></figure><h3>The mindset shift - Changing How We Work: Smaller, Smarter, Faster</h3><h3>From “Big Bang” Releases to Vertical Slices</h3><p>Previously, we’d batch features into massive, all-or-nothing releases. One bug could hold everything hostage, delaying launches and impacting multiple teams. Merge conflicts ran rampant, QA cycles dragged on, and by the time we shipped, we were already behind on our next milestone.</p><p>Now, we work in small, independently deployable slices, each gated by a feature flag. This lets us merge to production early and often, reducing risk while increasing flexibility. This shift has led to shorter release cycles, fewer merge conflicts, and Faster, real-world feedback so we can validate through usage rather than assumptions.</p><p>This required a shift in how we collaborate. Engineers and PMs now focus on defining the smallest valuable slice, iterating rapidly instead of over-planning. Deployments are no longer treated as major events but as part of our daily engineering rhythm. Each engineer integrates code at least once every 24 hours, keeping everything in sync.</p><p>This isn’t just a process change; it’s a cultural shift. We think in deployable units, embrace iterative improvements, and trust that shipping frequently is actually safer than shipping rarely.</p><p>It could feel daunting for members of the team who were previously going through a longer cycle to one where they are shipping multiple times a day. As we continue to expand our test automation, the automated safety net for every deploy gets stronger and stronger. As each change hitting production is smaller in scope, the levels of risk ultimately fall. A small, well focused PR is much easier to review and get confidence that the change is safe to immediately deploy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7OI0ScRLGCaJQ4nM6vCIzA.png" /><figcaption><em>Before: large batch releases with hundreds of changes.</em></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cIfy81PotuBq-nHh4F9DyQ.png" /><figcaption><em>After: small, focused, and quickly merged.</em></figcaption></figure><h3>The Technical Upgrades - Enhancing Our Delivery Machinery</h3><h3>1. Trunk-Based Development, the PR template, and the Merge Queue</h3><p>We moved away from long-lived feature branches to a trunk-based model, merging small changes into the trunk branch early and often. Each PR follows a standardize template acting like a checklist that ensures we cover all the essentials: the type of change, what changed, why it matters, how it was tested. Then spins up an ephemeral preview environment, a sandbox for quick QA and smoke tests. Once validated, the PR heads to our Merge Queue, which acts like a traffic controller where only changes that pass automated checks get merged, ensuring our trunk stays stable and release-ready.</p><h3>2. Fully Automated Deployments</h3><p>Once a PR is merged, our pipeline does the heavy lifting:</p><ol><li>Builds a fresh container image.</li><li>Runs all tests in parallel to confirm nothing’s broken.</li><li>Rolls Out the updated pods to our Kubernetes cluster if everything looks good.</li></ol><h3>3. Feature Flags</h3><p>When we need to ship a feature before it’s entirely ready, or gradually release it to a fraction of your user base. That’s where feature flags shine. We deploy code in a dormant state and flip the switch only when we’re confident. If there’s a hiccup, we flip it right back off without the need to block or roll back the entire release.</p><h3>4. Post-Deployment Monitoring &amp; Observability</h3><p>Shipping faster means spotting issues faster. Our observability stack includes real-time dashboards for performance metrics, error rates, and more. We also use automated alerts to instantly notify the right teams in Slack, often before customers notice any hiccup. This setup ensures we maintain our speed without sacrificing reliability.</p><h3>5. Streamlined Database Migration Process</h3><p>Databases can be a sticking point in continuous delivery, so we overhauled our migration process. By automating each step and ensuring backward compatibility, we can release schema updates independently of application changes.</p><h3>Changes in Action</h3><p>The team applied these new ways of working while building out a more comprehensive spend management product for our users. A key factor in the smooth GA release was the team’s shift towards shipping smaller, more frequent changes, which was enabled by a stronger trunk-based development approach. Because we weren’t blocked by staging freezes, we could continuously merge and deploy updates, reducing bottlenecks and enable to iterate quickly. Standardizing ticket descriptions improved clarity, and stronger alignment between engineering and product meant we had a clear understanding of what we were shipping and when. This kept momentum and morale high. Rather than working towards a single, large release, we made steady progress with multiple, well-defined milestones.</p><p>Another important aspect was keeping the scope in check. With a stable goalpost, the team could stay focused and systematically review remaining work every day. A bug bash in the end also played a big role in raising confidence and reducing risk ahead of GA, and having embedded QA helped accelerate testing while maintaining quality. Altogether, these practices made our release process more predictable and efficient. All on the shoulders of our drive to accelerate learning.</p><h3>Key Takeaways</h3><p>This wasn’t about going fast just for the sake of it. We focused on real impact, measuring DORA metrics to track improvements and continuously refine our approach.</p><p>More than anything, this was about learning faster. By deploying in small, safe increments and automating everything we could, we gave ourselves the freedom to experiment, gather feedback, and improve.</p><p>We didn’t flip a switch overnight. Just like we aimed to ship faster and learn from users, we took the same approach internally. Starting small, gathering feedback, and refining as we went.</p><p>Along the way, we had some challenges, as well as some existing support pushing us forward:</p><ul><li>Our CI/CD pipeline wasn’t built for this pace. <br><strong>Fix:</strong> We optimized builds, parallelized tests, and introduced a merge queue.</li><li>Some team members were worried that daily deploys would be risky. <strong>Fix:</strong> We shared data, ran training sessions, and gradually rolled it out.</li><li>More deployments meant faster failures. <br><strong>Fix:</strong> We improved observability with real-time alerts and log aggregation.</li><li>We had an existing set of automated tests which we could rely upon as a safety net, but we also ensured each team had a dedicated QA team member, as we also increased our automated safety net.</li></ul><p>Each step made the next one easier. Now, shipping daily feels normal and safer than waiting weeks. We’re always improving, and looking to implement deeper automation and smarter observability to make deployments even smoother.</p><p>As we continue to refine and iterate, we expect within a few months that we’ll be shipping well over 200 times per week, with safety.</p><p>If this sounds like the kind of engineering culture you want to be part of, <a href="https://jobs.lever.co/relayfi?department=Engineering">come join us</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UdsDpVB9GIVhr5kwXHAFRg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e1c16bbb1201" width="1" height="1" alt=""><hr><p><a href="https://medium.com/relay-financial/how-we-20xd-so-far-our-deploys-to-production-e1c16bbb1201">How We 20x’d (so far) Our Deploys To Production</a> was originally published in <a href="https://medium.com/relay-financial">Relay Financial</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>