DEV Community

Cover image for Your React App Has an Architecture. Nobody on Your Team Chose It. The AI Did.
Avery
Avery

Posted on

Your React App Has an Architecture. Nobody on Your Team Chose It. The AI Did.

At some point in every React project someone asks: why is it structured this way?

And nobody has a good answer.

Not because the decision was wrong. But because there was no decision. The structure grew. One session at a time. Each AI generation adding something that made sense in that moment but was never part of a deliberate architectural choice.

The architecture exists. It just was not designed.

How an undesigned architecture gets built

It starts with the first session.

The AI generates a component. It puts it somewhere. It creates a file structure that made sense for that specific request. Nobody stops to ask whether this is where things should live long term. The feature works. The session ends.

The next session builds on top of it. Not because the structure was right. Because it was there. The AI sees what exists and extends it. A new feature gets a folder. A new hook gets placed next to the last one. A new service gets added wherever there was space.

Over enough sessions the codebase has a structure. A folder hierarchy. A pattern for where things live. An implicit architecture that every new session reinforces because it already exists.

Nobody designed it. The AI assembled it from the accumulated decisions of every session that came before.

Why this matters more than most developers realize

An undesigned architecture is not necessarily broken. It might even work well for a while.

The problem is that it was optimized for nothing. Not for scalability. Not for team navigation. Not for the domain it represents. It was optimized for whatever was easiest to generate in each individual session.

That means every decision the architecture reflects was the AI's path of least resistance, not your team's deliberate choice. And path of least resistance architectures do not age well.

New developers struggle to navigate them because there is no logic to learn, only history to trace. Features become harder to add because the structure was never designed to accommodate growth. Refactors become expensive because the architecture is everywhere and nowhere at the same time.


An architecture the AI invented is not wrong because it is bad. It is wrong because it was never yours. And a codebase that nobody deliberately designed is a codebase that nobody fully understands.

What a deliberate architecture looks like

A deliberate architecture starts with rules that define where things live before the AI generates anything.

Not a full architectural document. Not weeks of planning. Just enough rules to answer the questions the AI will otherwise answer on its own.

Where do components live? How are features organized? What is the boundary between UI and business logic? How do different parts of the app communicate?

Rules like these turn architectural decisions into constraints the AI follows:

Architecture rules that replace AI decisions:
1. Features are self-contained folders with components, hooks, services, and types inside.
2. Shared code lives in a dedicated shared folder. Nothing cross-imports between features directly.
3. UI components never know about API structure. Data transformation happens in services.
Enter fullscreen mode Exit fullscreen mode

Three rules. Applied before the first session. The AI stops inventing the architecture and starts building inside one you chose.

Taking back the architecture

Most projects reach a point where the undesigned architecture becomes a problem. The refactor is considered. The conversation about structure finally happens.

That conversation is valuable. But it is expensive when it happens after the architecture already exists everywhere.

The same conversation before the first session takes twenty minutes and costs nothing. The AI follows the outcome of that conversation in every session after it.

That is the difference between an architecture you chose and an architecture the AI assembled without anyone asking it to.

The prompt does not matter. The rules do.

Your React project has an architecture whether you designed it or not.

The question is whether it reflects deliberate decisions about how your application should be structured or accumulated AI decisions about what was easiest to generate.

Design it first. Write it as rules. Give it to the AI before it builds anything. And stop inheriting an architecture nobody chose.


Want to find where your React architecture was invented by the AI instead of designed by you?

I built a free 24 point checklist that helps you find exactly that. The structural gaps where the AI has been making architectural decisions on your behalf.

Get the React AI Clean Code Checklist — free

Avery Code React AI Engineering System

Top comments (0)