<?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: Abhishek Shekhar</title>
    <description>The latest articles on DEV Community by Abhishek Shekhar (@abhishek_shekhar).</description>
    <link>https://dev.to/abhishek_shekhar</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3842313%2F5945747a-7ddb-43d4-a107-71750f4a4370.jpeg</url>
      <title>DEV Community: Abhishek Shekhar</title>
      <link>https://dev.to/abhishek_shekhar</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/abhishek_shekhar"/>
    <language>en</language>
    <item>
      <title>Building Agentic AI in a Regulated Banking System: What Nobody Tells You</title>
      <dc:creator>Abhishek Shekhar</dc:creator>
      <pubDate>Wed, 25 Mar 2026 02:10:28 +0000</pubDate>
      <link>https://dev.to/abhishek_shekhar/building-agentic-ai-in-a-regulated-banking-system-what-nobody-tells-you-l7f</link>
      <guid>https://dev.to/abhishek_shekhar/building-agentic-ai-in-a-regulated-banking-system-what-nobody-tells-you-l7f</guid>
      <description>&lt;p&gt;&lt;em&gt;By a Backend Lead Engineer | 10+ years building core banking and fintech systems in the UK&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;2,400 words · 11 min read · Intermediate to Senior Engineers&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;If you're building AI agents that touch financial decisions in 2026, the architecture choices you make in the next six months will determine whether you survive your first regulatory audit.&lt;/strong&gt; This is the practical guide — audit logs, guardrails, circuit breakers, EU AI Act compliance, and why you can never let an LLM write directly to financial state.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;📌 &lt;em&gt;Part 2 of a series. If you missed Part 1, start here: &lt;a href="https://dev.to/abhishek_shekhar/fintech-backend-architecture-building-systems-that-dont-break-when-money-is-involved-4fpj"&gt;Fintech Backend Architecture: Building Systems That Don't Break When Money Is Involved&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;Agentic AI in banking is not coming. It's here. Goldman Sachs is running autonomous agents against core trade systems. RBC is projecting a $1B revenue lift. CIBC has deployed AI copilots to 1,700+ engineers.&lt;/p&gt;

&lt;p&gt;And almost every article about it is written for a boardroom, not an engine room.&lt;/p&gt;

&lt;p&gt;This one isn't. This is what it actually takes to architect, trust, audit, and govern an AI agent making financial decisions in a regulated environment.&lt;/p&gt;




&lt;h2&gt;
  
  
  Introduction: Forget the Pilot — You're in Production Now
&lt;/h2&gt;

&lt;p&gt;Here's how most AI-in-banking stories go:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;2024: "We're running an exciting pilot."&lt;/li&gt;
&lt;li&gt;2025: "Our pilot showed promising results."&lt;/li&gt;
&lt;li&gt;2026: "Our agent blocked 40,000 legitimate transactions before anyone noticed."&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That last one doesn't make the press releases. But it happens.&lt;/p&gt;

&lt;p&gt;The shift from pilot to production is where the real engineering starts. And the real engineering looks nothing like the demo.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;The question is no longer "Should we use AI?" — it's "When our AI makes a wrong decision at scale, can we explain it, roll it back, and survive the regulatory review?"&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That's what this article is about.&lt;/p&gt;




&lt;h2&gt;
  
  
  What "Agentic AI in Banking" Actually Means (Not a Chatbot)
&lt;/h2&gt;

&lt;p&gt;I'm not talking about a chatbot that summarises statements.&lt;/p&gt;

&lt;p&gt;I mean a system that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Reads live financial data — transactions, risk signals, account history&lt;/li&gt;
&lt;li&gt;Makes a decision &lt;strong&gt;without a human approving it&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Triggers an action that &lt;strong&gt;changes financial state&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That's the definition. Hold it in your head.&lt;/p&gt;

&lt;p&gt;Here's what that looks like in the wild right now:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Fraud decision agents&lt;/strong&gt; — block or allow a payment in under 200ms&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;KYC/AML agents&lt;/strong&gt; — classify customers, surface suspicious patterns, auto-escalate&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Payment routing agents&lt;/strong&gt; — choose the cheapest, fastest, lowest-risk rail&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Compliance monitoring agents&lt;/strong&gt; — watch every transaction for DORA/FCA violations, continuously&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Credit decision agents&lt;/strong&gt; — approve or decline a lending application&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Every single one of these affects real money and real people.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;And that changes everything about how you build them. A bug in your API returns a 500. A bug in a fraud agent blocks someone's rent payment.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;⚠️ &lt;strong&gt;Real-world lesson:&lt;/strong&gt; The same properties that make an AI agent powerful in banking — speed, scale, autonomy — are exactly the properties that cause catastrophic damage when it goes wrong. Design for failure before you design for success.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Three Problems Nobody Warns You About (Explainability, Non-Determinism, Rollback)
&lt;/h2&gt;

&lt;p&gt;Every conference talk on AI in fintech covers use cases and ROI. Almost none cover these.&lt;/p&gt;

