<?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: karabo seeisa</title>
    <description>The latest articles on DEV Community by karabo seeisa (@cod434).</description>
    <link>https://dev.to/cod434</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%2F2552233%2F4fcdeb78-5e2e-4419-9009-471297029ee9.jpg</url>
      <title>DEV Community: karabo seeisa</title>
      <link>https://dev.to/cod434</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/cod434"/>
    <language>en</language>
    <item>
      <title>AI Is Making Our Brains Smooth And We Are Paying For It</title>
      <dc:creator>karabo seeisa</dc:creator>
      <pubDate>Thu, 07 May 2026 13:36:27 +0000</pubDate>
      <link>https://dev.to/cod434/have-developers-lost-the-spark-1o6c</link>
      <guid>https://dev.to/cod434/have-developers-lost-the-spark-1o6c</guid>
      <description>&lt;p&gt;I've changed my mind about DSA's, &lt;/p&gt;

&lt;p&gt;you've heard it every where - "leetcode is dying", "You don't need to know DSA, AI is here"&lt;/p&gt;

&lt;p&gt;While I am a big fan of new technologies, I also like to know what I am doing and what my code is doing, that doesn't just give me peace of mind it it saves me time when I am debugging, I don't know about you but I feel lost when I use AI to change  a lot of my code&lt;/p&gt;

&lt;p&gt;Recently I've been reading more code then actually writing, diving into DSA problems, and even  had to refresh my knowledge about Big O notation and more. &lt;/p&gt;

&lt;p&gt;I really enjoy it  and I feel like as devs we have forgotten how to enjoy the process and now see code as means to an end or something like that...&lt;/p&gt;

&lt;p&gt;Personally I find joy in it and I am pretty sure I am not the only one. &lt;/p&gt;

&lt;p&gt;The tools and frameworks didn't make us developers...our curiosity, problem solving, the drive to build, break fix and innovate did + nerding out over  computers,&lt;/p&gt;

&lt;p&gt;Cheers&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>beginners</category>
      <category>ai</category>
    </item>
    <item>
      <title>Security Hardening Update for create-authenik8-app: I fixed the real issues people called out</title>
      <dc:creator>karabo seeisa</dc:creator>
      <pubDate>Mon, 27 Apr 2026 15:34:46 +0000</pubDate>
      <link>https://dev.to/cod434/security-hardening-update-for-create-authenik8-app-i-fixed-the-real-issues-people-called-out-240i</link>
      <guid>https://dev.to/cod434/security-hardening-update-for-create-authenik8-app-i-fixed-the-real-issues-people-called-out-240i</guid>
      <description>&lt;p&gt;Hey everyone,&lt;/p&gt;

&lt;p&gt;I just pushed a bunch of fixes to create-authenik8-app after digging through the security feedback from the community. No new flashy features. Just making the Identity Engine more solid and reliable because auth is not the place to mess around.&lt;/p&gt;

&lt;p&gt;Here is what actually changed and why I touched it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Guest/incognito mode no longer has a fake-auth bypass. The old logic was too loose with non-temp tokens. Now it properly verifies real JWTs, only issues a signed guest token when there is truly no token, rejects invalid bearer tokens with a clean 401, and puts the user on req.user like it should.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Access token sessions are now written to Redis when signToken runs. Refresh tokens also update the session properly on refresh. This was missing before and it made things inconsistent.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;IP whitelisting is safer now. I switched to req.ip by default, added optional trustProxyHeaders support for people behind proxies, and made TTLs per-entry instead of one shared value for the whole set. Raw x-forwarded-for is spoofable so that had to go.&lt;br&gt;
The rate limiter no longer kills the whole app if Redis is down at startup. I made it lazy and it now returns 503 gracefully instead of calling process.exit. A library should never nuke your consumer process like that.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Admin middleware is stricter. requireAdmin now actually checks for role === "admin" and returns 403 fast. Non-admins no longer slip through.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;OAuth providers (Google and GitHub) got cleaned up. Removed plaintext refresh token logging, better profile verification, and the identity resolution now goes through the Redis-backed engine first instead of raw provider data. Unverified emails on GitHub no longer create weird account states.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The Identity Engine itself now defaults to a Redis-backed adapter. No more process-local memory maps that break on restart or in multi-instance setups. Added proper locks and indexes so behavior stays consistent.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I also added new unit and integration tests for these changes and ran the full lint, typecheck, and test suite locally before publishing.&lt;/p&gt;

