<?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 Shalonfernando on Medium]]></title>
        <description><![CDATA[Stories by Shalonfernando on Medium]]></description>
        <link>https://medium.com/@shalonfernando52?source=rss-4527d4ca0611------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*prQRT50B5farKhII</url>
            <title>Stories by Shalonfernando on Medium</title>
            <link>https://medium.com/@shalonfernando52?source=rss-4527d4ca0611------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 20:46:25 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@shalonfernando52/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[Locking Down Your App The Better Auth Way. A Deep Dive Into 2FA, Passwords, Sessions, and Accounts]]></title>
            <link>https://levelup.gitconnected.com/locking-down-your-app-the-better-auth-way-a-deep-dive-into-2fa-passwords-sessions-and-accounts-97b92cdc5190?source=rss-4527d4ca0611------2</link>
            <guid isPermaLink="false">https://medium.com/p/97b92cdc5190</guid>
            <category><![CDATA[authentication]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[better-auth]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Shalonfernando]]></dc:creator>
            <pubDate>Wed, 17 Jun 2026 16:20:34 GMT</pubDate>
            <atom:updated>2026-06-17T16:20:34.540Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2Ty7iID0-VUiGKg0KGWS_Q.png" /></figure><h3>How one auth library quietly handles the security work every developer dreads</h3><p>Every developer reaches that point in a project where the login form just is not enough anymore. Users start asking about two factor authentication. Someone forgets their password and there is no real flow for that. A user wants to delete their account and you realize you never built that either. This is the not so glamorous side of building software, the part nobody puts in a portfolio, yet it is the part that decides whether your app is actually safe to use.</p><p>I recently went through exactly this while working on my company project, and the tool that carried most of the weight was Better Auth. I want to walk you through what I learned. Specifically around these four: two factor authentication, password management, active session handling and the user account lifecycle. Lets think of this as the guide I wish I had before I started.</p><p>Now lets get into it!</p><h3>Why two factor authentication even matters here</h3><p>A password alone is a single point of failure. It gets phished, it gets reused across ten different sites, it ends up in a leaked database somewhere. Two factor authentication, or 2FA, adds a second checkpoint so that a stolen password alone is not enough to break into an account.</p><p>Better Auth ships a dedicated two factor plugin that gives you two paths for that second checkpoint, OTP and TOTP.</p><p>OTP, or One Time Password, is a temporary code sent to the user through email or phone. TOTP, or Time Based One Time Password, is generated by an authenticator app already sitting on the user’s device, no network round trip required. On top of these two, the plugin also hands you backup codes for account recovery and a trusted device system so people are not asked to verify their identity every single time they log in from their own laptop.</p><h3>Setting it up</h3><p>The installation is refreshingly small. You add the plugin server side, run a migration, then mirror it on the client.</p><pre>import { betterAuth } from &quot;better-auth&quot;<br>import { twoFactor } from &quot;better-auth/plugins&quot;<br><br>export const auth = betterAuth({<br>    appName: &quot;My App&quot;,<br>    plugins: [<br>        twoFactor()<br>    ]<br>})</pre><p>Notice the <strong>appName </strong>field there. That name becomes the issuer shown inside the user&#39;s authenticator app, so when they scan a QR code, they see your app&#39;s name instead of some generic placeholder.</p><p>After that you migrate the database so the new fields and tables exist.</p><pre>npx auth migrate</pre><p>And then the client side gets its own plugin so it knows how to redirect users into the verification flow when needed.</p><pre>import { createAuthClient } from &quot;better-auth/client&quot;<br>import { twoFactorClient } from &quot;better-auth/client/plugins&quot;<br><br>export const authClient = createAuthClient({<br>    plugins: [<br>        twoFactorClient()<br>    ]<br>})</pre><h3>Turning 2FA on for a user</h3><p>Enabling 2FA is a single call, and it asks for the user’s password as a safety check before anything sensitive happens.</p><pre>const enableTwoFactor = async (password) =&gt; {<br>    const { data } = await authClient.twoFactor.enable({<br>        password<br>    })<br>    // data contains totpURI and backupCodes<br>}</pre><p>One detail that confused me at first is that <strong>twoFactorEnabled </strong>does not flip to true the moment you call enable. It only becomes true once the user actually verifies a TOTP code. So your UI should treat enable as step one of two, not the finish line. There is a <strong>skipVerificationOnEnable </strong>config option if you want to bypass that for some reason, but its rather questionable and I would think carefully before doing that since it removes a real safety check.</p><p>Also worth knowing, by default the plugin assumes the user has a password based account. If your app supports passwordless users through passkeys, magic links, email OTP, or social sign in, you will want to set <strong>allowPasswordless </strong>to true so those users can also manage 2FA without hitting a wall.</p><h3>The sign in flow gets an extra branch</h3><p>Here is where it gets interesting. When a 2FA enabled user tries to sign in, the response will not hand back a session immediately. Instead you get <strong>twoFactorRedirect </strong>set to true along with <strong>twoFactorMethods</strong>, an array telling you which second factor options are available for that user, something like <strong>totp </strong>or <strong>otp </strong>or both.</p><pre>import { authClient } from &quot;@/lib/auth-client&quot;<br><br>await authClient.signIn.email({<br>        email: &quot;user@example.com&quot;,<br>        password: &quot;password123&quot;,<br>    },<br>    {<br>        async onSuccess(context) {<br>            if (context.data.twoFactorRedirect) {<br>                const methods = context.data.twoFactorMethods<br>                // show the right verification screen based on available methods<br>            }<br>        },<br>    }<br>)</pre><p>There is also a cleaner global approach using <strong>onTwoFactorRedirect </strong>inside the client plugin config, which fires automatically whenever a 2FA challenge is needed, so you are not repeating that logic everywhere you call sign in.</p><p>An important thing to keep in mind is that this gating only applies automatically to the credential based sign in routes, meaning email, username, and phone number sign in. If a user signs in through email OTP, magic link, social login, passkey, or anonymous flows, none of those are gated by 2FA out of the box. If your app needs 2FA enforced on those too, you will need to add custom hook handling yourself and route the user into your verification screen manually.</p><p>And one more thing if you are calling these endpoints server side through <strong>auth.api</strong> , the <strong>twoFactorRedirect </strong>check needs to be done using the in operator rather than assuming the shape of the response, because TypeScript will not infer this branch for you automatically.</p><h3>TOTP, The Authenticator app method</h3><p>TOTP works by generating a fresh code every fixed interval, thirty seconds by default, using the secret created when 2FA was enabled. Getting the URI to build a QR code is one call away.</p><pre>const { data } = await authClient.twoFactor.getTotpUri({ password })</pre><p>And rendering it is genuinely just dropping that URI into a QR code component.</p><pre>import { authClient } from &quot;@/lib/auth-client&quot;<br>import QRCode from &quot;react-qr-code&quot;<br><br>export default function UserCard({ password }) {<br>    const { data: session } = authClient.useSession()<br>    const { data: qr } = useQuery({<br>        queryKey: [&quot;two-factor-qr&quot;],<br>        queryFn: async () =&gt; {<br>            const res = await authClient.twoFactor.getTotpUri({ password })<br>            return res.data<br>        },<br>        enabled: !!session?.user.twoFactorEnabled,<br>    })<br>    return &lt;QRCode value={qr?.totpURI || &quot;&quot;} /&gt;<br>}</pre><p>Verification accepts the code from one period before and one period after the current window, which is a small detail that saves a lot of frustrated support tickets from users whose phone clock is slightly off.</p><pre>const { data } = await authClient.twoFactor.verifyTotp({<br>    code,<br>    trustDevice: true<br>})</pre><h3>OTP for when you want email or SMS instead</h3><p>OTP requires you to define how the code actually gets delivered, since Better Auth does not assume your email or SMS provider.</p><pre>twoFactor({<br>    otpOptions: {<br>        async sendOTP({ user, otp }, ctx) {<br>            // plug in your own email or SMS sending logic here<br>        },<br>    },<br>})</pre><p>From there, sending and verifying are mirror calls on the client.</p><pre>await authClient.twoFactor.sendOtp({ trustDevice: true })<br>await authClient.twoFactor.verifyOtp({ code, trustDevice: true })</pre><h3>Backup codes, the safety net</h3><p>These exist for the moment someone loses their phone or cannot access their email. Generating them wipes any previous set, so treat regeneration as an intentional user action not something you trigger casually.</p><pre>const { data } = await authClient.twoFactor.generateBackupCodes({ password })<br>// show these codes to the user immediately, they will not see them again</pre><p>Each backup code is single use. Once it verifies a sign in, it is deleted from the database and cannot be reused. If you need to display previously generated codes again, that has to happen server side through <strong>viewBackupCodes </strong>, and only when the session is fresh, meaning the user just signed in moments ago.</p><h3>Trusted devices</h3><p>Passing <strong>trustDevice </strong>as true during verification remembers that device for thirty days, refreshing the window every time the user signs in successfully from it. It is a small thing but it meaningfully reduces 2FA fatigue without weakening security on unfamiliar devices.</p><h3>Managing users, passwords, and accounts</h3><p>Two factor authentication protects the front door, but the rest of the user lifecycle matters just as much.</p><h3>Updating basic info</h3><p>The simplest operation in the entire toolkit.</p><pre>await authClient.updateUser({<br>    image: &quot;https://example.com/image.jpg&quot;,<br>    name: &quot;John Doe&quot;,<br>})</pre><h3>Changing email the safe way</h3><p>Email changes are disabled by default, which honestly makes sense given how often this becomes an attack vector.</p><pre>export const auth = betterAuth({<br>    user: {<br>        changeEmail: {<br>            enabled: true,<br>        }<br>    },<br>    emailVerification: {<br>        sendVerificationEmail: async ({ user, url, token }) =&gt; {<br>            // send your verification email here<br>        }<br>    }<br>})</pre><p>By default, the verification email goes to the new address, and the email is only swapped after that link is clicked. If you want to be extra careful, there is <strong>sendChangeEmailConfirmation </strong>, which sends a confirmation to the current email first before anything else happens, so an attacker who only compromised a session cannot quietly redirect account recovery to an email they control.</p><p>One callout from the docs that is genuinely good advice, never await the email sending call directly inside the request handler since that opens the door to timing attacks. On serverless platforms specifically, reach for something like <strong>waitUntil</strong>.</p><h3>Changing and setting passwords</h3><p>Changing a password while logged in looks like this.</p><pre>await authClient.changePassword({<br>    newPassword: &quot;newpassword1234&quot;,<br>    currentPassword: &quot;oldpassword1234&quot;,<br>    revokeOtherSessions: true<br>})</pre><p>That <strong>revokeOtherSessions </strong>flag is worth turning on by default in most apps. If a password got compromised, you want every other active session killed the moment it changes, not lingering around on some device an attacker still has access to.</p><p>For OAuth users who never had a password to begin with, there is <strong>setPassword </strong>, which only runs server side, intentionally, so it cannot be abused from the client.</p><pre>import { auth } from &quot;@/lib/auth&quot;<br><br>await auth.api.setPassword({<br>    body: {<br>        newPassword: &quot;new-password&quot;,<br>    },<br>    headers: await headers()<br>})</pre><h3>Deleting a user, carefully</h3><p>Account deletion is disabled by default too, and turning it on is simple, but doing it responsibly takes a bit more thought.</p><pre>export const auth = betterAuth({<br>    user: {<br>        deleteUser: {<br>            enabled: true<br>        }<br>    }<br>})</pre><p>The library supports a verification step through <strong>sendDeleteAccountVerification </strong>, which is especially important for OAuth users since they cannot just type a password to confirm intent.</p><p>To actually authorize a deletion, a user needs one of, a valid password, a fresh session meaning they signed in recently, or a completed email verification flow for OAuth accounts. There are also <strong>beforeDelete </strong>and <strong>afterDelete </strong>hooks, and <strong>beforeDelete </strong>can throw an <strong>APIError </strong>to stop the deletion entirely, which is handy if you ever need to block certain accounts, like admin accounts, from being deleted by mistake.</p><h3>Account linking</h3><p>Better Auth lets a single user connect multiple sign in methods, Google alongside a regular password account for example, as long as the provider confirms the email is verified.</p><pre>await authClient.linkSocial({<br>    provider: &quot;google&quot;,<br>    callbackURL: &quot;/callback&quot;<br>})</pre><p>There is a <strong>trustedProviders </strong>escape hatch for providers you trust enough to skip the email verification requirement, but the docs are right to flag this as something to use carefully since it does raise the risk of account takeover if misused.</p><p>Unlinking works the same way, with one safeguard built in, Better Auth will not let a user unlink their only remaining account, since that would lock them out entirely, unless you explicitly allow it.</p><pre>await authClient.unlinkAccount({<br>    providerId: &quot;google&quot;<br>})</pre><h3>A quick word on visibility, dashboards and activity</h3><p>If you are running this at any real scale, you will eventually want visibility into what is actually happening, sign ins, password changes, session revocations, organization activity. Better Auth’s infrastructure side has a <strong>dash </strong>plugin for exactly this, wiring up event tracking and admin style endpoints for things like session management and audit logs. I will not go deep into it here since it deserves its own article, but it is worth knowing it exists once your auth setup graduates from a side project to something with real users depending on it.</p><h3>Wrapping this up</h3><p>What stood out to me the most going through all of this is how Better Auth treats security as something composable rather than something bolted on. Two factor authentication, password flows, session control, account linking, they all sit as plugins and config options you opt into deliberately, instead of one giant opinionated black box. That makes it genuinely pleasant to reason about, especially when you are the one who has to explain to your team why a particular flow works the way it does.</p><p>If you are building anything that holds real user data, even a side project, I would treat this entire stack as a checklist rather than a nice to have. Passwords leak. Phones get lost. Sessions get hijacked. Having clean, predictable flows for all of that before it becomes an emergency is the difference between a bad day and a genuinely bad week.</p><p>Thanks for reading. If this was useful, useful, or at least mildly entertaining a clap or two wouldn’t hurt hehe :)</p><h3>References And further reading</h3><p><a href="https://better-auth.com/docs/introduction">Introduction, Better Auth</a></p><p><a href="https://better-auth.com/docs/plugins/2fa">Two Factor Authentication, Better Auth</a></p><p><a href="https://better-auth.com/docs/concepts/users-accounts">User And Accounts, Better Auth</a></p><p><a href="https://better-auth.com/docs/basic-usage">Basic Usage, Better Auth</a></p><p><a href="https://better-auth.com/docs/installation">Installation, Better Auth</a></p><p><a href="https://better-auth.com/docs/concepts/database">Database Concepts, Better Auth</a></p><p><a href="https://github.com/better-auth/better-auth">Better Auth GitHub Repository</a></p><p><strong>#Authentication #Web Development #Security #SoftwareEngineering</strong>, <strong>#BetterAuth</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=97b92cdc5190" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/locking-down-your-app-the-better-auth-way-a-deep-dive-into-2fa-passwords-sessions-and-accounts-97b92cdc5190">Locking Down Your App The Better Auth Way. A Deep Dive Into 2FA, Passwords, Sessions, and Accounts</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Built a Fraud Detection System That Explains Itself. Here’s What I Learned.]]></title>
            <link>https://levelup.gitconnected.com/i-built-a-fraud-detection-system-that-explains-itself-heres-what-i-learned-bcd5e522c6a7?source=rss-4527d4ca0611------2</link>
            <guid isPermaLink="false">https://medium.com/p/bcd5e522c6a7</guid>
            <category><![CDATA[fintech]]></category>
            <category><![CDATA[mlops]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[design-systems]]></category>
            <dc:creator><![CDATA[Shalonfernando]]></dc:creator>
            <pubDate>Sat, 18 Apr 2026 05:39:19 GMT</pubDate>
            <atom:updated>2026-04-25T00:18:05.229Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kVEEbaPFf6xFSGjMRJvkjg.png" /></figure><p>Most fraud detection systems work like a bouncer at an exclusive club. No explanation, no appeal, just a vague “you’re not on the list!!” and a door in your face. Your legitimate customer just wanted to buy a laptop. Now they’re using your competitor’s checkout. Congratulations!, you just lost 2.5 lakhs($800) and a lifetime customer because your ML model had a bad feeling.</p><p>I wanted to build something better. So I built <strong>FraudGuard AI</strong> a B2B SaaS platform that scores transactions in under 85ms <em>and</em> tells you exactly why it made the decision it did.</p><p>Radical concept, I know.</p><h3>The Problem Nobody Talks About Enough</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*oqaYdmcb85jBs0peoNm3NA.png" /></figure><p>Everyone in FinTech talks about catching fraud. Fair enough chargebacks are brutal. You lose the product, the money, and Visa charges you a $25 fee on top of it just to really drive the point home.</p><p>But the other side of this coin is somehow less discussed: <strong>false positives</strong>.</p><p>Your fraud model blocks a real customer. That customer gets an embarrassing decline mid checkout. They close the tab, open a competitor’s site, and boom they never come back. You didn’t just lose a sale you lost every sale that person would have made for the next five years.</p><p>Legacy “rule based” systems made this worse. Engineers would hardcode rules like:</p><pre>IF amount &gt; $1000 AND country = &quot;Russia&quot; THEN block</pre><p>Straightforward. Auditable. And completely useless once fraudsters figured it out which took them approximately four days.</p><p>The answer is machine learning. Specifically, <strong>XGBoost</strong>. And the answer to <em>why XGBoost</em> is boring and correct, which is the best kind of answer.</p><h3>Why XGBoost and Not Something Fancier</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ag0hpxdXKmP4TcsrElTp4w.png" /></figure><p>Let me save you the Medium post rabbit hole: XGBoost is the industry standard for tabular data fraud detection because it works, it’s fast, and it doesn’t need a GPU cluster to run inference.</p><p>Could I have used a neural network? Sure. Would it have been overkill for a structured CSV of transaction features? Absolutely. Would it have made for a better LinkedIn post? Debatable.</p><p>XGBoost is an <strong>group of decision trees</strong> built sequentially each tree learning from the mistakes of the previous one. This “boosting” approach means:</p><ul><li>Tree 1 makes predictions. Gets some wrong.</li><li>Tree 2 focuses specifically on what Tree 1 got wrong.</li><li>Tree 3 focuses on Tree 2’s mistakes.</li><li>Repeat 500 times.</li><li>Final answer is a weighted vote across all 500 trees.</li></ul><p>The whole thing runs in milliseconds on CPU. For a checkout flow where every millisecond matters, this is not a small thing.</p><p><strong>Features the model actually looks at:</strong></p><ul><li>Transaction amount and merchant category</li><li>Hour of day, day of week (3AM transactions are suspicious. Sorry nocturnal animals.)</li><li>Velocity - how many transactions from this card in the last hour</li><li>Geographic distance between billing address and IP location</li><li>Device fingerprint signals</li><li>IP reputation score</li></ul><p>Raw data comes in, gets preprocessed through a persisted pipeline, drops through 500 trees, and comes out the other side as a risk score between 0 and 1. The whole preprocessing pipeline is saved alongside the model artifact so there’s no drift between training and inference. A mistake that has burned people before.</p><h3>The Part I’m Most Proud Of - SHAP</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/1*o8XFUQz5otuAs60QU0Z8Ww.png" /></figure><p>Here’s where most ML fraud systems stop, they give you a score. 0.87. Transaction blocked. Good luck explaining that to your risk analyst, your compliance team, or the angry customer on the phone.</p><p>FraudGuard AI uses <strong>SHAP (SHapley Additive Explanations)</strong> to generate per transaction feature attributions. Every single scored transaction returns a risk_factors object that looks something like this:</p><pre>{<br>  &quot;risk_score&quot;: 0.91,<br>  &quot;status&quot;: &quot;BLOCK_TRANSACTION&quot;,<br>  &quot;risk_factors&quot;: [<br>    { &quot;feature&quot;: &quot;hour_of_day&quot;, &quot;contribution&quot;: +0.34, &quot;direction&quot;: &quot;increases_risk&quot; },<br>    { &quot;feature&quot;: &quot;ip_distance_km&quot;, &quot;contribution&quot;: +0.28, &quot;direction&quot;: &quot;increases_risk&quot; },<br>    { &quot;feature&quot;: &quot;velocity_1hr&quot;, &quot;contribution&quot;: +0.19, &quot;direction&quot;: &quot;increases_risk&quot; },<br>    { &quot;feature&quot;: &quot;amount&quot;, &quot;contribution&quot;: -0.06, &quot;direction&quot;: &quot;decreases_risk&quot; }<br>  ]<br>}</pre><p>In plain English: “We blocked this transaction because it happened at 3AM, the IP is 4,000 miles from the billing address, and this card has made 12 transactions in the last hour. The amount was actually fine.”</p><p>Your analyst can act on that. Your compliance team can audit that. Your customer service rep can explain that. A raw score of 0.91 helps nobody.</p><p>SHAP runs via shap.TreeExplainer on the trained booster. For large batch jobs, we compute SHAP only for records above the risk threshold to keep costs sane you don&#39;t need a full explanation for every $12 coffee purchase.</p><h3>The Architecture (Or: How Not to Overengineer a Side Project)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7FiSuMnU5K8XXTh7nwNnyg.png" /><figcaption>System Architecure</figcaption></figure><p>A few decisions worth explaining:</p><p><strong>Model loads once at startup.</strong> FastAPI’s async lifespan handler runs load_models() before any requests arrive. The XGBoost artifact and preprocessing pipeline sit in memory. Per-request model loading would be a crime against humanity and I won&#39;t stand for it.</p><p><strong>Business rules live next to the model, not inside it.</strong> The _status_from_rules function in main.py handles threshold logic and hard blocks (like block_on_location_mismatch) separately from the model score. This means you can tighten a rule without retraining. Compliance teams can audit rules without touching ML code. Everyone&#39;s happy.</p><p><strong>Single env-driven API base URL.</strong> NEXT_PUBLIC_API_URL drives everything on the frontend. No hardcoded localhost URLs surviving into production. No 2AM debugging sessions because staging was pointing at your laptop. One variable, predictable everywhere.</p><p><strong>The cron job.</strong> Yes, that’s cron-job.org pinging /api/v1/ping every 15 minutes to keep the Render free tier instance warm. Is this the most elegant infrastructure decision of my career? No. Does it work? Completely. Ship first, optimize later.</p><h3>The 3AM Russian VPN Test</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DTzGIkckMm6gmr9wPNwrTQ.png" /></figure><p>I needed to validate the full adversarial path end to end. So I simulated an attacker routing transactions through an offshore VPN mismatched geo metadata, proxy flags in the location payload, high velocity, odd hours.</p><p>Here’s what happened, in order:</p><ol><li>Transaction payload hits FastAPI</li><li>Preprocessor extracts location features, flags is_location_unusual: true</li><li>XGBoost risk score: 0.8</li><li>SHAP: location features dominate the positive contributions</li><li>Rules engine: block_on_location_mismatch triggers → BLOCK_TRANSACTION</li><li>Response hits the frontend with full SHAP breakdown</li><li>Supabase logs the event for telemetry</li><li>Zero silent failures</li></ol><p>That last point. <strong>Zero silent failures.</strong> This is the thing that separates a toy project from something you’d actually trust with real money. A system that fails silently is more dangerous than a system that fails loudly. If something goes wrong, I want it in the logs, on the dashboard, and visible to the analyst not quietly wrong for six hours while chargebacks pile up.</p><h3>Monetization (Because SaaS Needs a Business Model)</h3><p>FraudGuard AI has a real Stripe sandbox integration.</p><p><strong>Free tier:</strong> 5 transactions per day. Enough to evaluate the product, not enough to run a business on it.</p><p><strong>Pro tier:</strong> Unlocks the Developer API Hub (self serve API key generation), bulk CSV auditing, and unlimited transactions. Stripe webhooks update subscription status in Supabase in real time.</p><p>Want to try it without a real credit card? Use Stripe’s test card: 4242 4242 4242 4242. Expiry: any future date. CVC: anything. You get full Pro access instantly in sandbox mode.</p><p>This is genuinely the part I’d encourage more portfolio projects to implement. Stripe sandbox is free, the integration teaches you webhooks, idempotency, subscription lifecycle management skills that translate directly to real SaaS engineering. And it makes your portfolio piece look like an actual product instead of a cheap student project.</p><h3>Final Thoughts</h3><p>I’ll be honest, FraudGuard AI is a Proof of Concept MVP. It’s not processing millions of transactions a day, and the backend lives on Render’s free tier and sleeps if you don’t poke it.</p><p>But the engineering decisions are real. The SHAP explainability is real. The Stripe sandbox integration is real. The adversarial testing was real. And the problem it’s solving balancing fraud prevention against customer experience, with full transparency into every decision is one of the most genuinely interesting problems in applied ML right now.</p><p>If you’ve read this far and you want to see it live, the link is below. Try the 3AM VPN transaction yourself. Watch SHAP tell you exactly why it got blocked.</p><p>And if you’re a CTO or a Tech Lead reading this wondering if the person who built it actually understands it I hope this answered that!</p><p><strong>Live demo:</strong> <a href="https://fraud-guard-ai-five.vercel.app/">https://fraud-guard-ai-five.vercel.app/</a> <em>(Backend on Render free tier give it 30–60 seconds to wake up if it’s cold. The cron job tries its best.)</em></p><p><strong>GitHub:</strong> <a href="https://github.com/3hal0n/fraud-guard-ai">https://github.com/3hal0n/fraud-guard-ai</a></p><p>Thanks for reading. If this was useful, useful, or at least mildly entertaining a clap or two wouldn’t hurt hehe.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bcd5e522c6a7" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/i-built-a-fraud-detection-system-that-explains-itself-heres-what-i-learned-bcd5e522c6a7">I Built a Fraud Detection System That Explains Itself. Here’s What I Learned.</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[WSO2 API Manager: Solving API Calamity in Modern Enterprises]]></title>
            <link>https://medium.com/@shalonfernando52/wso2-api-manager-solving-api-calamity-in-modern-enterprises-6fe457001cb0?source=rss-4527d4ca0611------2</link>
            <guid isPermaLink="false">https://medium.com/p/6fe457001cb0</guid>
            <category><![CDATA[wso2-api-manager]]></category>
            <category><![CDATA[solution-to-api-chaos]]></category>
            <dc:creator><![CDATA[Shalonfernando]]></dc:creator>
            <pubDate>Sun, 07 Sep 2025 15:03:17 GMT</pubDate>
            <atom:updated>2025-10-03T13:43:51.799Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MvxBG3yc_Dhe9xx6KBMx3g.jpeg" /></figure><p>APIs are the backbone of digital businesses. They connect mobile apps, cloud platforms, partner ecosystems, and internal systems. But with growth comes complexity: managing hundreds of APIs across multiple environments creates challenges in <strong>security, scalability, and governance</strong>. They connect ecosystems across mobile, cloud, partners, and internal systems. But as enterprises scale, <strong>API sprawl</strong> sets in hundreds sometimes thousands of APIs spread across multiple teams, clouds, and regions. The result? Security gaps, governance headaches, performance bottlenecks, and missed opportunities for monetization. This is exactly the challenge <strong>WSO2 API Manager</strong> <strong>4.5+ release</strong> is built to solve.</p><h3>The Challenge: API Sprawl</h3><p>Without proper management, enterprises face:</p><p><strong>-Security risks: </strong>APIs exposed without proper authentication/authorization.</p><p><strong>-Lack of visibility</strong>: Who is using which API, and how often?</p><p><strong>-Scalability issues: </strong>Spikes in demand can overwhelm backend services.</p><p><strong>-Versioning headaches</strong>: Rolling out new API versions while maintaining old ones for consumers.</p><h3>How WSO2 API Manager Helps</h3><p>WSO2 API Manager is a <strong>full lifecycle API management solution</strong>, built with an <strong>open-source, cloud-native approach</strong>. Here’s how it addresses the chaos:</p><p>1. <strong>Design &amp; Publish</strong></p><p>- Define APIs with OpenAPI/Swagger.</p><p>- Publish APIs through a customizable developer portal.</p><p>2. <strong>Secure &amp; Control Access</strong></p><p>- Apply authentication(OAuth2, JWT) and authorization policies.</p><p>- Rate limit requests to protect backend services.</p><p>3. <strong>Scale with Microgateways</strong></p><p>- Deploy microgateways in Kubernetes clusters for high performance.</p><p>- Enable hybrid and multi-cloud deployment flexibility.</p><p>4. <strong>Monitor &amp; Analyze</strong></p><p>- Real-time analytics dashboards for API usage.</p><p>- Identify top consumers, error trends, and performance bottlenecks.</p><p>5. <strong>Monetize &amp; Engage Developers</strong></p><p>- Create subscription tiers.</p><p>- Expose APIs to internal or external developer ecosystems.</p><h3>Let’s go for a quick example: Publishing an API</h3><p>Publishing an API with WSO2 API Manager is straightforward:</p><p>1. <strong>Create an API</strong> through the publisher portal(import Swagger or design from scratch).</p><p>2. <strong>Secure it</strong> with OAuth2 scopes.</p><p>3. <strong>Deploy</strong> to the API Gateway.</p><p>4. <strong>Subscribe &amp; Consume</strong> through the developer portal using API keys.</p><p>This workflow transforms an internal service into a secure, discoverable, and consumable API product.</p><h3>Why It Matters</h3><p>By adopting WSO2 API Manager, enterprises move from <strong>ad-hoc API publishing</strong> to a <strong>strategic, governed API ecosystem</strong>. The result?</p><p>-Faster digital innovation.</p><p>- Stronger security posture.</p><p>- Better developer experience.</p><p>- New revenue opportunities through API monetization.</p><h3>In Conclusion</h3><p>APIs are no longer “just interfaces” they are <strong>digital products</strong>. With WSO2 API Manager, organizations can confidently design, secure, scale, and monetize APIs in a way that keeps up with modern business demands.</p><p>Have you used WSO2’s API Manager in your own products? If not I highly recommend giving it a try you might be surprised at how much easier it makes managing and scaling APIs.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6fe457001cb0" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>