&lt;h3&gt;
  
  
  Problem 1: Explainability Under FCA and EU AI Act — "The Model Decided" Is Not an Answer
&lt;/h3&gt;

&lt;p&gt;Picture this.&lt;/p&gt;

&lt;p&gt;A regulator walks in. Sits down. Slides a sheet of paper across the table.&lt;/p&gt;

&lt;p&gt;"Why did your system block Mr. Ahmed's payment on 14 March?"&lt;/p&gt;

&lt;p&gt;You cannot say: "the model gave it a 0.73 risk score."&lt;/p&gt;

&lt;p&gt;Under the &lt;strong&gt;FCA&lt;/strong&gt;, the &lt;strong&gt;EU AI Act&lt;/strong&gt;, and current UK financial regulation, high-risk AI decisions require documented, human-interpretable explanations. Not attention weights. Not probability distributions. A traceable reasoning chain that a compliance officer can read, understand, and defend.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;This is not a future requirement. It is enforceable now.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Problem 2: LLM Non-Determinism in Fraud Detection — A Compliance Violation Waiting to Happen
&lt;/h3&gt;

&lt;p&gt;LLMs produce different outputs for identical inputs. That's a feature in a creative writing tool. In a fraud detection system, it's a compliance violation waiting to happen.&lt;/p&gt;

&lt;p&gt;If your fraud agent blocked the same transaction on Tuesday that it approved on Monday — identical inputs, different outcome — you have a legal problem.&lt;/p&gt;

&lt;p&gt;You cannot fix this by tuning the model. You fix it by architecting around it. More on that shortly.&lt;/p&gt;

&lt;h3&gt;
  
  
  Problem 3: AI Agent Rollback at Scale — When It Goes Wrong, It Goes Wrong Fast
&lt;/h3&gt;

&lt;p&gt;An AI agent in production doesn't make one bad decision. It makes thousands. Per minute.&lt;/p&gt;

&lt;p&gt;When the model drifts, or a training bug ships, or a fraudster figures out how to game it, you need to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Detect the problem in seconds&lt;/li&gt;
&lt;li&gt;Stop the agent without taking down the payment system&lt;/li&gt;
&lt;li&gt;Reverse affected decisions systematically&lt;/li&gt;
&lt;li&gt;Explain the full blast radius to Risk and Compliance&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;None of this is possible if your AI agent writes directly to financial state.&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;⚠️ &lt;strong&gt;Real-world lesson:&lt;/strong&gt; A fraud model trained on a biased dataset went live on a Friday afternoon. By Saturday morning it had blocked 40% of legitimate transactions from a specific postcode. The rollback took 3 days. The regulatory incident report took 3 weeks. The Friday deployment window was never used again.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  The Architecture Pattern That Solves All Three: Read-Reason-Emit
&lt;/h2&gt;

&lt;p&gt;Here's the pattern. It's not complicated. It's just not obvious until someone tells you.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;The AI agent must never write directly to financial state. It reads, it reasons, it emits a decision. A separate deterministic service executes that decision.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In practice:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[Event Stream]
       |
       ▼
[AI Agent Layer]    ← reads context, NEVER writes financial state
       |
       ▼
[Decision Queue]    ← append-only, immutable, fully auditable
       |
       ▼
[Execution Service] ← deterministic, idempotent, saga-driven
       |
       ▼
[Ledger / Financial State]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Why this works:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The AI agent is &lt;strong&gt;stateless&lt;/strong&gt;. It reads, reasons, and emits. It never mutates anything.&lt;/li&gt;
&lt;li&gt;The Decision Queue is &lt;strong&gt;append-only&lt;/strong&gt;. Immutable. Just like your ledger. Every decision ever made is permanently recorded.&lt;/li&gt;
&lt;li&gt;The Execution Service is &lt;strong&gt;deterministic&lt;/strong&gt;. It applies decisions exactly once, idempotently, with full compensation logic.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rollback is safe.&lt;/strong&gt; Mark the decision as reversed in the queue. Run compensations. Done.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If this looks familiar, it should. It's the same append-only, idempotent, saga-driven pattern from good fintech backend design. The AI is just a new layer at the top.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;⚠️ &lt;strong&gt;Real-world lesson:&lt;/strong&gt; Every team that gave their AI agent direct database write access ended up in an incident. Every single one. Separate the layers. Non-negotiable.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Building an AI Decision Audit Log That Satisfies Regulators
&lt;/h2&gt;

&lt;p&gt;Every AI decision needs a paper trail. Not just the outcome — the complete context that produced it.&lt;/p&gt;