&lt;p&gt;The package is updated on npm right now (latest version). The CLI and all generated code stay fully open source and inspectable. The core Identity Engine is still closed source for security reasons but the surface is small and the generated apps are yours to own and audit.&lt;/p&gt;

&lt;p&gt;If you tried an earlier version and hit any weirdness with sessions, admin routes, OAuth, or Redis, grab the new one and test it. npx create-authenik8-app my-app still works the same, just more robust under the hood.&lt;/p&gt;

&lt;p&gt;PS: &lt;strong&gt;&lt;em&gt;update to the latest Authenik8-core version&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Repo: &lt;a href="https://github.com/COD434/create-authenik8-app" rel="noopener noreferrer"&gt;https://github.com/COD434/create-authenik8-app&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Example of what it generates: &lt;a href="https://github.com/COD434/create-authenik8-app-example" rel="noopener noreferrer"&gt;https://github.com/COD434/create-authenik8-app-example&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;npm: create-authenik8-app&lt;/p&gt;

&lt;p&gt;Try it if you are tired of copy-pasting JWT + refresh token + Redis + RBAC boilerplate every new project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx create-authenik8-app my-app
&lt;span class="nb"&gt;cd &lt;/span&gt;my-app
redis-server &lt;span class="nt"&gt;--daemonize&lt;/span&gt; &lt;span class="nb"&gt;yes
&lt;/span&gt;npm run dev

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I read every comment and DM. The roasting in the first threads actually helped me tighten things up. If something still feels off or you have ideas for what would make this more trustworthy for real production work, hit me with it.&lt;/p&gt;

&lt;p&gt;If it saves you hours (or prevents a potential security headache), a ⭐ on GitHub helps the project grow .&lt;/p&gt;

&lt;p&gt;Thanks for the honest input so far. Building in public is messy but it beats shipping fragile auth code alone.&lt;/p&gt;

</description>
      <category>buildinpublic</category>
      <category>webdev</category>
      <category>opensource</category>
      <category>security</category>
    </item>
    <item>
      <title>Update: My Phone-Built Auth CLI Hit 270+ Runs in 48 Hours And Already Got Its First Contributor</title>
      <dc:creator>karabo seeisa</dc:creator>
      <pubDate>Thu, 23 Apr 2026 06:27:37 +0000</pubDate>
      <link>https://dev.to/cod434/update-my-phone-built-auth-cli-hit-270-runs-in-48-hours-and-already-got-its-first-contributor-1la3</link>
      <guid>https://dev.to/cod434/update-my-phone-built-auth-cli-hit-270-runs-in-48-hours-and-already-got-its-first-contributor-1la3</guid>
      <description>&lt;p&gt;Two days ago I published “I Built a CLI That Generates Production-Ready Auth Backends in 30 Seconds (While Working From My Phone)”.&lt;/p&gt;

&lt;p&gt;At that point the project had 177 tracked runs.&lt;br&gt;
Since then… things got interesting.&lt;/p&gt;

&lt;p&gt;As of April 22 (just 48 hours later):&lt;/p&gt;

&lt;p&gt;270+ tracked real runs (internal telemetry)&lt;br&gt;
160 runs in a single day (April 21 launch day)&lt;br&gt;
143 of those 160 runs came directly from the GitHub repo   done by only 5 unique people&lt;/p&gt;

&lt;p&gt;Yes, you read that right.&lt;br&gt;
Five strangers landed on the repo, read the README, and between them ran npx create-authenik8-app 143 times in one day.&lt;/p&gt;

&lt;p&gt;That kind of repeat usage from a tiny group of early visitors is the best validation I could ask for.&lt;br&gt;
And yesterday something even better happened.&lt;/p&gt;

&lt;p&gt;I created a few small “[Good First Issue]” labels, including one for adding a clean production-ready /health endpoint to the generated Express + TypeScript templates.&lt;br&gt;
Within hours, snakefood3232&lt;br&gt;
replied saying:&lt;/p&gt;

&lt;p&gt;“I’d handle this by implementing a middleware… Can have a PR up in the next 24 hours. I’ve built similar endpoints for multiple production-level applications…”&lt;/p&gt;

&lt;p&gt;That was my first external contributor.&lt;/p&gt;

