<?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: mrduguo</title>
    <description>The latest articles on Forem by mrduguo (@mrduguo).</description>
    <link>https://forem.com/mrduguo</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%2F312970%2F1b27413f-cae3-4188-9706-3ffc8eeedae8.png</url>
      <title>Forem: mrduguo</title>
      <link>https://forem.com/mrduguo</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/mrduguo"/>
    <language>en</language>
    <item>
      <title>Where React for IaC came from</title>
      <dc:creator>mrduguo</dc:creator>
      <pubDate>Sun, 17 May 2026 09:47:27 +0000</pubDate>
      <link>https://forem.com/mrduguo/where-react-for-iac-came-from-10e0</link>
      <guid>https://forem.com/mrduguo/where-react-for-iac-came-from-10e0</guid>
      <description>&lt;p&gt;This is the first technical post in the Dinghy series, and it is the one I had to write before any of the others made sense. It is the &lt;strong&gt;origin story&lt;/strong&gt; of the project — how a Terraform codebase that had grown beyond what copy-paste could maintain ended up being rendered out of TSX — and the &lt;strong&gt;core concept&lt;/strong&gt; the rest of Dinghy is built on.&lt;/p&gt;

&lt;h2&gt;
  
  
  How I ended up here
&lt;/h2&gt;

&lt;p&gt;Back in the day, I was maintaining a Terraform codebase across several environments. Most of the configuration was duplicated between them — the same resources, the same modules, repeated for every environment with only the inputs changing. Every change had to land in every environment. Every difference between them was either a deliberate choice or a bug waiting to happen.&lt;/p&gt;

&lt;p&gt;Modules helped. For a while. Then the modules themselves became the maintenance burden — a layer of indirection that still couldn't express what I actually wanted to say.&lt;/p&gt;

&lt;p&gt;HCL is HashiCorp &lt;strong&gt;Configuration&lt;/strong&gt; Language. The keyword is &lt;em&gt;configuration&lt;/em&gt;. It describes resources. It does not let you reason about them.&lt;/p&gt;

&lt;p&gt;I wanted a real language.&lt;/p&gt;

&lt;h2&gt;
  
  
  The first move: CDKTF
&lt;/h2&gt;

&lt;p&gt;CDKTF — Cloud Development Kit for Terraform — was the obvious next stop. Write infrastructure in TypeScript, render to Terraform JSON, deploy with the regular Terraform tooling. I tried it. It did what it said on the tin: real loops, real functions, real imports, real IDE support.&lt;/p&gt;

&lt;p&gt;But two things kept nagging.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Construct boilerplate.&lt;/strong&gt; CDKTF inherits AWS CDK's construct pattern: &lt;code&gt;new Vpc(this, 'vpc', {...})&lt;/code&gt;, then &lt;code&gt;new Subnet(this, 'subnet', { vpc, ... })&lt;/code&gt;. Every resource needs a parent scope and a unique id, hand-passed. It is faithful to AWS CDK, but it never stopped feeling like extra steps around the thing I actually wanted to write.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cross-resource wiring.&lt;/strong&gt; When two resources needed to talk to each other, I was still threading handles by hand. Pass the VPC into the subnet. Pass the subnet into the EC2. Pass the EC2 into the security group rule. The hierarchy in my head — &lt;em&gt;VPC contains subnets contains instances&lt;/em&gt; — was nowhere visible in the source.&lt;/p&gt;

&lt;p&gt;CDKTF had solved the programmable-language problem. It had not, for me, solved the &lt;em&gt;expressing nesting&lt;/em&gt; problem.&lt;/p&gt;

&lt;h2&gt;
  
  
  The click: TSX nests the way infrastructure nests
&lt;/h2&gt;

&lt;p&gt;When you draw a cloud architecture diagram, you naturally nest things inside containers — the VPC box wraps the subnet boxes; the subnet boxes wrap the instances. That nesting is how the infrastructure composes.&lt;/p&gt;

&lt;p&gt;The moment that turned this into a project rather than a complaint was noticing that &lt;strong&gt;TSX is already nested in the same way&lt;/strong&gt;. When you write:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Vpc&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Subnet&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Ec2&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Subnet&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Vpc&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The source code shape matches the runtime shape. The thing you write looks like the thing you mean. No &lt;code&gt;new X(parent, id, {...})&lt;/code&gt;. No explicit handle threading. The parent is right there — it is the JSX element containing you.&lt;/p&gt;