&lt;p&gt;This is the minimum schema that will satisfy an FCA or EU AI Act audit:&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;ai_decision_log&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;decision_id&lt;/span&gt;       &lt;span class="n"&gt;UUID&lt;/span&gt; &lt;span class="k"&gt;PRIMARY&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt; &lt;span class="k"&gt;DEFAULT&lt;/span&gt; &lt;span class="n"&gt;gen_random_uuid&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
  &lt;span class="n"&gt;agent_id&lt;/span&gt;          &lt;span class="nb"&gt;VARCHAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="c1"&gt;-- which agent made this call&lt;/span&gt;
  &lt;span class="n"&gt;model_version&lt;/span&gt;     &lt;span class="nb"&gt;VARCHAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="c1"&gt;-- exact model version (mandatory)&lt;/span&gt;
  &lt;span class="n"&gt;input_hash&lt;/span&gt;        &lt;span class="nb"&gt;VARCHAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;64&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="c1"&gt;-- SHA-256 of the full input context&lt;/span&gt;
  &lt;span class="n"&gt;input_snapshot&lt;/span&gt;    &lt;span class="n"&gt;JSONB&lt;/span&gt;        &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="c1"&gt;-- the FULL input, not a reference&lt;/span&gt;
  &lt;span class="n"&gt;decision&lt;/span&gt;          &lt;span class="nb"&gt;VARCHAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="c1"&gt;-- ALLOW / BLOCK / ESCALATE&lt;/span&gt;
  &lt;span class="n"&gt;confidence&lt;/span&gt;        &lt;span class="nb"&gt;NUMERIC&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;           &lt;span class="c1"&gt;-- 0.0000 to 1.0000&lt;/span&gt;
  &lt;span class="n"&gt;reasoning&lt;/span&gt;         &lt;span class="nb"&gt;TEXT&lt;/span&gt;         &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="c1"&gt;-- plain-English explanation&lt;/span&gt;
  &lt;span class="n"&gt;rules_triggered&lt;/span&gt;   &lt;span class="n"&gt;JSONB&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;                  &lt;span class="c1"&gt;-- every guardrail that fired&lt;/span&gt;
  &lt;span class="n"&gt;execution_id&lt;/span&gt;      &lt;span class="n"&gt;UUID&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;                   &lt;span class="c1"&gt;-- FK to execution service&lt;/span&gt;
  &lt;span class="n"&gt;created_at&lt;/span&gt;        &lt;span class="n"&gt;TIMESTAMPTZ&lt;/span&gt;  &lt;span class="k"&gt;DEFAULT&lt;/span&gt; &lt;span class="n"&gt;NOW&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
  &lt;span class="n"&gt;reviewed_by&lt;/span&gt;       &lt;span class="nb"&gt;VARCHAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;           &lt;span class="c1"&gt;-- human reviewer if escalated&lt;/span&gt;
  &lt;span class="n"&gt;reviewed_at&lt;/span&gt;       &lt;span class="n"&gt;TIMESTAMPTZ&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Three fields that engineers always want to skip. Don't.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;input_snapshot&lt;/strong&gt; — store the full input, not a reference. Data gets mutated. Audit logs must not. If a regulator pulls a 2-year-old decision, you need to show exactly what the agent saw at that moment.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;model_version&lt;/strong&gt; — mandatory, not optional. When your model gets retrained next month, you need to know which decisions were made by which version. This is also how you scope a rollback.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;reasoning&lt;/strong&gt; — human-readable text generated by the agent as part of its output. Not post-hoc rationalisation. Not a confidence score dressed up as an explanation. Enforce this at the API contract.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;⚠️ &lt;strong&gt;Real-world lesson:&lt;/strong&gt; "The model gave it a 0.73 risk score" is not a regulatory explanation. "This transaction was blocked because it exceeded the account's 30-day velocity threshold by 340%, originated from an IP linked to 3 previous fraud reports, and the beneficiary account was opened 6 hours ago" — &lt;em&gt;that&lt;/em&gt; is. Build your agents to produce the second one.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Hard Guardrails, Soft Guardrails, and Circuit Breakers for LLM Agents in Fintech
&lt;/h2&gt;

&lt;p&gt;Guardrails are not suggestions for the AI to consider. They are hard stops that the AI layer never sees.&lt;/p&gt;

&lt;h3&gt;
  
  
  Hard Guardrails — The LLM Never Gets Involved
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// These fire BEFORE the AI agent. If triggered: BLOCK, log, done.&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;hardGuardrails&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;maxSingleTransactionGBP&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="nx"&gt;_000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;maxDailyVolumePerAccount&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="nx"&gt;_000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;sanctionedCountries&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;XX&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;YY&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;       &lt;span class="c1"&gt;// OFAC / HMT list&lt;/span&gt;
  &lt;span class="na"&gt;requiredFields&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;reference&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;beneficiary_name&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
  &lt;span class="na"&gt;minAccountAgeForHighValue&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;            &lt;span class="c1"&gt;// days&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="c1"&gt;// Hard guardrail fires? Block immediately. Don't ask the AI.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Soft Guardrails — The AI Can Override, But It Better Explain Why
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// These fire AFTER the AI decision.&lt;/span&gt;
&lt;span class="c1"&gt;// AI says ALLOW + soft guardrail fires = ESCALATE to human review.&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;softGuardrails&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;velocityMultiplierThreshold&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;3.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;         &lt;span class="c1"&gt;// 3x account's normal monthly volume&lt;/span&gt;
  &lt;span class="na"&gt;newPayeeHighValueThreshold&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="nx"&gt;_000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;        &lt;span class="c1"&gt;// first payment ever to this payee&lt;/span&gt;
  &lt;span class="na"&gt;unusualHours&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;start&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="na"&gt;end&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;       &lt;span class="c1"&gt;// 1am–5am local time&lt;/span&gt;
  &lt;span class="na"&gt;confidenceMinimum&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.80&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;                  &lt;span class="c1"&gt;// AI confidence must clear 80%&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Circuit Breakers — Because AI Models Fail Silently If You Let Them