&lt;p&gt;I’m still pinching myself.&lt;br&gt;
This whole project started over two years ago as a full auth app, evolved through an SDK and the Identity Engine, and finally became the CLI I built entirely on my Android phone after my laptop died and I quit retail to go full-time.&lt;/p&gt;

&lt;p&gt;Every single run still gives me a little notification, and seeing real people actually using it (and now contributing to it) keeps me going.&lt;br&gt;
What changed in the last 48 hours:&lt;/p&gt;

&lt;p&gt;• Added full SECURITY.md + private vulnerability reporting&lt;br&gt;
• Enabled GitHub Sponsors (the button is now live)&lt;/p&gt;

&lt;p&gt;Created realistic good-first-issues so others can jump in&lt;br&gt;
First community PR is coming in the next day&lt;/p&gt;

&lt;p&gt;If you tried the CLI after my last post , thank you.&lt;br&gt;
If you haven’t yet, here’s the one-command way:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx create-authenik8-app my-app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Repo: &lt;a href="https://github.com/COD434/create-authenik8-app" rel="noopener noreferrer"&gt;https://github.com/COD434/create-authenik8-app&lt;/a&gt;
&lt;/h3&gt;

&lt;h3&gt;
  
  
  Example generated app: &lt;a href="https://github.com/COD434/create-authenik8-app-example" rel="noopener noreferrer"&gt;https://github.com/COD434/create-authenik8-app-example&lt;/a&gt;
&lt;/h3&gt;

&lt;h3&gt;
  
  
  Discussions (come say hi): &lt;a href="https://github.com/COD434/create-authenik8-app/discussions" rel="noopener noreferrer"&gt;https://github.com/COD434/create-authenik8-app/discussions&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;There are still open good-first-issues if you want to be the second contributor 😉&lt;/p&gt;

&lt;p&gt;Would love to hear what you think , drop a comment below with any feedback, what’s missing, or what you built with it.&lt;/p&gt;

&lt;p&gt;This phone-built project is just getting started.&lt;/p&gt;

&lt;p&gt;— Karabo (COD434)&lt;/p&gt;

</description>
      <category>node</category>
      <category>backend</category>
      <category>opensource</category>
      <category>typescript</category>
    </item>
    <item>
      <title>I Built a CLI That Generates Production-Ready Auth Backends in 30 Seconds (While Working From My Phone)</title>
      <dc:creator>karabo seeisa</dc:creator>
      <pubDate>Tue, 21 Apr 2026 10:58:42 +0000</pubDate>
      <link>https://dev.to/cod434/i-built-a-cli-that-generates-production-ready-auth-backends-in-30-seconds-while-working-from-my-48l</link>
      <guid>https://dev.to/cod434/i-built-a-cli-that-generates-production-ready-auth-backends-in-30-seconds-while-working-from-my-48l</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Two months ago I quit my retail job to go full indie.&lt;br&gt;
Then my laptop died.&lt;/p&gt;

&lt;p&gt;Since then, I’ve been building create-authenik8-app entirely on my phone , and it just crossed 177 runs with a new daily record of 51 yesterday.&lt;/p&gt;

&lt;p&gt;The idea was simple: I was tired of starting every new backend project by copy-pasting the same JWT + refresh token + Redis + RBAC code… and often getting parts of the security wrong.&lt;/p&gt;

&lt;p&gt;So I built a CLI that does it correctly from day one.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx create-authenik8-app my-app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;30 seconds later you have a production-ready Express + TypeScript backend with secure authentication already solved.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Problem Most Developers Face
&lt;/h2&gt;

&lt;p&gt;Every backend needs authentication. Yet most of us waste days (sometimes weeks) on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Setting up secure JWT access + refresh tokens with proper rotation&lt;/li&gt;
&lt;li&gt;Implementing replay protection and secure token storage (usually in Redis)&lt;/li&gt;
&lt;li&gt;Handling OAuth account linking without creating duplicate users&lt;/li&gt;
&lt;li&gt;Adding RBAC middleware that actually works&lt;/li&gt;
&lt;li&gt;Wiring up production concerns (rate limiting, Helmet, PM2, memory guards, etc.)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Even with Passport.js or Lucia, you still end up gluing everything together and hoping you didn’t introduce subtle security flaws.&lt;/p&gt;