&lt;p&gt;The next step was obvious. React looks like a tool for building web pages, but underneath, it is a general-purpose engine for building trees. The part that turns your TSX into HTML doesn't actually need to produce HTML — it can produce anything, as long as you tell it how. Tell it to produce Terraform JSON, and that is what you get.&lt;/p&gt;

&lt;h2&gt;
  
  
  Don't worry about React's complexity
&lt;/h2&gt;

&lt;p&gt;If React's hooks, lifecycle, and state-management debates have put you off, you can relax. Dinghy uses almost none of that.&lt;/p&gt;

&lt;p&gt;Dinghy renders &lt;strong&gt;once&lt;/strong&gt;. You write the TSX, Dinghy walks the tree from top to bottom one time, writes the Terraform JSON, and stops. No reactivity. No re-renders. No state to manage. No lifecycle.&lt;/p&gt;

&lt;p&gt;So none of the modern React you might have struggled with applies here:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;del&gt;&lt;code&gt;useState&lt;/code&gt;&lt;/del&gt; — no local state&lt;/li&gt;
&lt;li&gt;
&lt;del&gt;&lt;code&gt;useEffect&lt;/code&gt;&lt;/del&gt; — no side effects or lifecycle&lt;/li&gt;
&lt;li&gt;
&lt;del&gt;&lt;code&gt;useMemo&lt;/code&gt;&lt;/del&gt; — nothing to memoise&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Dinghy only keeps the bits that make the nesting work:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;TSX&lt;/strong&gt; — the authoring syntax&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;tree-walker&lt;/strong&gt; that turns TSX into output&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;useContext&lt;/code&gt;&lt;/strong&gt; — for letting a child component reach a surrounding parent (the bucket trick you will see in the next section)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Most of what React has accumulated for browser UI doesn't apply here, and you don't need to know it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Context fixes the wiring problem
&lt;/h2&gt;

&lt;p&gt;Here is the bit that finally felt right. With CDKTF I was threading a bucket handle down through props. With Dinghy:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;BucketVersioning&lt;/span&gt; &lt;span class="o"&gt;=&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="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;s3Bucket&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useAwsS3Bucket&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;AwsS3BucketVersioning&lt;/span&gt;
      &lt;span class="na"&gt;bucket&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;s3Bucket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;bucket&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
      &lt;span class="na"&gt;versioning_configuration&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Enabled&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;AwsS3Bucket&lt;/span&gt; &lt;span class="err"&gt;...&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;BucketVersioning&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;AwsS3Bucket&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;BucketVersioning&lt;/code&gt; does not need to be told &lt;em&gt;which&lt;/em&gt; bucket it is enabling versioning on. It asks the surrounding &lt;code&gt;AwsS3Bucket&lt;/code&gt; via context. Drop it anywhere under a bucket and it Just Works.&lt;/p&gt;

&lt;p&gt;That is the kind of composition HCL fundamentally cannot give you. CDKTF can do it, but only by passing the parent reference by hand.&lt;/p&gt;

&lt;h2&gt;
  
  
  Beyond Web
&lt;/h2&gt;

&lt;p&gt;The other thing that fell out of choosing React: &lt;strong&gt;the output can be anything&lt;/strong&gt;. React doesn't care whether the result is HTML, native mobile widgets, terminal UI, or Terraform JSON. Point it at a different kind of output, and it produces that.&lt;/p&gt;

&lt;p&gt;React started as a web library, but it has long since moved beyond the web:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Web&lt;/strong&gt; — the original&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Native&lt;/strong&gt; — iOS and Android apps&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CLI&lt;/strong&gt; — Ink, Claude Code, and similar tools render terminal interfaces with React-like trees&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Infrastructure&lt;/strong&gt; — Dinghy, rendering diagrams and Terraform&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Same model, different output. That is why a single engine can sensibly cover diagrams and infrastructure under one roof — what the tree renders to is just a detail.&lt;/p&gt;