&lt;/h3&gt;

&lt;p&gt;Your circuit breaker watches the AI's decision pattern in real time. The moment something looks wrong, it yanks the AI out of the loop and routes everything to a deterministic fallback.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Trip conditions — any of these fires the breaker:&lt;/span&gt;
&lt;span class="nx"&gt;blockRateSpike&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;  &lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="mi"&gt;15&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="nx"&gt;block&lt;/span&gt; &lt;span class="nx"&gt;rate&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;minute&lt;/span&gt; &lt;span class="nb"&gt;window&lt;/span&gt;
&lt;span class="nx"&gt;allowRateSpike&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;  &lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="nx"&gt;allow&lt;/span&gt; &lt;span class="nf"&gt;rate &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;could&lt;/span&gt; &lt;span class="nx"&gt;mean&lt;/span&gt; &lt;span class="nx"&gt;model&lt;/span&gt; &lt;span class="nx"&gt;is&lt;/span&gt; &lt;span class="nx"&gt;being&lt;/span&gt; &lt;span class="nx"&gt;gamed&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nx"&gt;latencyBreach&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;   &lt;span class="nx"&gt;P99&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;800&lt;/span&gt;&lt;span class="nf"&gt;ms &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;agent&lt;/span&gt; &lt;span class="nx"&gt;is&lt;/span&gt; &lt;span class="nx"&gt;struggling&lt;/span&gt; &lt;span class="nx"&gt;under&lt;/span&gt; &lt;span class="nx"&gt;load&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nx"&gt;errorRate&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;       &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="nx"&gt;errors&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt; &lt;span class="nx"&gt;seconds&lt;/span&gt;
&lt;span class="nx"&gt;modelDrift&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;      &lt;span class="nx"&gt;decision&lt;/span&gt; &lt;span class="nx"&gt;distribution&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="nx"&gt;sigma&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;day&lt;/span&gt; &lt;span class="nx"&gt;baseline&lt;/span&gt;

&lt;span class="c1"&gt;// On trip: fallback to rules engine, page on-call, open incident.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;⚠️ &lt;strong&gt;Real-world lesson:&lt;/strong&gt; Test your circuit breaker in production. Quarterly. Deliberately trigger it. A circuit breaker that has never fired in a drill will not fire reliably when you're at 3am staring at a $2M transaction anomaly.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  How to Test an AI Agent in Banking When You Can't Unit Test It
&lt;/h2&gt;

&lt;p&gt;You cannot write "given input X, expect output Y" and call your AI agent tested. The model doesn't work like that.&lt;/p&gt;

&lt;p&gt;What you can do:&lt;/p&gt;

&lt;h3&gt;
  
  
  Shadow Mode Testing — Run it Live, But Without Consequences
&lt;/h3&gt;

&lt;p&gt;Deploy the agent alongside your existing system. It processes every real transaction and logs its decision. But the live decision is still made by the existing rules engine.&lt;/p&gt;

&lt;p&gt;Then compare.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Run for a minimum of &lt;strong&gt;4 weeks&lt;/strong&gt; across all transaction types and volumes&lt;/li&gt;
&lt;li&gt;Target &lt;strong&gt;≥98% agreement rate&lt;/strong&gt; with the existing system before going anywhere near live&lt;/li&gt;
&lt;li&gt;Every disagreement gets reviewed manually — these are your highest-signal edge cases&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;No go-live without sign-off from Risk, Compliance, and Engineering. All three.&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Red-Team Testing for Fraud AI — Someone Else Will If You Don't
&lt;/h3&gt;

&lt;p&gt;Fraudsters don't read your model card. They probe your system, find the edges, and exploit them.&lt;/p&gt;

&lt;p&gt;Before deployment, hire someone to do it first:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Craft transactions that probe just under every hard guardrail threshold&lt;/li&gt;
&lt;li&gt;Test distributional shift — transaction patterns the training data never saw&lt;/li&gt;
&lt;li&gt;Test boundary inputs that have never occurred in your historical data&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Regression test on every model update. Every single one. No exceptions.&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;⚠️ &lt;strong&gt;Real-world lesson:&lt;/strong&gt; A retrained fraud model looked great on all benchmarks. The red team found it could be systematically bypassed using split transactions just below the guardrail threshold — a pattern not in the training set. Update rolled back. Two days of red-teaming. Would have been a catastrophic production incident otherwise.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  DORA, FCA, and EU AI Act Compliance for AI Agents: What Engineers Must Know
&lt;/h2&gt;