&lt;p&gt;I wanted something better.&lt;br&gt;
The Solution: &lt;br&gt;
&lt;code&gt;create-authenik8-app&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;create-authenik8-app is not another auth library.&lt;br&gt;
It’s a focused auth system generator that scaffolds a clean, opinionated, production-ready starter.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What you get instantly:&lt;/strong&gt;&lt;br&gt;
✅ JWT (access + refresh tokens) with secure rotation and JTI replay protection&lt;br&gt;
✅ Redis-backed stateful sessions&lt;br&gt;
✅ Built-in RBAC middleware (auth.requireAdmin, etc.)&lt;br&gt;
✅ Google &amp;amp; GitHub OAuth handled intelligently&lt;br&gt;
✅ Prisma support (optional)&lt;br&gt;
✅ Clean scalable folder structure + TypeScript&lt;br&gt;
✅ Auto-generated .env with secure defaults&lt;br&gt;
✅ Production extras (PM2 cluster mode, Helmet, rate limiting, memory guards)&lt;/p&gt;



&lt;p&gt;&lt;strong&gt;The Identity Engine: The Real Differentiator&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;At the core is the Authenik8 Identity Engine (inside authenik8-core).&lt;/p&gt;

&lt;p&gt;Instead of treating auth as separate login flows, it treats authentication as an identity resolution problem.&lt;/p&gt;

&lt;p&gt;It intelligently:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Unifies credentials (email/password) and OAuth providers&lt;/li&gt;
&lt;li&gt;Prevents duplicate identities&lt;/li&gt;
&lt;li&gt;Handles smart account linking&lt;/li&gt;
&lt;li&gt;Normalizes provider profiles into your app’s schema&lt;/li&gt;
&lt;li&gt;Applies consistent security rules across all methods&lt;/li&gt;
&lt;li&gt;This design makes the whole system cleaner, more secure, and much easier to extend (MFA, WebAuthn, etc. are coming).&lt;/li&gt;
&lt;/ul&gt;



&lt;p&gt;&lt;strong&gt;See Exactly What You Get&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I published a real generated example so you can inspect the output without running anything:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;create-authenik8-app-example
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You’ll see clean code, proper middleware usage, and how the Identity Engine is integrated.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Security &amp;amp; Trust&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I know the biggest concern many developers have: “It has a closed-source core , why should I trust it?”&lt;br&gt;
Valid point. Auth is critical.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Here’s my stance:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The CLI is 100% open source ,you can see exactly how everything is wired.&lt;br&gt;
The Identity Engine is closed-source by design (common in security tooling) to protect sensitive implementation details like exact replay protection and token lifecycle logic.&lt;/p&gt;

&lt;p&gt;Everything generated is fully inspectable and uses battle-tested patterns.&lt;br&gt;
I added full CI on every push/PR with a live status badge.&lt;/p&gt;

&lt;p&gt;I’m actively working on more transparency: detailed threat model, SECURITY.md, and future third-party audit.&lt;/p&gt;

&lt;p&gt;My goal is to give solo devs and small teams a much better starting point than copy-paste boilerplate ,while being honest about the trade-offs.&lt;/p&gt;



&lt;p&gt;&lt;strong&gt;My Journey So Far&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Building this on a phone has been chaotic but rewarding.&lt;br&gt;
Every time someone runs the CLI, I get a little notification and it keeps me motivated. The growth has been surprising, from 0 to 177 runs in under two weeks, with strong spikes after sharing updates.&lt;/p&gt;

&lt;p&gt;I’m iterating daily based on feedback (thank you to everyone who’s commented!).&lt;/p&gt;



&lt;p&gt;&lt;strong&gt;Who Is This For?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Solo developers and indie hackers&lt;/li&gt;
&lt;li&gt;Small teams that want to ship fast&lt;/li&gt;
&lt;li&gt;Anyone tired of repeating the same auth setup on every project&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you’re building something real and want auth done correctly without the usual headache, give it a spin.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Try It Now
npx create-authenik8-app my-app
&lt;span class="nb"&gt;cd &lt;/span&gt;my-app
redis-server &lt;span class="nt"&gt;--daemonize&lt;/span&gt; &lt;span class="nb"&gt;yes
&lt;/span&gt;npm run dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Repo: &lt;a href="https://github.com/COD434/create-authenik8-app" rel="noopener noreferrer"&gt;https://github.com/COD434/create-authenik8-app&lt;/a&gt;&lt;br&gt;
Example output: &lt;a href="https://github.com/COD434/create-authenik8-app-example" rel="noopener noreferrer"&gt;https://github.com/COD434/create-authenik8-app-example&lt;/a&gt;&lt;br&gt;
npm: create-authenik8-app&lt;/p&gt;