</description>
      <category>react</category>
      <category>terraform</category>
      <category>cdktf</category>
      <category>drawio</category>
    </item>
    <item>
      <title>Introduction to Dinghy: a Swiss-army knife for everyday engineering</title>
      <dc:creator>mrduguo</dc:creator>
      <pubDate>Tue, 12 May 2026 20:39:11 +0000</pubDate>
      <link>https://forem.com/mrduguo/introduction-to-dinghy-a-swiss-army-knife-for-everyday-engineering-20l2</link>
      <guid>https://forem.com/mrduguo/introduction-to-dinghy-a-swiss-army-knife-for-everyday-engineering-20l2</guid>
      <description>&lt;p&gt;If you ship anything for a living — diagrams, infrastructure, docs, slide decks — you have probably noticed that each of those things lives in its own world, with its own toolchain, its own opinionated editor, and its own subtle ways to drift out of sync.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dinghy.dev" rel="noopener noreferrer"&gt;&lt;strong&gt;Dinghy&lt;/strong&gt;&lt;/a&gt; is an open-source toolchain that puts all of them under one roof. One CLI. One install. One consistent way to &lt;em&gt;describe&lt;/em&gt; what you want &lt;strong&gt;as code&lt;/strong&gt; and let the tools deliver the final artwork.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it is
&lt;/h2&gt;

&lt;p&gt;A Swiss-army knife for engineers who like writing code more than clicking through dialogs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Diagram as Code&lt;/strong&gt; — render architecture diagrams to draw.io.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Infrastructure as Code&lt;/strong&gt; — render OpenTofu / Terraform from React TSX.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Site Builder&lt;/strong&gt; — author docs sites with Docusaurus, live-preview them, deploy to S3.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Slide Builder&lt;/strong&gt; — author RevealJS presentations in YAML / Markdown / HTML, with Prezi-style zoom-and-pan as a Dinghy-exclusive bonus.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It is powered by &lt;strong&gt;Deno&lt;/strong&gt; and &lt;strong&gt;Docker&lt;/strong&gt;, so you do not need to babysit Node versions, Python virtualenvs, Terraform providers, or any of the rest of it.&lt;/p&gt;

&lt;h2&gt;
  
  
  From a DevOps engineer's bench
&lt;/h2&gt;

&lt;p&gt;Dinghy was built by a DevOps engineer, so it is shaped to walk with your code across the whole software development lifecycle — from local development through to CI/CD — instead of stopping at the edge of one stage.&lt;/p&gt;

&lt;h2&gt;
  
  
  How it is shaped
&lt;/h2&gt;

&lt;p&gt;Dinghy splits cleanly into a thin &lt;strong&gt;CLI&lt;/strong&gt; and a fat &lt;strong&gt;engine&lt;/strong&gt; that runs in Docker. The CLI is what you install on your machine; the engine is a versioned image that ships every dependency Dinghy needs.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-fsSL&lt;/span&gt; https://get.dinghy.dev/install.sh | sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That single command gets you the CLI. From then on, everything Dinghy does happens inside the engine image — which means &lt;strong&gt;every machine on your team gets the exact same versions&lt;/strong&gt; of Deno, Node, OpenTofu / Terraform, and every TF provider, pinned through a single &lt;code&gt;.dinghyrc&lt;/code&gt; file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;DINGHY_ENGINE_VERSION&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;0.1...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;One lock. Predictable versions. No more "it works on my laptop" — and no more two-year-old projects you can't rebuild because the dependencies have rotted away.&lt;/p&gt;

&lt;h2&gt;
  
  
  Who it's for
&lt;/h2&gt;

&lt;p&gt;Anyone who needs to write code for any of this work — a diagram, a piece of infrastructure, a docs site or web app, a slide deck. You do not need to use them all, and you do not need to use them all the time. Reach for one when that is all you need; pull in a few when the work spans more than one.&lt;/p&gt;

&lt;p&gt;If any of that sounds useful for what you are building, the rest of this series digs into each capability one post at a time &lt;em&gt;(coming soon — links will go live as each post is published)&lt;/em&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Where React for IaC came from&lt;/strong&gt; — the origin of the Dinghy project and core concept.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Diagram as Code with draw.io&lt;/strong&gt; — author architecture diagrams as TSX components.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Infrastructure as Code&lt;/strong&gt; — 248 lines of Terraform from 8 lines of source.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Site Builder&lt;/strong&gt; — from one Markdown file to a deployed site.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Slide Builder&lt;/strong&gt; — RevealJS in YAML, with Prezi-style zoom.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dinghy in the AI age&lt;/strong&gt; — still relevant? How it works alongside AI.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Ready to set sail?
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-fsSL&lt;/span&gt; https://get.dinghy.dev/install.sh | sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Guides and examples are at &lt;a href="https://dinghy.dev" rel="noopener noreferrer"&gt;https://dinghy.dev&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>react</category>
      <category>revealjs</category>
      <category>terraform</category>
      <category>opentofu</category>
    </item>
  </channel>
</rss>