&lt;p&gt;I've seen engineers treat regulation as someone else's problem.&lt;/p&gt;

&lt;p&gt;It isn't. Not anymore.&lt;/p&gt;

&lt;p&gt;If you build an AI agent that makes financial decisions in the UK or EU, here's what the law already requires:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Model cards&lt;/strong&gt; for every agent. What the model does, what it was trained on, known failure modes, performance across demographic groups. This is a legal artefact, not documentation for documentation's sake.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Immutable model versioning.&lt;/strong&gt; Every version that ever went to production must be retained and reproducible. If a claim surfaces about a 2-year-old decision, you need to be able to re-run that exact model.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;High-risk AI classification under the EU AI Act.&lt;/strong&gt; Credit scoring and fraud detection are "high-risk." That triggers mandatory conformity assessments &lt;strong&gt;before&lt;/strong&gt; deployment. Not after.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Mandatory human oversight&lt;/strong&gt; for high-stakes decisions. Above certain thresholds, a human must be in the loop. Design your escalation queues for this now, not as an afterthought.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Continuous bias monitoring.&lt;/strong&gt; If your fraud agent is blocking transactions from certain groups at a higher rate, you need automated detection. Manual sampling at scale doesn't cut it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Most engineering teams are scrambling to retrofit this onto systems that were built without it. Don't be that team.&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;⚠️ &lt;strong&gt;Real-world lesson:&lt;/strong&gt; Engineers who understand AI governance are rare and extremely well-compensated right now. The vast majority of developers avoid learning it because it seems boring. That's your competitive advantage. Take it.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  The Honest Truth About Agentic AI in Banking
&lt;/h2&gt;

&lt;p&gt;This isn't a hard problem. It's a discipline problem.&lt;/p&gt;

&lt;p&gt;The patterns that make financial systems reliable apply directly to AI agents. Immutability. Idempotency. Auditability. Circuit breakers. Append-only state. None of this is new.&lt;/p&gt;

&lt;p&gt;What's new is having the AI layer sitting on top of all of it — and the discipline to keep it there, instead of letting it reach down and touch financial state directly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The stack that works:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Append-only decision log — same principles as your ledger&lt;/li&gt;
&lt;li&gt;Idempotent execution service — same principles as your payment processor&lt;/li&gt;
&lt;li&gt;Hard guardrails that fire before the model is ever consulted&lt;/li&gt;
&lt;li&gt;Circuit breakers tested in production, not just in staging&lt;/li&gt;
&lt;li&gt;Shadow mode before any agent goes live. Always.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;The difference between a bank that deploys AI confidently and one that fears it is not the quality of the model. It's the quality of the architecture around it.&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;"When this AI agent makes a wrong decision — and it will — can I explain exactly what happened, to a regulator, at 9am on a Monday?"&lt;/em&gt;&lt;br&gt;
&lt;em&gt;If yes — you're building it right.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  What to Read Next
&lt;/h2&gt;

&lt;p&gt;If this was useful, Part 1 covers the foundational backend patterns that everything in this article builds on:&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://dev.to/abhishek_shekhar/fintech-backend-architecture-building-systems-that-dont-break-when-money-is-involved-4fpj"&gt;Fintech Backend Architecture: Building Systems That Don't Break When Money Is Involved&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Follow&lt;/strong&gt; if you want more on distributed systems, fintech backend architecture, and building AI you can actually trust in production. More coming on event-sourced architectures, DORA incident response, and real-time fraud pipelines.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Backend Lead Engineer. 10+ years in UK core banking. Distributed systems, financial data integrity, regulatory compliance, and AI-powered fintech tooling.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>backend</category>
      <category>fintech</category>
      <category>architecture</category>
    </item>
    <item>
      <title>Fintech Backend Architecture: Building Systems That Don't Break (When Money Is Involved)</title>
      <dc:creator>Abhishek Shekhar</dc:creator>
      <pubDate>Wed, 25 Mar 2026 01:29:33 +0000</pubDate>
      <link>https://dev.to/abhishek_shekhar/fintech-backend-architecture-building-systems-that-dont-break-when-money-is-involved-4fpj</link>
      <guid>https://dev.to/abhishek_shekhar/fintech-backend-architecture-building-systems-that-dont-break-when-money-is-involved-4fpj</guid>
      <description>&lt;p&gt;&lt;em&gt;By a Backend Lead Engineer | 10+ years building core banking and fintech systems in the UK&lt;/em&gt;&lt;br&gt;
&lt;em&gt;2,200 words · 10 min read · Intermediate to Senior Engineers&lt;/em&gt;&lt;/p&gt;