&lt;p&gt;If it saves you time, a star would mean a lot to this phone-built project ⭐&lt;/p&gt;

&lt;p&gt;I’d love your honest feedback ,what’s missing? What should I improve next?&lt;/p&gt;

</description>
      <category>node</category>
      <category>opensource</category>
      <category>authentication</category>
      <category>cli</category>
    </item>
    <item>
      <title>Building a Secure Auth System in Express (JWT, Redis, Refresh Tokens, and RBAC) and Automating It with a CLI</title>
      <dc:creator>karabo seeisa</dc:creator>
      <pubDate>Sat, 04 Apr 2026 07:46:19 +0000</pubDate>
      <link>https://dev.to/cod434/building-a-secure-auth-system-in-express-jwt-redis-refresh-tokens-and-rbac-and-automating-it-4o0h</link>
      <guid>https://dev.to/cod434/building-a-secure-auth-system-in-express-jwt-redis-refresh-tokens-and-rbac-and-automating-it-4o0h</guid>
      <description>&lt;p&gt;Authentication in Express applications is often underestimated.&lt;/p&gt;

&lt;p&gt;Most implementations stop at “generate a JWT and verify it,” but real-world systems require much more:&lt;/p&gt;

&lt;p&gt;• Refresh token rotation&lt;/p&gt;

&lt;p&gt;• Token invalidation&lt;/p&gt;

&lt;p&gt;• Concurrency safety&lt;/p&gt;

&lt;p&gt;• Role-based access control (RBAC)&lt;/p&gt;

&lt;p&gt;• Stateful tracking (usually via Redis)&lt;/p&gt;

&lt;p&gt;After building this stack multiple times, I decided to formalise it into a reusable system and eventually a CLI that scaffolds it in seconds.&lt;/p&gt;

&lt;p&gt;This post breaks down the architecture behind it and how you can use it.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Problem with Typical JWT Auth
&lt;/h2&gt;

&lt;p&gt;A basic JWT setup usually looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;TypeScript&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;token&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;jwt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sign&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;secret&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;expiresIn&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;15m&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This works for simple cases, but breaks down quickly:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;No Token Revocation&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Once issued, a JWT is valid until it expires.&lt;/p&gt;

&lt;p&gt;You can’t easily invalidate it.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Stateless Refresh = Security Risk&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If refresh tokens are not tracked, they can be reused indefinitely.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Concurrency Issues&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If two refresh requests happen at the same time:&lt;/p&gt;

&lt;p&gt;both can succeed&lt;/p&gt;

&lt;p&gt;multiple valid tokens are created&lt;/p&gt;

&lt;p&gt;This leads to token duplication and potential session abuse.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Architecture I Settled On
&lt;/h2&gt;

&lt;p&gt;To solve these issues&lt;br&gt;
, the system uses:&lt;/p&gt;

&lt;p&gt;Access Tokens (JWT)&lt;/p&gt;

&lt;p&gt;• Short-lived (e.g. 15 minutes)&lt;/p&gt;

&lt;p&gt;• Used for API authentication&lt;/p&gt;

&lt;p&gt;• Stateless verification&lt;/p&gt;

&lt;p&gt;Refresh Tokens (Stateful)&lt;/p&gt;

&lt;p&gt;• Stored in Redis&lt;/p&gt;

&lt;p&gt;• Rotated on every use&lt;/p&gt;

&lt;p&gt;• Old tokens are invalidated&lt;/p&gt;

&lt;p&gt;This gives you control over sessions.&lt;/p&gt;


&lt;h2&gt;
  
  
  Redis as a Token Store
&lt;/h2&gt;

&lt;p&gt;Redis acts as the source of truth for refresh tokens:&lt;/p&gt;

&lt;p&gt;• Track active sessions&lt;/p&gt;

&lt;p&gt;• Invalidate tokens instantly&lt;/p&gt;

&lt;p&gt;• Enforce single-use refresh tokens&lt;/p&gt;


&lt;h2&gt;
  
  
  Refresh Token Rotation
&lt;/h2&gt;

&lt;p&gt;Every refresh request:&lt;/p&gt;

