<?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 Franlopz on Medium]]></title>
        <description><![CDATA[Stories by Franlopz on Medium]]></description>
        <link>https://medium.com/@franlopz10?source=rss-52c9216fa994------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*3r4Bx4e3bJEZTAZE</url>
            <title>Stories by Franlopz on Medium</title>
            <link>https://medium.com/@franlopz10?source=rss-52c9216fa994------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 17:08:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@franlopz10/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[Understanding and Fixing Circular Dependencies in NestJS]]></title>
            <link>https://medium.com/@franlopz10/understanding-and-fixing-circular-dependencies-in-nestjs-824aa70977c4?source=rss-52c9216fa994------2</link>
            <guid isPermaLink="false">https://medium.com/p/824aa70977c4</guid>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[nestjs-provider]]></category>
            <category><![CDATA[nestjs-module]]></category>
            <category><![CDATA[nestjs-tutorial]]></category>
            <category><![CDATA[nestjs]]></category>
            <dc:creator><![CDATA[Franlopz]]></dc:creator>
            <pubDate>Wed, 08 Apr 2026 01:02:30 GMT</pubDate>
            <atom:updated>2026-04-08T01:03:31.757Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/979/1*_wgktzhViLPlbYD7AllyWQ.png" /></figure><p><em>A practical approach to untangling module cycles before they blow up at runtime</em></p><p>Have you ever been working on a NestJS project, adding a new feature, wiring up modules — everything looks fine — and then suddenly your app crashes at startup with one of those cryptic errors that just says `Cannot read properties of undefined`? You check your code, your imports look correct, your providers are registered, everything <em>should</em> work. And yet, it doesn’t.</p><p>A few months ago, I was working on a mid-sized NestJS monolith an e-commerce platform with around 30 modules. We were in the middle of adding an order notification feature, and the <strong>OrdersModule</strong> needed access to <strong>UsersService</strong> to fetch customer emails. Simple enough, right? Import <strong>UsersModule</strong> into <strong>OrdersModule</strong>, inject the service, done. Except <strong>UsersModule</strong> already imported <strong><em>OrdersModule</em></strong> because users needed to see their order history. The moment I hit `npm run start:dev`, the whole thing collapsed. No meaningful stack trace, just `undefined` everywhere.</p><p>That’s when I went down the rabbit hole of <strong>circular module dependencies</strong> in NestJS.</p><blockquote><em>If you already know what circular dependencies are and just want the fix, you can </em><strong>jump right to “The Fix” </strong><em>section below.</em></blockquote><h3><strong>What Are Circular Dependencies?</strong></h3><p>A <strong>circular dependency</strong> occurs when two or more modules depend on each other, directly or indirectly, forming a loop.</p><p>A useful way to think of it is like two people trying to enter a door at the same time, each one is waiting for the other to go first, and neither can move forward.</p><p>In its simplest form, it looks like this:</p><pre>UsersModule  ──imports──&gt;  OrdersModule<br>     ^                          |<br>     |                          |<br>     └────────imports───────────┘</pre><blockquote><strong>UsersModule</strong> imports <strong>OrdersModule</strong>, and <strong>OrdersModule</strong> imports <strong>UsersModule</strong>. A perfect circle. But it doesn’t have to be this obvious you could have a chain of three, four, or even ten modules where A imports B, B imports C, and C imports A. The longer the chain, the harder it is to spot by just reading the code.</blockquote><h4><strong>Why NestJS Makes It Easy to Create Them</strong></h4><p>NestJS has a beautiful module system. Each feature lives in its own module, modules declare their providers, and if Module A needs something from Module B, it just imports it. Clean, explicit, modular.</p><p>The problem is that as your application grows, the relationships between modules get more complex. The <strong>UsersModule</strong> starts needing things from <strong>OrdersModule</strong>, <strong>PaymentsModule</strong>, <strong>NotificationsModule</strong> and those modules need things from <strong>UsersModule</strong> too. It’s the natural evolution of a growing codebase, and before you know it, you’ve created a cycle.</p><blockquote>Bear in mind, NestJS evaluates modules in a specific order during initialization. When Module A imports Module B, NestJS resolves B first, then comes back to finish A. But if B <em>also </em>imports A, NestJS encounters A again before it’s fully initialized. The result? One of the modules ends up as <strong>undefined</strong>.</blockquote><h4><strong>The Problem</strong></h4><p>Here’s what the code typically looks like when you’ve accidentally created a circular dependency:</p><pre>// users.module.ts<br>@Module({<br>  imports: [OrdersModule],<br>  controllers: [UsersController],<br>  providers: [UsersService],<br>  exports: [UsersService],<br>})<br>export class UsersModule {}<br><br>// orders.module.ts<br>@Module({<br>  imports: [UsersModule],<br>  providers: [OrdersService],<br>  exports: [OrdersService],<br>})<br>export class OrdersModule {}</pre><p>This compiles fine. TypeScript won’t complain. ESLint won’t catch it. Your IDE won’t warn you. But the moment NestJS tries to bootstrap, you’ll see something like:</p><pre>TypeError: Cannot read properties of undefined (reading &#39;UsersService&#39;)</pre><h4><strong>Detecting Them with nestjs-doctor</strong></h4><p>This is where <strong>static analysis </strong>comes in. Instead of waiting for the runtime to explode, we can analyze the module graph <em>before</em> the app even starts.</p><p><a href="https://github.com/RoloBits/nestjs-doctor">nestjs-doctor</a> is a static analysis CLI and VS Code extension for NestJS projects. Among its 50+ rules, it includes `<em>architecture/no-circular-module-deps</em>`, a rule specifically designed to detect circular module dependencies.</p><p>Let’s set it up:</p><pre>npm install - save-dev nestjs-doctor &amp;&amp;<br>npx nestjs-doctor</pre><p>That is pretty much it! If your project has circular dependencies, the output will look something like this:</p><pre>  91 / 100  Excellent<br><br>  ✗ Circular module dependency detected: UsersModule -&gt; OrdersModule -&gt; UsersModule<br>    UsersModule -&gt; OrdersModule: UsersService (in UsersModule) injects OrdersService (from OrdersModule)<br>    OrdersModule -&gt; UsersModule: OrdersService (in OrdersModule) injects UsersService (from UsersModule)<br>    Consider extracting OrdersService into a shared module — it would break the<br>    OrdersModule -&gt; UsersModule edge (1 dependency).</pre><h3><strong>The Fix</strong></h3><p>There is no silver bullet to kill all circular dependency issues, but there are three strategies that cover most cases. Let’s delve into each one.</p><h4><strong>1. Extract a Shared Module (Recommended)</strong></h4><p>This is the cleanest solution. If `UsersModule` and `OrdersModule` both need some shared logic, extract it into a third module that both can import without creating a cycle.</p><p><strong>Before</strong> (circular):</p><pre>// users.module.ts<br>@Module({<br>  imports: [OrdersModule],  // UsersService needs OrdersService<br>  providers: [UsersService],<br>  exports: [UsersService],<br>})<br>export class UsersModule {}<br><br>// orders.module.ts<br>@Module({<br>  imports: [UsersModule],  // OrdersService needs UsersService<br>  providers: [OrdersService],<br>  exports: [OrdersService],<br>})<br>export class OrdersModule {}</pre><p><strong>After</strong> (clean):</p><pre>// shared.module.ts<br>@Module({<br>  providers: [UserLookupService, OrderLookupService],<br>  exports: [UserLookupService, OrderLookupService],<br>})<br>export class SharedModule {}<br><br>// users.module.ts<br>@Module({<br>  imports: [SharedModule],  // No more circular!<br>  providers: [UsersService],<br>  exports: [UsersService],<br>})<br>export class UsersModule {}<br><br>// orders.module.ts<br>@Module({<br>  imports: [SharedModule],  // No more circular!<br>  providers: [OrdersService],<br>  exports: [OrdersService],<br>})<br>export class OrdersModule {}</pre><blockquote>The key insight is to identify <em>what</em> each module actually needs from the other and move that into a shared place. Often, it’s a small subset of functionality</blockquote><h4><strong>2. Use forwardRef() (Escape Hatch)</strong></h4><p>NestJS provides `forwardRef()` as an explicit mechanism to handle circular dependencies. It tells the framework to resolve the reference lazily:</p><pre>// users.module.ts<br>@Module({<br>  imports: [forwardRef(() =&gt; OrdersModule)],<br>  providers: [UsersService],<br>  exports: [UsersService],<br>})<br>export class UsersModule {}<br><br>// orders.module.ts<br>@Module({<br>  imports: [forwardRef(() =&gt; UsersModule)],<br>  providers: [OrdersService],<br>  exports: [OrdersService],<br>})<br>export class OrdersModule {}</pre><blockquote>This works, but I’d consider it an <strong>escape hatch</strong>, not a solution. It masks the architectural problem rather than fixing it. Your module graph still has a cycle you’ve just told NestJS to tolerate it. For quick fixes or legacy code where refactoring isn’t feasible, it’s acceptable. For new code, prefer the shared module approach.</blockquote><h4><strong>3. Restructure Responsibilities</strong></h4><p>Sometimes the circular dependency is a signal that your module boundaries are wrong. If <strong><em>UsersModule</em></strong> and <strong><em>OrdersModule</em></strong> are tightly coupled, maybe they should be one module. Or maybe the responsibility that creates the cycle belongs somewhere else entirely.</p><blockquote>Ask yourself: <em>Does UsersService really need to know about orders, or does it just need a user’s recent activity?</em> If it’s the latter, maybe an <strong>ActivityModule</strong> is the right abstraction.</blockquote><h3><strong>Sum Up</strong></h3><p>Circular module dependencies in NestJS are sneaky, they compile fine, pass linting, and only reveal themselves at runtime with unhelpful error messages. The key takeaways:</p><p>- <strong>Static analysis catches them before runtime.</strong> Run `npx nestjs-doctor` as part of your development workflow or CI pipeline.</p><p>- <strong>Extract shared modules</strong> to break cycles cleanly. Don’t reach for `forwardRef()` as a first resort.</p><p>- <strong>The diagnostic output tells you where to cut.</strong> It traces provider-level dependencies and suggests the weakest link.</p><p>- <strong>Circular dependencies are often a design signal.</strong> If two modules are tightly coupled, reconsider your module boundaries.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=824aa70977c4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Your Phone Can Already Prove a Photo Is Real. Nothing Uses It.]]></title>
            <link>https://medium.com/@franlopz10/your-phone-can-already-prove-a-photo-is-real-nothing-uses-it-57a4c3ca2d54?source=rss-52c9216fa994------2</link>
            <guid isPermaLink="false">https://medium.com/p/57a4c3ca2d54</guid>
            <category><![CDATA[agents]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[mobile-development]]></category>
            <dc:creator><![CDATA[Franlopz]]></dc:creator>
            <pubDate>Tue, 17 Feb 2026 14:08:50 GMT</pubDate>
            <atom:updated>2026-02-17T14:08:50.020Z</atom:updated>
            <content:encoded><![CDATA[<p>Every phone sold in the last five years has a crypto chip inside it. On iPhone its called Secure Enclave. On Android its StrongBox or TEE. These chips protect Face ID and banking apps but when it comes to proving a photo is real they just sit there doing nothing.</p><p>And right now anyone with Midjourney can make a photo that fools everyone.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xVzB4dl22F_AHt4k9KB-iA.png" /></figure><h3>What C2PA does</h3><p>C2PA is backed by Adobe, Microsoft, Intel and others. It bakes a signed manifest into the JPEG. What device took it. When. Where. Every edit after. You change one pixel and verification breaks.</p><p>Leica, Sony and Nikon ship this in their cameras. But those are $5,000 cameras. On phones, where 90%+ of photos happen, nothing does this.</p><h3>The package</h3><p>attestation-photo-mobile is a React Native package. You take a photo with whatever camera lib you use. Pass the path. It hashes the image, signs it with a hardware key that never leaves the chip, and writes a C2PA manifest into the file before saving.</p><p>No server. No cloud. All on device.</p><p>I wrote the signing core in Rust on top of c2pa-rs because I tried JS first and it was painfully slow. Native layer is Swift and Kotlin for the hardware stuff. The bridge gives you one hook and one function.</p><h3>The code</h3><pre>import { useAttestedCapture, saveToGallery } from &#39;@rolobits/attestation-photo-mobile&#39;;<br><br>function CaptureScreen() {<br>  const { signPhoto, isReady } = useAttestedCapture({<br>    includeLocation: true,<br>    appName: &quot;My App&quot;,<br>    nonce: &quot;server-challenge-token&quot;,<br>  });<br><br>  const onCapture = async (photoPath) =&gt; {<br>    const signed = await signPhoto(photoPath);<br>    await saveToGallery({ filePath: signed.path });<br>  };<br>}</pre><p>One call. The JPEG comes out with a full C2PA manifest. You can verify it at verify.contentauthenticity.org or with c2patool from the command line.</p><h3>Where you would use this</h3><p><strong><em>Insurance apps.</em></strong> Someone gets in a car accident, takes photos of the damage. Right now nothing stops them from sending edited photos or stuff pulled from Google Images. With signed photos the backend can check the manifest and know it came from a real device at that location on that date.</p><p><strong><em>Marketplace listings</em></strong>. Every platform has fake photos. That apartment doesnt look like that in real life and you know it. Signed photos let you show a badge that actually means something because the image is tied to a physical device and GPS coordinates.</p><p><strong><em>Field work. </em></strong>Construction sites, equipment checks, environmental audits. Anywhere you need proof you were actually there and this is what it looked like.</p><p><strong><em>KYC selfies.</em></strong> Deepfakes can get past basic liveness checks. A signed selfie proves it came from a real camera, not a screen recording of a generated face.</p><h3>Why I think this matters</h3><p>The hardware to do this is already in billions of phones. The standard is done. The big companies are on board. The missing piece is mobile, where most photos actually get taken.</p><p>Open source. MIT. Rust core, Swift and Kotlin bridges, React Native 0.73+.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=57a4c3ca2d54" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CAPTCHA is Dead]]></title>
            <link>https://medium.com/@franlopz10/captcha-is-dead-b595671297a0?source=rss-52c9216fa994------2</link>
            <guid isPermaLink="false">https://medium.com/p/b595671297a0</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[human-behavior]]></category>
            <category><![CDATA[bot-detection]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[captcha]]></category>
            <dc:creator><![CDATA[Franlopz]]></dc:creator>
            <pubDate>Mon, 09 Feb 2026 00:00:43 GMT</pubDate>
            <atom:updated>2026-02-09T00:01:23.823Z</atom:updated>
            <content:encoded><![CDATA[<h3>Why the “Dead Internet” needs a heartbeat, not a checkbox.</h3><p>In late 2024, researchers at ETH Zurich quietly published an obituary for the web as we know it. They didn’t call it that, of course. They called it <em>“Breaking reCAPTCHAv2.”</em></p><p>Their findings were stark: modern AI models (specifically YOLO-based vision models) can now solve Google’s image CAPTCHA with <strong>100% accuracy</strong>.</p><p>Read that again. <strong>100%.</strong></p><p>The Turing Test hasn’t just been passed; it’s been automated, containerized, and scaled. The “I am not a robot” checkbox is now effectively a “Welcome” mat for bots.</p><p>And the consequences are already here. According to the 2025 Imperva Bad Bot Report, automated traffic has officially surpassed human traffic, accounting for <strong>51% of all internet activity</strong>. The “Dead Internet Theory” idea is that the web is just bots arguing with bots; it is no longer a conspiracy. It’s a statistical probability.</p><p>We are losing the web. Not to hackers, but to noise. If we want to save it, we need to stop asking users to identify fire hydrants and start listening to their heartbeat.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Wz1zv7rE-v3pgnBUI3TLKw.png" /></figure><h3>The Identity Crisis</h3><p>The knee-jerk reaction from governments and tech giants is <strong>“Proof of Personhood”</strong> via digital ID. They want you to scan your passport to use social media. They want to link your biometric face data to your Reddit account.</p><p>This is a dystopian overcorrection.</p><p>We don’t need to know <em>who</em> you are (identity). We just need to know <em>what</em> you are (humanity).</p><p>We need a signal that is intrinsic to biology but detached from identity. We need <strong>Proof of Rhythm</strong>.</p><h3>The Human Cadence</h3><p>Humans are messy. We are beautifully, consistently imperfect.</p><p>When you type a comment, you don’t hit keys at a perfect 150ms interval. You “rollover” keys (pressing the next one before releasing the last). You pause to think before typing a complex word. You speed up on common bigrams like “th” or “er.”</p><p>This is your <strong>Keystroke Dynamics</strong> signature. It is a behavioral biometric that is incredibly hard for bots to fake convincingly without slowing them down to useless human speeds.</p><p>Bots operate in loops. Humans operate in cadences.</p><h3>Enter isHumanCadence</h3><p>This is why I built <a href="https://github.com/RoloBits/isHumanCadence"><strong>isHumanCadence</strong></a>.</p><p>It is not just another bot blocking library. It is a proposal for a new standard of web interaction.</p><p>It works by analyzing the <em>timing</em> of keystrokes, not the content. It looks at <strong>dwell time</strong> (how long a key is pressed), <strong>flight time</strong> (the gap between keys), and <strong>entropy</strong> (the randomness of the rhythm).</p><p>It runs entirely in the browser. It sends no data to a server. It doesn’t know <em>what</em> you typed, only <em>how</em> you typed it.</p><ul><li><strong>Score 0.0:</strong> You are a script injecting text instantly.</li><li><strong>Score 0.5:</strong> You are a sophisticated bot trying to add random delays (but failing the statistical variance tests).</li><li><strong>Score 1.0:</strong> You are a human, struggling to find the right word, making micro-pauses, and typing with the frantic, irregular rhythm of a living being.</li></ul><h3>The Reality Check: A Proof of Concept</h3><p>Let’s be clear: <a href="https://github.com/RoloBits/isHumanCadence"><strong>isHumanCadence</strong></a><strong> is currently a Proof of Concept (PoC).</strong></p><p>Right now, this library detects standard scripted bots and even some sophisticated ones using randomized delays. However, “Generative Keystrokes” are the next frontier. Eventually, AI agents will be trained on massive datasets of human typing patterns to spoof these very metrics. They will learn to “stumble” on purpose.</p><p>Furthermore, client-side security is inherently trustless. A determined attacker can always spoof the browser environment.</p><p>This package is not a silver bullet. It is a conversation starter.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b595671297a0" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>