<?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: Omar Wael</title>
    <description>The latest articles on DEV Community by Omar Wael (@omaraboelnaga121).</description>
    <link>https://dev.to/omaraboelnaga121</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1291350%2Fa8f086d6-7d53-475f-bdb4-79a55f0a1147.jpeg</url>
      <title>DEV Community: Omar Wael</title>
      <link>https://dev.to/omaraboelnaga121</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/omaraboelnaga121"/>
    <language>en</language>
    <item>
      <title>Mapping a NestJS Backend Automatically: DB Schemas, REST Endpoints, and Catching an Auth Bug</title>
      <dc:creator>Omar Wael</dc:creator>
      <pubDate>Sun, 25 Oct 2026 20:25:09 +0000</pubDate>
      <link>https://dev.to/omaraboelnaga121/mapping-a-nestjs-backend-automatically-db-schemas-rest-endpoints-and-catching-an-auth-bug-57ea</link>
      <guid>https://dev.to/omaraboelnaga121/mapping-a-nestjs-backend-automatically-db-schemas-rest-endpoints-and-catching-an-auth-bug-57ea</guid>
      <description>&lt;p&gt;Whenever I start working on an unfamiliar backend project, I spend the first few hours bouncing between controller files, middlewares, and ORM entities just to learn how the database tables link together and how the API routes function.&lt;/p&gt;

&lt;p&gt;I created &lt;a href="https://docflow.software" rel="noopener noreferrer"&gt;DocFlow&lt;/a&gt; to generate that map automatically from a GitHub repository. It works across full-stack and backend frameworks (Next.js, Nuxt, Angular, NestJS, Express, etc.), and to test it on a real backend, I ran it against the &lt;code&gt;nestjs-realworld-example-app&lt;/code&gt; repository.&lt;/p&gt;

&lt;p&gt;Here is what it pulled out of the codebase automatically:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Interactive Database Schema (0:00 in the demo)
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;(Drag and drop a screenshot of your Database Schema tab at 0:05 here)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Instead of reading entity files one by one, it builds an interactive React Flow graph showing all 6 tables (&lt;code&gt;user&lt;/code&gt;, &lt;code&gt;article&lt;/code&gt;, &lt;code&gt;comment&lt;/code&gt;, &lt;code&gt;tag&lt;/code&gt;, &lt;code&gt;follows&lt;/code&gt;, &lt;code&gt;article_favorites_user&lt;/code&gt;), column types, primary and foreign keys, and the &lt;code&gt;1:N&lt;/code&gt; and &lt;code&gt;N:M&lt;/code&gt; relationships between them.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Backend API Explorer (0:16 in the demo)
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;(Drag and drop a screenshot of your APIs tab at 0:18 here)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;It scanned the NestJS controllers and listed all 19 REST endpoints (&lt;code&gt;GET&lt;/code&gt;, &lt;code&gt;POST&lt;/code&gt;, &lt;code&gt;PUT&lt;/code&gt;, &lt;code&gt;DELETE&lt;/code&gt;), linking each route directly to its controller file (like &lt;code&gt;src/article/article.controller.ts&lt;/code&gt; and &lt;code&gt;src/user/user.controller.ts&lt;/code&gt;).&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Line-Cited Architecture Chat &amp;amp; Catching a Real Bug (0:25 in the demo)
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;(Drag and drop a screenshot of the Chat response at 0:45 here)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;When I asked the codebase chat how authentication and authorization work, it didn't just give a generic summary:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It traced the JWT token generation and middleware down to the exact lines (&lt;code&gt;src/user/auth.middleware.ts:14-31&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;It generated a route protection table showing which routes run through &lt;code&gt;AuthMiddleware&lt;/code&gt; in &lt;code&gt;UserModule&lt;/code&gt;, &lt;code&gt;ProfileModule&lt;/code&gt;, and &lt;code&gt;ArticleModule&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The best part (at 0:45):&lt;/strong&gt; It flagged an actual authorization gap in the repo where &lt;code&gt;PUT /articles/:slug&lt;/code&gt; (&lt;code&gt;src/article/article.controller.ts:50-63&lt;/code&gt;) and &lt;code&gt;DELETE /articles/:slug&lt;/code&gt; (&lt;code&gt;src/article/article.controller.ts:57-71&lt;/code&gt;) authenticate the user via middleware, but never check the author's &lt;code&gt;userId&lt;/code&gt; in the service before updating or deleting an article.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  How it works under the hood
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Backend:&lt;/strong&gt; Runs on NestJS with BullMQ queues to clone and index repository trees asynchronously.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Indexing &amp;amp; RAG:&lt;/strong&gt; Combines structural code parsing (to extract ORM schemas, client pages, and API routes) with PostgreSQL and &lt;code&gt;pgvector&lt;/code&gt; for hybrid search so the chat cites exact file paths and line numbers instead of guessing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Frontend:&lt;/strong&gt; Built with Next.js and React Flow for the interactive schema diagrams.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Try it out
&lt;/h3&gt;

&lt;p&gt;You can test the live &lt;code&gt;nestjs-realworld-example-app&lt;/code&gt; example or connect up to 2 of your own repositories on the free tier here: &lt;strong&gt;&lt;a href="https://docflow.software" rel="noopener noreferrer"&gt;https://docflow.software&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I would really like to hear your thoughts on how the diagrams look, and what else you would want extracted when jumping into an unfamiliar backend repository!&lt;/p&gt;

</description>
      <category>nestjs</category>
      <category>typescript</category>
      <category>webdev</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