&lt;p&gt;• Verifies the token&lt;/p&gt;

&lt;p&gt;• Checks Redis for validity&lt;/p&gt;

&lt;p&gt;• Deletes the old token&lt;/p&gt;

&lt;p&gt;• Issues a new refresh token&lt;/p&gt;

&lt;p&gt;This ensures:&lt;/p&gt;

&lt;p&gt;A refresh token can only be used once.&lt;/p&gt;


&lt;h2&gt;
  
  
  Concurrency Safety
&lt;/h2&gt;

&lt;p&gt;A key problem is handling simultaneous refresh requests.&lt;/p&gt;

&lt;p&gt;Solution:&lt;/p&gt;

&lt;p&gt;• Atomic operations in Redis&lt;/p&gt;

&lt;p&gt;• Only one request can invalidate + rotate&lt;/p&gt;

&lt;p&gt;• The second request fails with 401&lt;/p&gt;

&lt;p&gt;This prevents replay attacks and token duplication.&lt;/p&gt;


&lt;h2&gt;
  
  
  RBAC (Role-Based Access Control)
&lt;/h2&gt;

&lt;p&gt;Authentication is not enough , you also need authorization.&lt;/p&gt;

&lt;p&gt;Example middleware:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;TypeScript&lt;/span&gt;

&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/admin&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;auth&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;requireAdmin&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

&lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Admin only&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="p"&gt;});&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This ensures only users with the correct role can access protected routes.&lt;/p&gt;

&lt;p&gt;Putting It Together&lt;br&gt;
The system exposes a simple interface:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;TypeScript&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;auth&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;createAuthenik8&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;

&lt;span class="na"&gt;jwtSecret&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;JWT_SECRET&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;

&lt;span class="na"&gt;refreshSecret&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;REFRESH_SECRET&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;

&lt;span class="p"&gt;});&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;From there:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;signToken()&lt;/code&gt; → access tokens&lt;/p&gt;

&lt;p&gt;&lt;code&gt;generateRefreshToken()&lt;/code&gt; → refresh tokens&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Refresh token()&lt;/code&gt; → rotation logic&lt;/p&gt;

&lt;p&gt;&lt;code&gt;requireAdmin&lt;/code&gt; → RBAC middleware&lt;/p&gt;

&lt;p&gt;Automating the Setup&lt;br&gt;
After building this repeatedly, I created a CLI to remove the setup step entirely:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Bash

npx create-authenik8-app my-app

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This generates:&lt;/p&gt;

&lt;p&gt;• Express + TypeScript project&lt;/p&gt;

&lt;p&gt;• JWT + refresh token system&lt;/p&gt;

&lt;p&gt;• Redis integration&lt;/p&gt;

&lt;p&gt;•RBAC middleware&lt;/p&gt;

&lt;p&gt;• Preconfigured routes&lt;/p&gt;

&lt;p&gt;You can go from zero → running auth server in minutes.&lt;/p&gt;

&lt;p&gt;Why Redis is Required&lt;br&gt;
A common question is: “Why not keep everything stateless?”&lt;/p&gt;

&lt;p&gt;Because:&lt;/p&gt;

&lt;p&gt;• You can’t revoke tokens&lt;/p&gt;

&lt;p&gt;• You can’t prevent reuse&lt;/p&gt;

&lt;p&gt;• You can’t track sessions&lt;/p&gt;

&lt;p&gt;Redis enables:&lt;/p&gt;

&lt;p&gt;• Immediate invalidation&lt;/p&gt;

&lt;p&gt;• Session tracking&lt;/p&gt;

&lt;p&gt;• Single-use refresh tokens&lt;/p&gt;


&lt;h2&gt;
  
  
  Trade-offs
&lt;/h2&gt;

&lt;p&gt;This approach introduces:&lt;/p&gt;

&lt;p&gt;• External dependency (Redis)&lt;/p&gt;

&lt;p&gt;• Slight complexity increase&lt;/p&gt;

&lt;p&gt;• Network latency for token validation&lt;/p&gt;

&lt;p&gt;But in exchange, you get:&lt;/p&gt;

&lt;p&gt;• Proper session control&lt;/p&gt;

&lt;p&gt;• Stronger security guarantees&lt;/p&gt;

&lt;p&gt;• Predictable auth behavior&lt;/p&gt;


&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Authentication is one of those systems that seems simple until it isn’t.&lt;/p&gt;