&lt;p&gt;Fintech backend architecture is one of the most demanding disciplines in software engineering. Unlike typical web applications, &lt;strong&gt;financial systems cannot tolerate data loss, silent corruption, or ambiguous state&lt;/strong&gt; — because the data represents real money.&lt;/p&gt;

&lt;p&gt;This guide covers the seven core principles of production-grade fintech backend architecture: from immutable ledger design and idempotency patterns to distributed transaction management, secrets security, observability, and regulatory compliance engineering. Every pattern here has been validated in real UK banking production environments.&lt;/p&gt;


&lt;h2&gt;
  
  
  Introduction: Why Fintech Backend Architecture Is Different
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;⚠️ This is not theory. This is what actually works in production.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Building backend systems for a bank is a completely different game. This isn't about building APIs that "mostly work."&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;If you get it wrong, it's not a bug — it's someone's money.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Over the last decade working inside a UK bank, I've seen:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Systems that scaled cleanly under real production load&lt;/li&gt;
&lt;li&gt;Systems that silently corrupted data for weeks before anyone noticed&lt;/li&gt;
&lt;li&gt;Systems that passed every test — and failed catastrophically in production&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This article is not a tutorial. It's what actually works when regulators are watching every decision, volumes are real and unforgiving, and failure is simply not an option.&lt;/p&gt;


&lt;h2&gt;
  
  
  1. The Three Rules Every Fintech Backend Engineer Must Follow
&lt;/h2&gt;

&lt;p&gt;Every fintech system lives or dies on three things.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Correctness&lt;/strong&gt; — Money must always be right. Not eventually. Not "close enough." Always.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Auditability&lt;/strong&gt; — If a regulator asks: &lt;em&gt;"What happened to this £100?"&lt;/em&gt; — you must answer with data, not assumptions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Resilience&lt;/strong&gt; — Failures will happen. Your system must not corrupt data when things go wrong, not silently lose state under pressure, and recover predictably every single time.&lt;/p&gt;

&lt;p&gt;Everything else — performance, cost, elegance — comes later. I've seen teams optimise the wrong things early. It always comes back as a production incident.&lt;/p&gt;


&lt;h2&gt;
  
  
  2. Immutable Ledger Design: Never Update Financial Data
&lt;/h2&gt;

&lt;p&gt;If you take one thing from this article, take this:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Never mutate financial state.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Don't update balances. Don't overwrite data. Don't "fix" values in place.&lt;/p&gt;
&lt;h3&gt;
  
  
  ❌ The Wrong Approach: Mutable Balance Updates
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;UPDATE&lt;/span&gt; &lt;span class="n"&gt;accounts&lt;/span&gt;
&lt;span class="k"&gt;SET&lt;/span&gt; &lt;span class="n"&gt;balance&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;balance&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;account_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'A1'&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. Works fine — until a retry fires twice, a race condition hits under load, or a bug goes undetected for 3 days. Now you don't know what happened. And neither does your auditor.&lt;/p&gt;
&lt;h3&gt;
  
  
  ✅ The Right Approach: Append-Only Ledger
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;INSERT&lt;/span&gt; &lt;span class="k"&gt;INTO&lt;/span&gt; &lt;span class="n"&gt;ledger_entries&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;account_id&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="n"&gt;direction&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="k"&gt;type&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;reference_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;created_at&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;VALUES&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="s1"&gt;'A1'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;00&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'DEBIT'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="s1"&gt;'PAYMENT'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'txn-123'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;NOW&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;Balance is always derived — never stored:&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;SELECT&lt;/span&gt;
  &lt;span class="k"&gt;SUM&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;CASE&lt;/span&gt; &lt;span class="k"&gt;WHEN&lt;/span&gt; &lt;span class="n"&gt;direction&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'CREDIT'&lt;/span&gt;
    &lt;span class="k"&gt;THEN&lt;/span&gt; &lt;span class="n"&gt;amount&lt;/span&gt; &lt;span class="k"&gt;ELSE&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;amount&lt;/span&gt; &lt;span class="k"&gt;END&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;ledger_entries&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;account_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'A1'&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;Why immutable ledger design matters:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Reconstruct the exact balance at any point in history&lt;/li&gt;
&lt;li&gt;Explain every transaction to a regulator with a single query&lt;/li&gt;
&lt;li&gt;Bugs create traceable entries — not silent corruption&lt;/li&gt;
&lt;li&gt;Race conditions drop dramatically — writes are inserts, not read-modify-write&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;⚠️ &lt;strong&gt;Real-world lesson:&lt;/strong&gt; Ledger tables grow FAST. 10M+ records/month is normal at scale. Without partitioning from day one, performance collapses. Partition by &lt;code&gt;created_at&lt;/code&gt; month — before you need it, not after.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  3. Idempotency in Payment APIs: Your Distributed Systems Safety Net
&lt;/h2&gt;

