<?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>Forem: Nathan Kamokoue</title>
    <description>The latest articles on Forem by Nathan Kamokoue (@nathan_kamokoue).</description>
    <link>https://forem.com/nathan_kamokoue</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%2F3800342%2F753d76d1-52fd-4748-a703-54a07c4fb8a7.jpg</url>
      <title>Forem: Nathan Kamokoue</title>
      <link>https://forem.com/nathan_kamokoue</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/nathan_kamokoue"/>
    <language>en</language>
    <item>
      <title>How I built an architecture diagram tool that actually stays in sync with your code</title>
      <dc:creator>Nathan Kamokoue</dc:creator>
      <pubDate>Tue, 03 Mar 2026 10:05:12 +0000</pubDate>
      <link>https://forem.com/nathan_kamokoue/how-i-built-an-architecture-diagram-tool-that-actually-stays-in-sync-with-your-code-1jdi</link>
      <guid>https://forem.com/nathan_kamokoue/how-i-built-an-architecture-diagram-tool-that-actually-stays-in-sync-with-your-code-1jdi</guid>
      <description>&lt;p&gt;I've been frustrated by the same problem for years.&lt;/p&gt;

&lt;p&gt;You join a new project. There's no architecture documentation. Or worse — there is documentation, but it describes a system that no longer exists. Someone drew a beautiful diagram in Q1. By Q3, three refactors later, it's a historical artifact. Everyone still references it. Everyone knows it's wrong. Nobody updates it.&lt;/p&gt;

&lt;p&gt;That's not laziness. That's just how software works.&lt;/p&gt;

&lt;p&gt;I spent the last year building BlueLens to fix this. Not as a documentation tool — as a synchronization engine. Here's what I learned.&lt;/p&gt;




&lt;h2&gt;
  
  
  The insight that changed everything
&lt;/h2&gt;

&lt;p&gt;The standard mental model for architecture diagrams is: &lt;em&gt;write code first, document second&lt;/em&gt;. The diagram is a derivative artifact. It describes what the code does.&lt;/p&gt;

&lt;p&gt;That model is broken by design. A derivative artifact will always lag behind its source. The moment you stop updating it — which is always, because you're shipping — it starts lying.&lt;/p&gt;

&lt;p&gt;The insight behind BlueLens: &lt;strong&gt;flip the relationship&lt;/strong&gt;. The diagram shouldn't document the code. The diagram should &lt;em&gt;be&lt;/em&gt; the source of truth. You design the system visually. AI writes the implementation. BlueLens keeps both honest.&lt;/p&gt;

&lt;p&gt;In the AI coding era, this isn't just a philosophy — it's becoming the natural workflow. You describe systems. AI generates code. The diagram is the language.&lt;/p&gt;




&lt;h2&gt;
  
  
  What BlueLens does differently
&lt;/h2&gt;

&lt;p&gt;Most architecture tools are static. You open them, draw something, close them. The diagram lives in a separate universe from your codebase.&lt;/p&gt;

&lt;p&gt;BlueLens has three things I haven't seen combined elsewhere:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. CodeGraph — automatic architecture maps from any repo
&lt;/h3&gt;

&lt;p&gt;Point BlueLens at a local repo and it generates an interactive architecture map automatically. No manual diagramming. It builds a hierarchical model:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;D0 — System&lt;/strong&gt;: the top-level view, major modules&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;D1 — Module&lt;/strong&gt;: functional groupings within the system
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;D2 — File&lt;/strong&gt;: individual files and their relationships&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;D3 — Symbol&lt;/strong&gt;: functions, classes, exports&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The grouping uses a two-agent LLM pipeline — one agent proposes the structure, another validates it — with a heuristic fallback when AI isn't available. I ran it on the BlueLens repo itself: 413 nodes, 946 relations, generated in seconds.&lt;/p&gt;

&lt;p&gt;Every node in the CodeGraph links directly to its source code. Click a node, read the code. No searching.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Drill-down navigation across multiple abstraction levels
&lt;/h3&gt;

&lt;p&gt;Most diagram tools give you one flat view. BlueLens lets you link any diagram node to a sub-diagram. Click to go deeper, breadcrumb to come back.&lt;/p&gt;

&lt;p&gt;In practice: you have a system-level diagram (D0). You click on the "Auth" module. It opens the module-level diagram (D1) for Auth. You click on a specific service. It opens a file-level diagram (D2). You click on a function node. It opens the source code.&lt;/p&gt;

&lt;p&gt;Four clicks from "I have no idea how auth works" to "I'm reading the exact function that handles token refresh." No grep. No file searching. No mental mapping.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. An AI agent that actually traverses your workspace
&lt;/h3&gt;

&lt;p&gt;This is the part I'm most proud of technically.&lt;/p&gt;