&lt;p&gt;The difference between a basic implementation and a production-ready one is:&lt;/p&gt;

&lt;p&gt;• handling edge cases&lt;/p&gt;

&lt;p&gt;• controlling state&lt;/p&gt;

&lt;p&gt;• preventing abuse&lt;/p&gt;

&lt;p&gt;This project started as a way to standardize those decisions and avoid rewriting the same logic repeatedly.&lt;/p&gt;

&lt;p&gt;If you’ve built auth systems before, I’d be interested in how you approach:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;refresh token handling&lt;/li&gt;
&lt;li&gt;revocation strategies&lt;/li&gt;
&lt;li&gt;concurrency edge cases&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Links:&lt;br&gt;
Authenik8 site:&lt;a href="https://authenik8.vercel.app/" rel="noopener noreferrer"&gt;https://authenik8.vercel.app/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Gitlab: &lt;a href="https://gitlab.com/COD434/create-authenik8-app" rel="noopener noreferrer"&gt;https://gitlab.com/COD434/create-authenik8-app&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Tiktok: &lt;a href="https://www.tiktok.com/@thesbd8?%5C_r=1&amp;amp;%5C_t=ZS-9577WVfucT4" rel="noopener noreferrer"&gt;https://www.tiktok.com/@thesbd8?\_r=1&amp;amp;\_t=ZS-9577WVfucT4&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Try It&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Bash

npx create-authenik8-app my-app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Closing
&lt;/h2&gt;

&lt;p&gt;If you’re working with Express and need a solid starting point for authentication, this should save you a significant amount of setup time.&lt;/p&gt;

&lt;p&gt;Feedback is welcome.&lt;/p&gt;

</description>
      <category>api</category>
      <category>redis</category>
      <category>buildinpublic</category>
      <category>architecture</category>
    </item>
    <item>
      <title>RabbitMQ: The Superhero My API Didn’t Know It Needed</title>
      <dc:creator>karabo seeisa</dc:creator>
      <pubDate>Mon, 28 Jul 2025 13:20:16 +0000</pubDate>
      <link>https://dev.to/cod434/rabbitmq-the-superhero-my-api-didnt-know-it-needed-njp</link>
      <guid>https://dev.to/cod434/rabbitmq-the-superhero-my-api-didnt-know-it-needed-njp</guid>
      <description>&lt;p&gt;&lt;strong&gt;The Problem: Hanging Requests, Delivered Emails&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In my Node.js API, users register and receive a verification email. Simple, right?&lt;/p&gt;

&lt;p&gt;But something strange kept happening:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The email would be sent&lt;/li&gt;
&lt;li&gt;But the HTTP request would hang&lt;/li&gt;
&lt;li&gt;The client got no response&lt;/li&gt;
&lt;li&gt;My logs showed timeouts&lt;/li&gt;
&lt;li&gt;And eventually… crashed sockets&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After digging, I realized:&lt;/p&gt;

&lt;p&gt;The SMTP email-sending process was blocking the main thread just long enough to let the HTTP connection time out.&lt;/p&gt;

&lt;p&gt;This was a race condition: my API was waiting for the SMTP server to respond, while the client’s connection was waiting for me.&lt;/p&gt;




&lt;p&gt;The Insight: Decouple the Work&lt;/p&gt;

&lt;p&gt;I realized I was making the email-sending part synchronous, tying the API response to something slow (SMTP).&lt;/p&gt;

&lt;p&gt;That’s when I remembered the concept of queuing so I did some research and found that personally I liked RabbitMQ.&lt;/p&gt;




&lt;p&gt;How I Fixed This Issue&lt;/p&gt;

