<?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 Ben Gao on Medium]]></title>
        <description><![CDATA[Stories by Ben Gao on Medium]]></description>
        <link>https://medium.com/@benxgao?source=rss-72d0469e3bf8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*8ybP2vwPF9K4DJDg8mpUgg.jpeg</url>
            <title>Stories by Ben Gao on Medium</title>
            <link>https://medium.com/@benxgao?source=rss-72d0469e3bf8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 06:10:35 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@benxgao/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[When Code Becomes Cheap: The Hidden Governance Problem of AI-Generated Software]]></title>
            <link>https://medium.com/@benxgao/when-code-becomes-cheap-the-hidden-governance-problem-of-ai-generated-software-a1e38e4314b5?source=rss-72d0469e3bf8------2</link>
            <guid isPermaLink="false">https://medium.com/p/a1e38e4314b5</guid>
            <category><![CDATA[architecture-agent]]></category>
            <category><![CDATA[engineering-management]]></category>
            <category><![CDATA[ai-software-engineering]]></category>
            <dc:creator><![CDATA[Ben Gao]]></dc:creator>
            <pubDate>Mon, 10 Aug 2026 02:53:06 GMT</pubDate>
            <atom:updated>2026-08-10T03:09:43.372Z</atom:updated>
            <content:encoded><![CDATA[<p>AI has changed the economics of software development.</p><p>Code that once required hours of engineering effort can now be generated in minutes. Developers can describe a feature, let an AI agent implement it, review the result, and move on.</p><p>Productivity increases.</p><p>But something else changes at the same time:</p><p><strong>Code becomes cheap.</strong></p><p>And cheap code creates a problem that is less about code quality than about <strong>human behavior, ownership, and governance</strong>.</p><p>Over the past three months, I have been experimenting with a Spec-Driven Development approach on a real project to address this problem.</p><p>The experiment has led me to a simple conclusion:</p><blockquote><strong><em>When AI makes implementation cheap, software engineering needs to make intent, decisions, and accountability more durable.</em></strong></blockquote><h3>Why Is AI-Generated Code Harder to Maintain?</h3><p>The obvious answer is that AI sometimes generates bad code.</p><p>The deeper problem is psychological.</p><h3>The Effort Heuristic</h3><p>Humans often use effort as a proxy for value.</p><p>Traditional code carries visible evidence of human effort: design, implementation, debugging, refactoring, and accumulated understanding.</p><p>AI can produce hundreds of lines of code in seconds.</p><p>This creates a subtle perception:</p><blockquote><em>If it was cheap to produce, it is cheap to replace.</em></blockquote><p>That can reduce the psychological incentive to understand and maintain it.</p><h3>Psychological Ownership</h3><p>Traditional development creates:</p><pre>I designed it<br>    ↓<br>I built it<br>    ↓<br>I debugged it<br>    ↓<br>I understand it<br>    ↓<br>I maintain it</pre><p>AI-assisted development can become:</p><pre>Human intent<br>    ↓<br>AI implementation<br>    ↓<br>Human approval</pre><p>But <strong>approval is not the same as ownership</strong>.</p><p>When developers do less of the cognitive work behind an implementation, they may also develop a weaker mental model of the system.</p><p>That matters six months later, when someone has to change it.</p><h3>The Real Risk: Intent Drift</h3><p>The most important AI software risk may not be incorrect code.</p><p>It is <strong>semantic drift between human intent and system behavior</strong>.</p><p>Consider the chain:</p><pre>Business intent<br>      ↓<br>Requirement<br>      ↓<br>Technical decision<br>      ↓<br>Specification<br>      ↓<br>AI interpretation<br>      ↓<br>Generated code<br>      ↓<br>System behavior</pre><p>Every translation introduces potential drift.</p><p>An AI-generated implementation can:</p><ul><li>compile successfully</li><li>pass tests</li><li>satisfy the ticket</li><li>look reasonable in code review</li></ul><p>and still implement the wrong interpretation of the original intent.</p><p>This creates a new category of technical debt:</p><blockquote><strong><em>Intent debt.</em></strong></blockquote><p>Traditional technical debt is often visible in the code.</p><p>Intent debt is harder to see because the code may be perfectly valid.</p><h3>AI Changes the Governance Problem</h3><p>Traditional software engineering already has governance mechanisms:</p><ul><li>Git</li><li>pull requests</li><li>code review</li><li>CI/CD</li><li>tests</li><li>ADRs</li><li>issue trackers</li><li>documentation</li></ul><p>Most were designed for a world where humans produced the implementation.</p><p>AI changes the economics of implementation.</p><p>When code generation becomes abundant, the scarce resources become:</p><ul><li>architectural judgment</li><li>context</li><li>institutional memory</li><li>accountability</li><li>system understanding</li></ul><p>In other words:</p><blockquote><strong><em>AI makes implementation cheaper while making reasoning relatively more valuable.</em></strong></blockquote><p>This shifts the governance problem upward.</p><p>Instead of asking only:</p><blockquote><em>Is this code correct?</em></blockquote><p>we increasingly need to ask:</p><blockquote><em>Why does this code exist?</em></blockquote><blockquote><em>Which decision does it implement?</em></blockquote><blockquote><em>Which constraints must remain true?</em></blockquote><blockquote><em>Who owns that decision?</em></blockquote><h3>My Three-Month Experiment</h3><p>Over the past three months, I experimented with a Spec-First / Documentation-as-Code architecture on a real project.</p><p>The objective was not simply to improve documentation.</p><p>It was to create a persistent context layer between <strong>human decisions, AI agents, and the codebase</strong>.</p><p>The system evolved around two structures.</p><h3>1. Canonical Specifications</h3><p>The repository contains domain-oriented specifications for areas such as:</p><ul><li>architecture</li><li>API</li><li>data</li><li>security</li><li>performance</li><li>testing</li><li>operations</li><li>product</li></ul><p>AI assistants are expected to retrieve relevant specifications before scanning implementation details.</p><p>The principle is:</p><blockquote><strong><em>Understand the intended system before inferring the system from existing code.</em></strong></blockquote><p>This is important because existing code may already contain historical mistakes.</p><h3>2. Delivery Orchestration</h3><p>Work moves through explicit stages:</p><pre>Intake<br>  ↓<br>Planned<br>  ↓<br>Active<br>  ↓<br>Review<br>  ↓<br>Archive</pre><p>The important part is not the Kanban itself.</p><p>The workflow therefore becomes a <strong>knowledge state machine</strong>, not merely a project-management tool.</p><h3>Decision Evidence</h3><p>One of the most useful mechanisms was a Decision Evidence Log.</p><p>For significant architectural decisions, the system records:</p><pre>Docs cited<br>Sufficiency verdict<br>Fallback scan used</pre><p>This creates decision provenance.</p><p>Git already tells us:</p><blockquote><em>What changed?</em></blockquote><p>The harder question is:</p><blockquote><strong><em>Why did we make this decision?</em></strong></blockquote><p>That reasoning needs to survive developer turnover, AI model changes, and time.</p><h3>Documentation Should Be Executable</h3><p>Another experiment was a Docs-Only Simulation Drill.</p><p>Instead of asking:</p><blockquote><em>Does the documentation exist?</em></blockquote><p>the test asks:</p><blockquote><strong><em>Could an AI agent perform the task using the documentation without first reading the implementation?</em></strong></blockquote><p>This leads to a useful concept:</p><h3>Spec Executability</h3><p>A specification is valuable when it provides enough information to constrain future decisions.</p><p>Documentation is therefore not successful merely because it is complete.</p><p>It is successful when it is <strong>actionable</strong>.</p><h3>What Did Not Work</h3><p>The experiment also exposed an important failure mode:</p><h3>Governance Can Become More Expensive Than Coding</h3><p>If every change requires:</p><ul><li>specification updates</li><li>decision logs</li><li>risk registers</li><li>retrieval checklists</li><li>simulation drills</li><li>reports</li></ul><p>the governance system becomes bureaucracy.</p><p>Developers will eventually optimize for <strong>passing the process</strong>, rather than maintaining system coherence.</p><p>This is a classic Goodhart’s Law problem.</p><p>Governance therefore needs to be proportional to change impact.</p><p>A variable rename should not require architectural governance.</p><p>A payment architecture change probably should.</p><h3>Documentation Is Not the Same as Truth</h3><p>Another lesson was that canonical documentation can become stale.</p><p>Reality may look like:</p><pre>Specification<br>      ↓<br>Implementation<br>      ↓<br>Production</pre><p>with three different states.</p><p>A better model is to make specifications explicitly stateful:</p><pre>Proposed<br>Accepted<br>Implemented<br>Verified<br>Deprecated</pre><p>A specification should have evidence and validity, not simply authority.</p><h3>The Next Abstraction: Constraints</h3><p>The most important conceptual shift from this experiment is that documentation may not be the right primitive.</p><p>AI does not necessarily need more documents.</p><p>It needs <strong>constraints</strong>.</p><p>For example:</p><pre>Constraint:<br>Payment operations MUST be idempotent.</pre><pre>Scope:<br>POST /payments/*</pre><pre>Source:<br>ADR-021</pre><pre>Severity:<br>Critical</pre><pre>Verification:<br>payment-idempotency.test.ts</pre><p>This creates a tighter relationship:</p><pre>Decision<br>   ↓<br>Constraint<br>   ↓<br>Implementation<br>   ↓<br>Verification</pre><p>The specification becomes something that can actively constrain AI generation rather than merely describe the system.</p><h3>Human Ownership Must Remain Explicit</h3><p>One principle now seems particularly important:</p><blockquote><strong><em>AI can propose. Humans must own consequential decisions.</em></strong></blockquote><p>A decision record could therefore distinguish:</p><pre>Proposed by: AI<br>Reviewed by: Human<br>Accepted by: Human<br>Evidence: ...<br>Confidence: ...</pre><p>This restores accountability.</p><p>AI should increase the organization’s ability to explore solutions without making responsibility ambiguous.</p><h3>From Spec-First to Intent-First</h3><p>The deeper lesson is that AI changes the abstraction level of software engineering.</p><p>Traditional development:</p><pre>Human<br>  ↓<br>Code<br>  ↓<br>System</pre><p>AI-assisted development:</p><pre>Human<br>  ↓<br>Intent<br>  ↓<br>AI<br>  ↓<br>Code<br>  ↓<br>System</pre><p>AI becomes a semantic translation layer.</p><p>Therefore the future architecture may look more like:</p><pre>Intent<br>   ↓<br>Decision<br>   ↓<br>Constraint<br>   ↓<br>AI-generated implementation<br>   ↓<br>Evidence<br>   ↓<br>Observation<br>   ↓<br>Learning<br>   ↓<br>New decision</pre><p>This is no longer simply Documentation-as-Code.</p><p>It is closer to <strong>Intent-as-Code</strong> or <strong>Decision-as-Code</strong>.</p><h3>The CTO-Level Question</h3><p>The wrong question is:</p><blockquote><em>How many lines of code can our developers generate with AI?</em></blockquote><p>A better question is:</p><blockquote><strong><em>What happens to our organization’s ability to understand and govern software when the cost of generating implementation approaches zero?</em></strong></blockquote><p>If AI makes code abundant, organizations need to make <strong>intent durable</strong>.</p><p>If AI makes implementation cheap, organizations need to make <strong>decisions traceable</strong>.</p><p>If AI makes software easier to generate, organizations need to make <strong>semantic drift harder to hide</strong>.</p><p>And if AI reduces human participation in implementation, organizations need mechanisms that preserve <strong>ownership and accountability</strong>.</p><h3>Conclusion</h3><p>AI-assisted development is not only a productivity revolution.</p><p>It is a <strong>governance revolution</strong>.</p><p>The fundamental unit of software engineering may gradually shift from:</p><blockquote><em>code</em></blockquote><p>toward:</p><blockquote><strong><em>intent → decision → constraint → implementation → evidence</em></strong></blockquote><p>My three-month experiment did not solve this problem.</p><p>It did, however, make the problem clearer.</p><p>The next generation of software engineering systems should not merely help AI write more code.</p><p>They should help organizations continuously answer five questions:</p><ol><li><strong>What are we trying to achieve?</strong></li><li><strong>Why did we choose this design?</strong></li><li><strong>What must remain invariant?</strong></li><li><strong>Who owns the decision?</strong></li><li><strong>What evidence tells us the system still reflects the original intent?</strong></li></ol><p>The challenge of AI-generated software is therefore not simply preventing bad code.</p><p>It is preventing <strong>cheap code from becoming expensive organizational entropy</strong>.</p><p>This article was AI-assisted and generated from ideas, observations, and frameworks developed by the author. The author reviewed and refined the content to ensure it accurately reflects the intended concepts and perspectives. AI was used primarily as a writing and editing tool.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a1e38e4314b5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Secure Full-Stack App with Firebase App Hosting and Next.js]]></title>
            <link>https://medium.com/@benxgao/building-a-secure-full-stack-app-with-firebase-app-hosting-and-next-js-f5e77dc279e0?source=rss-72d0469e3bf8------2</link>
            <guid isPermaLink="false">https://medium.com/p/f5e77dc279e0</guid>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[firebase-app-hosting]]></category>
            <dc:creator><![CDATA[Ben Gao]]></dc:creator>
            <pubDate>Wed, 16 Apr 2025 01:42:28 GMT</pubDate>
            <atom:updated>2025-04-16T01:42:28.537Z</atom:updated>
            <content:encoded><![CDATA[<p>For those looking for a modern and scalable way to put a secure full-stack web application online, this article will show how to use <a href="https://nextjs.org/">Next.js</a> with <a href="https://firebase.google.com/docs/hosting/app-hosting">Firebase App Hosting</a> and Firebase Functions. These are two open-source projects that work well together to create a strong, ready-for-production setup.</p><h3>Why This Stack?</h3><ul><li><strong>Next.js:</strong> This gives you a powerful React framework to build web apps that are fast and good for search engines (SEO).</li><li><strong>Firebase App Hosting:</strong> It provides an easy way to deploy and serve your Next.js apps across the world.</li><li><strong>Firebase Authentication:</strong> This makes it simple to add secure login for your users.</li><li><strong>Firebase Functions:</strong> These let you build backend parts of your application that can grow as needed, without much work to manage them.</li></ul><p>By using these together, you get a complete solution. It has secure logins, protected ways for the frontend to talk to the backend (APIs), and it makes things easier for developers.</p><h3>Project 1: Next.js Frontend on Firebase App Hosting</h3><p><strong>Repo:</strong> <a href="https://github.com/benxgao/firebase-nextjs-apphosting-sample">firebase-nextjs-apphosting-sample</a></p><p>This project is a template for deploying a Next.js app using Firebase App Hosting. It demonstrates:</p><ul><li><strong>User Authentication:</strong> Users sign in via Firebase Auth.</li><li><strong>Cookie-based Sessions:</strong> After login, the frontend exchanges the Firebase ID token for a signed cookie (JWT) via an API route.</li><li><strong>Session Validation:</strong> Middleware on both frontend and backend validates the cookie/JWT for protected routes and API calls.</li><li><strong>API Access:</strong> Authenticated requests from the frontend to backend APIs include the signed cookie for authorization.</li><li><strong>Environment Configuration:</strong> Uses environment variables and Firebase secrets for secure configuration.</li></ul><p><strong>Local Development:</strong><br>You can run the Next.js app locally and connect to the backend running in Firebase Emulators.</p><h3>Project 2: Firebase Functions Backend API</h3><p><strong>Repo:</strong> <a href="https://github.com/benxgao/firebase-api-sample">firebase-api-sample</a></p><p>This project provides a secure backend API using Firebase Functions and Express. Key features include:</p><ul><li><strong>RESTful Endpoints:</strong> Exposes API routes protected by Firebase Authentication.</li><li><strong>JWT Validation:</strong> Middleware verifies Firebase ID tokens for all protected endpoints.</li><li><strong>Secret Management:</strong> Demonstrates secure use of API keys and secrets via Google Cloud Secret Manager.</li><li><strong>Local Emulator Support:</strong> Easily run and test APIs locally using Firebase Emulators.</li></ul><h3>How Do They Work Together?</h3><ol><li><strong>User signs in</strong> on the Next.js frontend using Firebase Auth.</li><li><strong>Frontend exchanges</strong> the Firebase ID token for a signed cookie (JWT) via an API route.</li><li><strong>Session is validated</strong> by middleware on both frontend and backend for protected routes and API calls.</li><li><strong>Authenticated API requests</strong> from the frontend include the signed cookie for authorization.</li></ol><h3>Getting Started</h3><p><strong>Clone both repositories</strong> and install dependencies.</p><p><strong>Configure Firebase projects</strong> and environment variables.</p><p><strong>Run locally:</strong></p><ul><li>Start the Next.js frontend (npm run dev).</li><li>Start the backend with Firebase Emulators (firebase emulators:start).</li></ul><p><strong>Deploy:</strong></p><ul><li>Deploy backend functions: firebase deploy --only functions</li><li>Deploy frontend: firebase apphosting:deploy</li></ul><p>For detailed setup and command references, see the docs folder in each repo.</p><h3>Conclusion</h3><p>This stack gives you a secure, scalable, and developer-friendly foundation for modern web applications. With Firebase handling hosting, authentication, and backend APIs, and Next.js powering the frontend, you can focus on building features — not infrastructure.</p><p><strong>Check out the repos and try it yourself!</strong></p><ul><li><a href="https://github.com/benxgao/firebase-nextjs-apphosting-sample">firebase-nextjs-apphosting-sample</a></li><li><a href="https://github.com/benxgao/firebase-api-sample">firebase-api-sample</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f5e77dc279e0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploying Strapi CMS on GCP: A Production-Ready Infrastructure Template]]></title>
            <link>https://medium.com/@benxgao/deploying-strapi-cms-on-gcp-a-production-ready-infrastructure-template-f19f55885026?source=rss-72d0469e3bf8------2</link>
            <guid isPermaLink="false">https://medium.com/p/f19f55885026</guid>
            <category><![CDATA[strapi]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[circleci]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[gcp]]></category>
            <dc:creator><![CDATA[Ben Gao]]></dc:creator>
            <pubDate>Tue, 11 Mar 2025 01:56:22 GMT</pubDate>
            <atom:updated>2025-03-11T02:26:22.670Z</atom:updated>
            <content:encoded><![CDATA[<h3>Zero-Downtime Strapi Deployments on Google Cloud Platform with Terraform</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/418/1*1zF-nkGQBfbDBB7AyvCrbA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*Q6ADeYR4adrIdqjnpiFYvQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/920/1*5y9xtUoTBXKjmTS6Mg3aaQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/329/1*P124U_ipX00No3erb5Fnug.jpeg" /></figure><p>Are you looking to deploy Strapi CMS on Google Cloud Platform with a production-ready infrastructure? In this article, I’ll introduce a template that makes this process straightforward and maintainable.</p><h4>What We’re Building</h4><p>I’ve created a template that combines:<br>- Strapi CMS<br>- Google Cloud Platform<br>- Terraform for infrastructure as code<br>- CircleCI for continuous deployment<br>- Cloud Run for serverless hosting<br>- Cloud SQL (PostgreSQL) for database</p><h4>Why This Template?</h4><p>After working with multiple Strapi deployments, I noticed common patterns and challenges:<br>1. Setting up production-ready infrastructure takes time<br>2. Maintaining configuration consistency is difficult<br>3. Manual deployments are error-prone<br>4. Database management can be complex</p><p>This template solves these challenges by providing:<br>- 🚀 Zero-downtime deployments<br>- 🔐 Secure infrastructure setup<br>- 🌐 Managed PostgreSQL database<br>- 🔄 Automated CI/CD pipeline<br>- 📦 Container-based deployment<br>- 💾 Persistent storage configuration</p><h4>Getting Started</h4><p>The template is available on GitHub: <a href="https://github.com/benxgao/strapi-terraform-gcp-sample">strapi-terraform-gcp-sample</a></p><p>Basic setup requires just a few commands:</p><p>```bash<br>git clone <a href="https://github.com/benxgao/strapi-terraform-gcp-sample.git">https://github.com/benxgao/strapi-terraform-gcp-sample.git</a><br>cd strapi-terraform-gcp-sample<br>cd terraform/environments/init<br>terraform init<br>terraform apply<br>```</p><h4>Infrastructure Overview</h4><p>The template sets up:<br>1. Cloud Run service for Strapi<br>2. Cloud SQL PostgreSQL instance<br>3. VPC network and firewall rules<br>4. IAM roles and service accounts<br>5. GCP Artifact Registry for container images<br>6. Cloud Storage for media files</p><h4>Deployment Pipeline</h4><p>CircleCI automates the deployment process:<br>1. Build Strapi container image<br>2. Push to GCP Artifact Registry<br>3. Deploy to Cloud Run<br>4. Handle database migrations</p><h4>Cost Optimization</h4><p>The serverless setup means you only pay for:<br>- Actual compute usage on Cloud Run<br>- Database instance (can be stopped in non-production)<br>- Storage for media files<br>- Minimal network egress</p><h4>Next Steps</h4><p>1. Clone the repository<br>2. Follow the setup guide in README.md<br>3. Customize for your needs<br>4. Deploy your first Strapi instance</p><h4>Acknowledgments</h4><p>This project builds upon the excellent work by Prashant Sharma in his article <a href="https://medium.com/google-cloud/strapi-headless-cms-google-cloud-run-and-postgresql-6126b597b10c">Strapi Headless CMS + Google Cloud Run and PostgreSQL</a>.</p><h4>Conclusion</h4><p>This template aims to simplify Strapi deployments on GCP while maintaining production-ready standards. Give it a try and let me know your thoughts!</p><p><a href="https://github.com/benxgao/strapi-terraform-gcp-sample">GitHub Repository</a></p><p>#Strapi #GCP #Terraform #DevOps #Headless #CMS</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f19f55885026" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>