&lt;p&gt;In distributed payment systems, retries are not optional. They WILL happen — network timeouts mid-payment, load balancer retries, mobile clients with flaky connections, internal service retries.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The question is never "will a request be retried?" — it's "when it's retried, is it safe?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Implementing Idempotency Keys in Payment APIs
&lt;/h3&gt;

&lt;p&gt;Every payment endpoint must accept an idempotency key from the client:&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;POST /v1/payments
Idempotency-Key: 550e8400-e29b-41d4-a716-446655440000
Authorization: Bearer {token}

{ "amount": 100.00, "currency": "GBP", "to": "ACC456" }
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Store the key with the result the first time it's processed:&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;idempotency_keys&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="k"&gt;key&lt;/span&gt;         &lt;span class="nb"&gt;VARCHAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;PRIMARY&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;response&lt;/span&gt;    &lt;span class="n"&gt;JSONB&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;status_code&lt;/span&gt; &lt;span class="nb"&gt;INT&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;created_at&lt;/span&gt;  &lt;span class="n"&gt;TIMESTAMPTZ&lt;/span&gt; &lt;span class="k"&gt;DEFAULT&lt;/span&gt; &lt;span class="n"&gt;NOW&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
  &lt;span class="n"&gt;expires_at&lt;/span&gt;  &lt;span class="n"&gt;TIMESTAMPTZ&lt;/span&gt; &lt;span class="k"&gt;DEFAULT&lt;/span&gt; &lt;span class="n"&gt;NOW&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;INTERVAL&lt;/span&gt; &lt;span class="s1"&gt;'24 hours'&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Same key arrives again? Return the stored response. No re-processing. No double charge.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Idempotency key best practices:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use UUIDs v4 — not sequential IDs&lt;/li&gt;
&lt;li&gt;Expire after 24–48 hours — not forever&lt;/li&gt;
&lt;li&gt;Return the EXACT same status code and body on replay&lt;/li&gt;
&lt;li&gt;Log every replay — it's a useful operational signal&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;⚠️ &lt;strong&gt;Real-world lesson:&lt;/strong&gt; I've seen the same payment processed 7 times in 4 seconds because a mobile client retried on a slow network. Without idempotency keys, that's 7 debits. With them, it's 1 debit and 6 instant cache hits.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  4. The Saga Pattern: Handling Distributed Transactions in Fintech
&lt;/h2&gt;

&lt;p&gt;You move £100 from Account A to Account B. That's two writes. System crashes after the debit, before the credit. You've just lost £100.&lt;/p&gt;

&lt;p&gt;Two-phase commit (2PC) solves it — in theory. In practice it brings lock contention, coordinator failures, and a throughput cliff. Most modern fintech backend systems use the &lt;strong&gt;Saga pattern&lt;/strong&gt; instead.&lt;/p&gt;

&lt;h3&gt;
  
  
  How the Saga Pattern Works in Payment Processing
&lt;/h3&gt;

&lt;p&gt;A Saga is a sequence of local transactions. Each step has a defined compensating action. If step 3 fails, the system runs compensations for steps 2 and 1 — automatically.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Payment Saga — compensating transactions:
Step 1: Debit Account A     → Compensate: Credit Account A
Step 2: Credit Account B    → Compensate: Debit Account B
Step 3: Send confirmation   → Compensate: Send reversal event
Step 4: Update status       → (terminal — no compensation needed)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;💡 Write your compensation logic BEFORE your forward logic. If you can't define the compensating transaction, you don't understand the operation well enough to build it.&lt;/p&gt;

&lt;p&gt;⚠️ &lt;strong&gt;Real-world lesson:&lt;/strong&gt; The Saga pattern gives you eventual consistency with a full audit trail of every forward step and every compensation that ran. Regulators love this. On-call engineers love this even more.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  5. Fintech Security Architecture: Secrets, mTLS, and Fraud Prevention
&lt;/h2&gt;

&lt;p&gt;In most web systems, security is layered on top. In fintech backend architecture, security is baked into every decision from day one.&lt;/p&gt;

&lt;h3&gt;
  
  
  Secrets Management in Financial Systems
&lt;/h3&gt;

&lt;p&gt;No credentials in environment variables. No credentials in config files. Definitely not in source code.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;AWS Secrets Manager or HashiCorp Vault&lt;/strong&gt; — mandatory, not optional&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rotate secrets automatically&lt;/strong&gt; — 90-day maximum lifetime for any credential&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Every service has its own credentials&lt;/strong&gt; — no shared database users&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Audit log every secret access&lt;/strong&gt; — you need to know when and by whom&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;⚠️ &lt;strong&gt;Real-world lesson:&lt;/strong&gt; I have seen a production database password live in a &lt;code&gt;.env&lt;/code&gt; file committed to a private GitHub repo for 14 months. It was found during a security audit, not a breach. That time, they were lucky.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  mTLS for Internal Service Communication
&lt;/h3&gt;