&lt;p&gt;Most "AI diagram tools" inject static context into a prompt — the current diagram as text, maybe some metadata. BlueLens gives the agent real tools:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;list_diagrams()
get_diagram(id)
list_node_links(node_id)
get_graph_nodes(graph_id)
get_node_source(node_id)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The agent runs a real tool-use loop. When you ask "explain the authentication flow," it doesn't answer from static context. It navigates your workspace autonomously — traversing sub-diagrams, reading node links, querying the code graph — before constructing its answer.&lt;/p&gt;

&lt;p&gt;The difference in answer quality is significant. Static context injection gives you a summary of what you already have open. Tool-use traversal gives you answers about your entire system, including parts you weren't looking at.&lt;/p&gt;




&lt;h2&gt;
  
  
  The technical decisions worth explaining
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Why client-side only
&lt;/h3&gt;

&lt;p&gt;BlueLens is a React app with no backend. All data lives in &lt;code&gt;localStorage&lt;/code&gt; and &lt;code&gt;IndexedDB&lt;/code&gt;. Your code never leaves your machine.&lt;/p&gt;

&lt;p&gt;This was a deliberate trade-off. The alternative — uploading your codebase to a server for analysis — is faster to build but creates a trust problem. Most developers are reasonably uncomfortable sending proprietary code to a third-party service.&lt;/p&gt;

&lt;p&gt;Client-side only eliminates that concern entirely. The downside: no real-time collaboration, no cloud storage, no cross-device sync. That's what BlueLens Cloud (coming soon) will solve, with explicit user consent for what gets stored where.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Chromium only
&lt;/h3&gt;

&lt;p&gt;The File System Access API — which lets the app read your local repo without uploading anything — is only available in Chromium-based browsers (Chrome, Edge, Brave). Firefox doesn't support it yet.&lt;/p&gt;

&lt;p&gt;This is a real constraint. I accepted it because the alternative (asking users to zip and upload their repo) felt like the wrong trade-off for a privacy-first tool. When Firefox ships the API, we support Firefox.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Mermaid.js
&lt;/h3&gt;

&lt;p&gt;I could have built a custom graph renderer. Mermaid is the standard — it's what GitHub renders natively, it's what most developers already know, and it's battle-tested at scale. Building something custom would have taken months and produced something worse.&lt;/p&gt;

&lt;p&gt;The trade-off: Mermaid has layout limitations. Complex graphs with many nodes can be hard to read. The CodeGraph force-directed visualizer (which is custom) handles this for the automatic generation case. The Mermaid editor handles the manual diagramming case.&lt;/p&gt;

&lt;h3&gt;
  
  
  API key encryption
&lt;/h3&gt;

&lt;p&gt;AI features require an API key (Gemini, OpenAI, or Anthropic). Keys are encrypted with AES-GCM and stored in IndexedDB. They're never transmitted to BlueLens servers — because there are no BlueLens servers. They're decrypted in-memory when needed and re-encrypted immediately after.&lt;/p&gt;




&lt;h2&gt;
  
  
  What I got wrong (and what I'd do differently)
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;The heuristic fallback is too aggressive.&lt;/strong&gt; When the LLM grouping fails or times out, the heuristic takes over and produces a much flatter, less useful CodeGraph. I should have built a better degradation curve — partial LLM results are better than full heuristic results.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;I underestimated the Chromium constraint.&lt;/strong&gt; A meaningful percentage of developers use Firefox as their primary browser. I knew this going in but didn't fully appreciate how often "works in Chromium" translates to "not for me" in practice.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The onboarding is too abrupt.&lt;/strong&gt; The app assumes you know what a workspace is, what a diagram is, what CodeGraph is. First-time users need a guided path. This is the next thing I'm fixing.&lt;/p&gt;




&lt;h2&gt;
  
  
  Where it stands
&lt;/h2&gt;

&lt;p&gt;The self-hosted version is complete and MIT licensed. You can clone it, run it locally, point it at any repo, and use all features.&lt;/p&gt;

&lt;p&gt;A hosted cloud version is in progress — real-time collaboration, cloud storage, GitHub sync. No setup required. If you want early access: &lt;a href="https://bluelens.dev" rel="noopener noreferrer"&gt;bluelens.dev&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I'd genuinely appreciate feedback on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The D0→D3 hierarchical model — does this map to how you think about system decomposition?&lt;/li&gt;
&lt;li&gt;The "diagram as source of truth" thesis — realistic for teams, or too prescriptive?&lt;/li&gt;
&lt;li&gt;The Chromium constraint — dealbreaker, or acceptable trade-off?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;GitHub (MIT):&lt;/strong&gt; &lt;a href="https://github.com/Nathanf22/BlueLens" rel="noopener noreferrer"&gt;https://github.com/Nathanf22/BlueLens&lt;/a&gt;&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Try it (no install):&lt;/strong&gt; &lt;a href="https://app.bluelens.dev" rel="noopener noreferrer"&gt;https://app.bluelens.dev&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Built with React 19, TypeScript strict, Vite, Mermaid.js v11, Monaco Editor.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>opensource</category>
      <category>ai</category>
      <category>vibecoding</category>
    </item>
  </channel>
</rss>
