Skip to main content

I have seen countess projects suffer from “architectural drift.” In a typical enterprise environment, this happens over years as different engineers join and leave a team. When building with AI, this drift can happen in just a few prompts. Without a clear map of how the different layers of your application interact, an AI agent might start placing business logic in your UI components or creating redundant data fetches that bloat your application.

The ARCHITECTURE.md file is the structural blueprint of the “markdown stack.” While the PRD defines what we are building, the architecture file defines how the pieces fit together. It is the definitive reference for how the project works today and, more importantly, how it should be extended tomorrow.

A collaborative, AI-led approach

Because I am no longer in the weeds of daily coding, I treat the creation of ARCHITECTURE.md as a high-level review process. I am not writing the specific implementation details of a service worker or a database schema; instead, I am directing the AI to propose a structure based on our previously defined STACK.md and JOURNEYS.md.

I start by asking the AI: “Based on our tech stack and the user journeys we have mapped out, propose a folder structure and a data flow architecture that prioritises performance and maintainability.” The AI then generates the first draft of the ARCHITECTURE.md. I then step in with a human-in-the-loop review, poking holes in its logic: “This seems too coupled; can we separate the API layer from the UI logic to make it easier to add a mobile platform later?” This back-and-forth ensures the architecture is sophisticated enough for professional standards but simple enough for me to manage.

Onboarding future brains

The true value of this file reveals itself when you step away from a project and return to it weeks later, or when you need to “onboard” a new LLM. AI models have a limited context window; they cannot hold the entire codebase in their immediate memory at all times.

When I start a new session in Cursor, the ARCHITECTURE.md provides the “technical onboarding” the agent needs. It explains:

  • Folder structure: Where the components, hooks, and services live.
  • Data flow: How information moves from the database to the front end.
  • State management: How the application remembers user choices and data.
  • Integration points: How we talk to third-party platforms or internal APIs.

This documentation is just as vital for humans. If I ever decide to bring in a freelance developer to help with a specific complex feature, they don’t have to spend hours reverse-engineering my code. The ARCHITECTURE.md tells them exactly how I expect the project to be built.

Future-proofing and scaling

A well-maintained ARCHITECTURE.md makes implementing new features remarkably easy. If I decide to add a new layer to my tech stack (perhaps moving from simple local storage to a dedicated cloud database) I first update the architecture file. I describe the new layer and how it should interface with the existing system.

By updating the map before I ask the AI to move the mountains, I ensure that the new code fits perfectly into the existing ecosystem. This prevents the “spaghetti code” that often plagues AI-generated projects. Whether you are adding new platforms or just refining your current logic, the architecture file ensures that your project remains a cohesive, professional product.

With the architecture set, the foundation is complete. In the next post, I will discuss the final piece of the documentation puzzle: the README.md, and why letting the AI take the lead on this traditional “chore” is a revelation for product managers.

Leave a Reply