<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>technical-documentation on S Anand</title>
    <link>https://www.s-anand.net/blog/tag/technical-documentation/</link>
    <description>Recent content in technical-documentation on S Anand</description>
    <generator>Hugo -- 0.164.0</generator>
    <language>en-us</language>
    <lastBuildDate>Sat, 17 May 2025 02:14:11 +0000</lastBuildDate>
    <atom:link href="https://www.s-anand.net/blog/tag/technical-documentation/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>How to create a Technical Architecture from code with ChatGPT</title>
      <link>https://www.s-anand.net/blog/how-to-create-a-technical-architecture-from-code-with-chatgpt/</link>
      <pubDate>Sat, 17 May 2025 02:14:09 +0000</pubDate>
      <guid>https://www.s-anand.net/blog/how-to-create-a-technical-architecture-from-code-with-chatgpt/</guid>
      <description>&lt;p&gt;&lt;img alt=&#34;How to create a Technical Architecture from code with ChatGPT&#34; loading=&#34;lazy&#34; src=&#34;https://www.s-anand.net/blog/assets/Mermaid-Chart-Create-complex-visual-diagrams-with-text.-A-smarter-way-of-creating-diagrams.-2025-05-17-021315-scaled.webp&#34;&gt;&lt;/p&gt;
&lt;p&gt;Here&amp;rsquo;s my current workflow to create technical architecture diagrams from code.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;STEP 1: Copy the code&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Here&amp;rsquo;s a one-liner using &lt;a href=&#34;https://github.com/simonw/files-to-prompt&#34;&gt;files-to-prompt&lt;/a&gt; to copy all files in the current directory:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;fd &lt;span class=&#34;p&#34;&gt;|&lt;/span&gt; xargs uvx files-to-prompt --cxml &lt;span class=&#34;p&#34;&gt;|&lt;/span&gt; xclip -selection clipboard
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Or, you can specify individual files:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;uvx files-to-prompt --cxml README.md ... &lt;span class=&#34;p&#34;&gt;|&lt;/span&gt; xclip -selection clipboard
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;STEP 2: Prompt for the a Mermaid diagram&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://www.mermaidchart.com/&#34;&gt;Mermaid&lt;/a&gt; is a Markdown charting language. I use this prompt with &lt;a href=&#34;https://chatgpt.com/?model=o4-mini-high&#34;&gt;O4-Mini-High&lt;/a&gt; or &lt;a href=&#34;https://chatgpt.com/?model=o3&#34;&gt;O3&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Create a Mermaid architecture diagram for the files below.&lt;/p&gt;
&lt;p&gt;Make sure that the diagram is rich in visual detail and looks impressive.
Use the &amp;ldquo;neutral&amp;rdquo; theme.
Name nodes and links semantically and label them clearly. Avoid parantheses.
Quote subgraph labels.
Use apt &lt;code&gt;shape: rect|rounded|stadium|...&lt;/code&gt; for nodes.
Add suitable emoticons to every node.
Style nodes and links with classes most apt for them.&lt;/p&gt;
&lt;p&gt;Follow that with a bulleted explanation of the architectural elements that is suitable for adding to a slide.&lt;/p&gt;
&lt;p&gt;Finally, double-check the architecture against the codebase and provide a step-by-step validation report.&lt;/p&gt;
&lt;p&gt;[PASTE CODE]&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;STEP 3: Copy the diagram into Mermaid Live Editor&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Here&amp;rsquo;s a sample output that you can paste into a new &lt;a href=&#34;https://www.mermaidchart.com/play#pako:eNqVV01v4zYQ_SsDLQxf4i3adA8VugsE2S0QwG2DdRd7qHtgyJHFmCZVknLiBvnvHYr6dqLYOTgSOR-Pb2Ye7aeEG4FJmsxmT1JLnz7NfY47nKdzjaW3TM2fn2eztc6UeeA5sx6WX9caYDaDpeFMgcA9KlPsUHtAvZfW6PAcbFx5t7GsyGGdRNvPne06CRYQ3P9eJ79KbrTMDovwH8LHx_lOyNSj3UlNIOBBCp9_nP_08xxylJvcV88_fII2MvxVG6-Tf0Js1GKta6i31twj90CBM7mBTCp0I4TX1VZpmZdGuwbeg2V6o9DG3VeQOrkrFFYrLuXKlCJTzOIE6O91WIhxa8QABeNbtsHJbIGX2m6xZ1Yy7Scy3UbLYaI-NdctXvhu7JYw2VJ7uUNgWgBzDv0RVUcuX6NLy1q1Wi--cgxlNuZEtiby1byFJp6gSxHbZeDrnu2Z41YWU5RdFYWSvOoDok10WVyBfCJL6KrFvTN6IvafBeqr2xtYUagu7gPbbNB-u5mkqraaCL6KFvDtpg2NjzTD3H_RojBS-wn0rJATob_EOIGSJtYLvURWaGkCYbn8HRzaveSxjRxye9xHrfkqmrZTp9TuqpCnTJshPtkU8IDkN1NqYQ9wnTMPxH7Hjt6vKmRPE71j-HaKmE7yIMZaJ89HvBAFJfHhKjK8Mep4pGRPFHn19sd0U_PSTuli6LIm6lGhekIMsawVIBJjWCwIDgpJ1Uro5VM1W2maRrOl1NuBJa9lExvzoWKe4TjQvtf9SJ1ceGvS9aVm5NUetlDmEM9K9N-VUomwNUQao4vK1sFeMrhe3pyQZCTaMYzUzjOlKqCUnqhHzWV7VFqlKIJ5NgBaJ4A7zNleGlvVZJC7rs4j8tLjZIHCYrTO6dB03YE1pZeaLj9ja8eROEzECLPc5gsyeLJtI20vlyZMJ2VG22vCEaqG0L3ZtlGjPhxhaMcZFu_Jh5U-N1b-V7m977sdMR8H5QhKN4fN0bQgIvHfEp2nOT6Vx1GYDD3P36Bz5LKXrpvIN0hd-YMKhRaYha903WHoMv-MWfMlqPqjO0ul77JfsgvnLTGcvru8vKyfF5W2pD8WjyN3AgV9d5GJ090D9yN3cUb2UgIM3bNzstMtN3YXeLo7NjdW6454Bvh4DQ6znwE-NkXfnWdvZR-evm0WunzOKVh0aZwWgjn6KWDZIf1w8aHtuyvn5EaDDv1ReWPXdyOxvRhqZuzIzrhqsfDRLYUpqaD0lpoxoKboVsfyQRXvoRiIaVPNbj8qxAsbnbTEGnY7pOUXvWmNj2udPP8PJRGGhw&#34;&gt;Mermaid Playground&lt;/a&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-mermaid&#34; data-lang=&#34;mermaid&#34;&gt;%%{init: {&amp;#39;theme&amp;#39;:&amp;#39;neutral&amp;#39;}}%%
flowchart TB
  %% Source files
  subgraph &amp;#34;Source Files 📁&amp;#34;
    direction LR
    RT_wr[wrangler.toml 🔧]:::config
    PK_pkg[package.json 📦]:::config
    JS_idx[src/index.js 🖥️]:::code
    JSON_spec[openapi.json 📄]:::assets
    HTML_swagger[swagger.html 📜]:::assets
  end

  %% Build &amp;amp; deploy steps
  subgraph &amp;#34;Build &amp;amp; Deploy 🛠️&amp;#34;
    direction LR
    DEV[&amp;#34;npm run dev / wrangler dev ▶️&amp;#34;]:::action
    SECRET[&amp;#34;npx wrangler secret put LLMFOUNDRY_TOKEN 🔑&amp;#34;]:::action
    DEPLOY[&amp;#34;npm run deploy / wrangler deploy 🚀&amp;#34;]:::action
  end

  %% Runtime environment
  subgraph &amp;#34;Runtime Environment ☁️&amp;#34;
    direction TB
    CF_WORKER[&amp;#34;Cloudflare Worker ✨&amp;#34;]:::worker

    subgraph &amp;#34;Request Processing 🔄&amp;#34;
      direction LR
      API_ROUTER[&amp;#34;API Router 🔀&amp;#34;]:::logic

      subgraph &amp;#34;Endpoints 🌐&amp;#34;
        EXTRACT[&amp;#34;/extract 🚀&amp;#34;]:::endpoint
        OPENAPI[&amp;#34;/openapi.json 📄&amp;#34;]:::endpoint
        DOCS[&amp;#34;/docs (or /) 📘&amp;#34;]:::endpoint
      end

      subgraph &amp;#34;Handlers 🛠️&amp;#34;
        HANDLE[&amp;#34;handleExtract 📝&amp;#34;]:::logic
        SERVE_SPEC[&amp;#34;serveOpenApi (spec) 📑&amp;#34;]:::logic
        SERVE_SWAGGER[&amp;#34;serveSwaggerUI 🖥️&amp;#34;]:::logic
        NOT_FOUND[&amp;#34;404 NotFound ❓&amp;#34;]:::logic
      end
    end

    subgraph &amp;#34;Extraction Flow 🤖&amp;#34;
      PROMPT[&amp;#34;createExtractionPrompt 🤔&amp;#34;]:::logic
      GPT_API[&amp;#34;LLM Foundry API 🔗&amp;#34;]:::external
    end
  end

  %% Connections
  RT_wr --&amp;gt; CF_WORKER
  PK_pkg --&amp;gt; DEV
  JS_idx --&amp;gt; CF_WORKER
  JSON_spec --&amp;gt; CF_WORKER
  HTML_swagger --&amp;gt; CF_WORKER

  DEV --&amp;gt; CF_WORKER
  SECRET --&amp;gt; CF_WORKER
  DEPLOY --&amp;gt; CF_WORKER

  CF_WORKER --&amp;gt; API_ROUTER
  API_ROUTER --&amp;gt; EXTRACT
  API_ROUTER --&amp;gt; OPENAPI
  API_ROUTER --&amp;gt; DOCS

  EXTRACT --&amp;gt; HANDLE
  OPENAPI --&amp;gt; SERVE_SPEC
  DOCS --&amp;gt; SERVE_SWAGGER

  HANDLE --&amp;gt; PROMPT
  PROMPT --&amp;gt; GPT_API

  API_ROUTER --&amp;gt; NOT_FOUND

  %% Styling classes
  classDef config     fill:#f0f0f0,stroke:#333,stroke-width:1px;
  classDef code       fill:#e0f7fa,stroke:#333,stroke-width:1px;
  classDef assets     fill:#fce4ec,stroke:#333,stroke-width:1px;
  classDef action     fill:#fff9c4,stroke:#333,stroke-width:1px;
  classDef worker     fill:#e8f5e9,stroke:#333,stroke-width:1px;
  classDef logic      fill:#e3f2fd,stroke:#333,stroke-width:1px;
  classDef endpoint   fill:#ffebee,stroke:#333,stroke-width:1px;
  classDef external   fill:#ede7f6,stroke:#333,stroke-width:1px;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;img loading=&#34;lazy&#34; src=&#34;https://www.s-anand.net/blog/assets/Mermaid-Chart-Create-complex-visual-diagrams-with-text.-A-smarter-way-of-creating-diagrams.-2025-05-17-021315-1024x690.webp&#34;&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;STEP 4: Export the diagram&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;If you log in, you can export as PNG.&lt;/li&gt;
&lt;li&gt;If not, you can export it as SVG or take a screenshot.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Note: Technically, this is a flowchart, not an architecture diagram. Mermaid does support &lt;a href=&#34;https://mermaid.js.org/syntax/architecture.html&#34;&gt;architecture diagrams&lt;/a&gt;, but they are in beta and don&amp;rsquo;t look good.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&#34;comments&#34;&gt;Comments&lt;/h2&gt;
&lt;!-- wp-comments-start --&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;https://www.s-anand.net/blog/how-to-create-a-technical-architecture-from-code-with-chatgpt-and-plantuml/&#34;&gt;How to create a Technical Architecture from code with ChatGPT and PlantUML - S Anand&lt;/a&gt;&lt;/strong&gt; &lt;em&gt;24 May 2025 9:18 am&lt;/em&gt; &lt;em&gt;(pingback)&lt;/em&gt;:
[…] Earlier, I used Mermaid for technical architectures. But PlantUML seems a better option for cloud architecture diagrams. […]&lt;/li&gt;
&lt;/ul&gt;
&lt;!-- wp-comments-end --&gt;
</description>
    </item>
    <item>
      <title>O Reilly Code Search</title>
      <link>https://www.s-anand.net/blog/o-reilly-code-search/</link>
      <pubDate>Sun, 27 Aug 2006 12:00:00 +0000</pubDate>
      <guid>https://www.s-anand.net/blog/o-reilly-code-search/</guid>
      <description>&lt;p&gt;&lt;a href=&#34;http://labs.oreilly.com/code/&#34;&gt;Code search&lt;/a&gt; within O&amp;rsquo;Reilly books.&lt;/p&gt;
</description>
    </item>
  </channel>
</rss>