&lt;p&gt;Internal service-to-service calls should use mutual TLS (mTLS), not just TLS. Both sides present certificates. A compromised internal service can't impersonate another. Istio or Linkerd handles this at the infrastructure level — your application code stays clean.&lt;/p&gt;

&lt;h3&gt;
  
  
  Rate Limiting as a Fraud Detection Signal
&lt;/h3&gt;

&lt;p&gt;Rate limiting in fintech isn't just DDoS protection — it's fraud intelligence. A legitimate user doesn't send 200 payment requests in 60 seconds.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Global:&lt;/strong&gt; requests per IP per minute at infrastructure level&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Per user:&lt;/strong&gt; transactions per hour per account at application level&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Velocity triggers:&lt;/strong&gt; unusual patterns → step-up authentication, not hard blocks&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  6. Observability in Fintech Systems: Structured Logs, Tracing, and Business Metrics
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Structured Logging for Financial Services
&lt;/h3&gt;

&lt;p&gt;A string log: &lt;em&gt;"Payment failed for user 123"&lt;/em&gt; is useless at 3am.&lt;/p&gt;

&lt;p&gt;A structured log:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"event"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"payment.failed"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"user_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"123"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"payment_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"PAY-456"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"reason"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"insufficient_funds"&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="mf"&gt;100.00&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;"GBP"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"timestamp"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2026-03-18T09:23:11Z"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"service"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"payment-processor"&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;p&gt;This is queryable. Alertable. It feeds your compliance dashboards. The string version feeds only frustration.&lt;/p&gt;

&lt;h3&gt;
  
  
  Distributed Tracing with OpenTelemetry
&lt;/h3&gt;

&lt;p&gt;A single payment touches 6–10 services. When it fails, you need the exact path. Instrument with &lt;strong&gt;OpenTelemetry&lt;/strong&gt; from day one — not after a production incident proves you needed it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Business Metrics Alongside Technical Metrics
&lt;/h3&gt;

&lt;p&gt;Your SRE watches p99 latency. Your CFO watches payment success rate. Build dashboards for both from the same data pipeline. Grafana and DataDog handle this well. Your on-call engineer and your board meeting both benefit.&lt;/p&gt;




&lt;h2&gt;
  
  
  7. Compliance as Code: DORA, PCI-DSS, and FCA Requirements
&lt;/h2&gt;

&lt;p&gt;DORA. PCI-DSS. ISO 27001. FCA requirements. The regulatory landscape for fintech is dense and it is enforced. The teams that handle it best don't treat compliance as an audit exercise — they treat it as an &lt;strong&gt;engineering requirement&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Compliance engineering in practice:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Data retention policies enforced at the database level — not by a manual process someone forgets&lt;/li&gt;
&lt;li&gt;PII fields encrypted at rest with automated key rotation — not a post-launch task&lt;/li&gt;
&lt;li&gt;Audit logs immutable and replicated to write-once storage — S3 Object Lock works well&lt;/li&gt;
&lt;li&gt;Access reviews automated — quarterly reports from your IAM system, not spreadsheets&lt;/li&gt;
&lt;li&gt;Change management tracked with mandatory risk assessment fields — not informal Slack messages&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;DORA specifically requires documented evidence of operational resilience testing. If you're not generating structured resilience test reports now, you will be scrambling later.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;⚠️ &lt;strong&gt;Real-world lesson:&lt;/strong&gt; Engineers who understand compliance earn more, get promoted faster, and have a dramatically easier time selling tools into the fintech sector. Most developers actively avoid learning it. That's your competitive advantage.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Summary: What Makes a Production-Grade Fintech Backend
&lt;/h2&gt;

&lt;p&gt;Fintech backend architecture rewards one type of engineer above all others: the one who prioritises &lt;strong&gt;correctness over cleverness&lt;/strong&gt;, and &lt;strong&gt;auditability over speed-of-delivery&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The technology stack is not exotic:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;PostgreSQL&lt;/strong&gt; for the immutable ledger&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Kafka or SQS&lt;/strong&gt; for saga orchestration events&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OpenTelemetry&lt;/strong&gt; for distributed tracing&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;HashiCorp Vault&lt;/strong&gt; for secrets management&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;The difference is discipline. Not technology.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The question to ask at every architectural decision in fintech isn't &lt;em&gt;"will this scale?"&lt;/em&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;It's: &lt;strong&gt;"When this fails — can I explain exactly what happened, to a regulator, at 9am on a Monday?"&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If the answer is yes — you're building it right.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Found this useful? Follow for more articles on distributed systems, financial data integrity, and regulatory compliance engineering in production fintech environments.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Backend Lead Engineer. 10+ years building core banking systems in the UK. Specialises in distributed systems, financial data integrity, and regulatory compliance engineering. Currently building AI-powered tooling for fintech compliance teams.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>backend</category>
      <category>fintech</category>
      <category>architecture</category>
      <category>security</category>
    </item>
  </channel>
</rss>