&lt;p&gt;Here’s what I did:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; The /register route publishes a message to a RabbitMQ queue (emailQueue)&lt;/li&gt;
&lt;li&gt; A separate email worker subscribes to the queue&lt;/li&gt;
&lt;li&gt; The worker handles the SMTP email process asynchronously&lt;/li&gt;
&lt;li&gt; Meanwhile, the API responds immediately to the client&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Here's What Achieved:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No more hanging sockets&lt;/li&gt;
&lt;li&gt; Emails still go out&lt;/li&gt;
&lt;li&gt; Race condition avoided&lt;/li&gt;
&lt;li&gt;Clean separation of concerns&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;strong&gt;Why I Chose RabbitMQ?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I could’ve tried background threads or retry logic. But RabbitMQ gave me:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Message durability&lt;/li&gt;
&lt;li&gt;Retry control&lt;/li&gt;
&lt;li&gt;A proper job queue&lt;/li&gt;
&lt;li&gt;A decoupled architecture I can scale later&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And now, I can apply this same technique for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Password resets&lt;/li&gt;
&lt;li&gt;Event logs&lt;/li&gt;
&lt;li&gt;Audit trails&lt;/li&gt;
&lt;li&gt;Even SMS messages or 2FA &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Call me a nerd but I think that's cool.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Implementation:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is the publisher - gets the request to send a verification email, drops it into a queue, and the worker handles the rest . simple, fast, and scalable.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export const publishToQueue = async (queue: string, message: any)=&amp;gt;{
if(!channel)
throw new Error("RabbitMQ channel not initialized");
channel.sendToQueue(queue,Buffer.from(JSON.stringify(message)),{persistent: true});
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is the worker - It consumes messages form the queue and sends the email asynchronously,without delaying the HTTP response to the client .&lt;/p&gt;

&lt;p&gt;That means users don't wait around for an email to send = much better UX if you ask me&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;channel.consume("emailQueue",async (msg) =&amp;gt;{
if(msg !== null){
const {email,verifyToken} = JSON.parse(msg.content.toString())
await sendVerificationEmail(email,verifyToken);
channel.ack(msg)
}
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Final Thoughts&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If your API does more than just respond to users — like sending emails or talking to 3rd parties — don’t make it wait.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;RabbitMQ helped me move that responsibility out of the request cycle and made my code faster, safer, and easier to maintain.&lt;/p&gt;

&lt;p&gt;I also plan to use it in the near future.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Let’s Connect&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Have you hit similar issues in your backend? let me know how you tackled async tasks or race conditons.&lt;/p&gt;

&lt;p&gt;Here's how I implemented it might spark something in your project :&lt;a href="//www.github.com/COD434/Authenik8"&gt;Github&lt;/a&gt;&lt;/p&gt;

</description>
      <category>node</category>
      <category>webdev</category>
      <category>opensource</category>
      <category>typescript</category>
    </item>
    <item>
      <title>A Plug and Play Auth API</title>
      <dc:creator>karabo seeisa</dc:creator>
      <pubDate>Sun, 13 Jul 2025 14:39:58 +0000</pubDate>
      <link>https://dev.to/cod434/a-plug-and-play-auth-api-59bi</link>
      <guid>https://dev.to/cod434/a-plug-and-play-auth-api-59bi</guid>
      <description>&lt;p&gt;From "Simple Form" to Full Pure Backend Auth API—Here’s What I Learned  &lt;/p&gt;

&lt;p&gt;I thought building a form would be easy. Spoiler: I was wrong.  &lt;/p&gt;

&lt;p&gt;What started as a basic CRUD app quickly spiraled into a deep dive into:&lt;br&gt;&lt;br&gt;
✔️ Token-based authentication (JWT)&lt;br&gt;&lt;br&gt;
✔️ Password hashing &amp;amp; encryption&lt;br&gt;&lt;br&gt;
✔️ Role-based access control&lt;/p&gt;

&lt;p&gt;✔️ Redis-rate-limiting&lt;br&gt;
And some other cool features&lt;/p&gt;

&lt;p&gt;Turns out, the "Login with Google" button I mindlessly click every day? Way more complex under the hood. &lt;/p&gt;

&lt;p&gt;I built this Auth API to demystify the process with security, docs, and scalability in mind. Perfect for devs who:&lt;br&gt;&lt;br&gt;
🔹 Want to see auth workflows stripped bare&lt;br&gt;&lt;br&gt;
🔹 Need a reference for their next project  &lt;/p&gt;

&lt;p&gt;Check it out &amp;amp; roast my code: (&lt;a href="https://github.com/COD434/Auth-System-API" rel="noopener noreferrer"&gt;https://github.com/COD434/Auth-System-API&lt;/a&gt;)  &lt;/p&gt;

&lt;p&gt;Question for you:&lt;br&gt;
What’s the most "simple" feature that surprised you with its complexity?  &lt;/p&gt;

</description>
      <category>webdev</category>
      <category>opensource</category>
      <category>backend</category>
      <category>node</category>
    </item>
  </channel>
</rss>
