Development

4 min read

I was a polyrepo guy. I was wrong.

One service, one repo felt like discipline. It hid the system from the people working on it, from the security scanners, and now from AI.

A pulp poster: an engineer swings a sledgehammer through the walls between seven tiny sheds labeled API, FRONT END, ADMIN, JOBS, INFRA, AUTH and BILLING, revealing one big machine running through all of them. Top: I WAS A POLYREPO GUY. Bottom: I WAS WRONG.

For most of my career I had one rule about repos. One service, one repo.

The API gets a repo. The front end gets a repo. The admin panel, the background jobs and the infrastructure each get their own box with their own name on it.

Splitting felt like discipline. Clean boundaries. Clear owners. A team could ship without asking anyone.

I've now merged those boxes back together at more than one company, and everything I build on my own starts in one repo. I'm not going back.

A pulp poster: a proud engineer polishes a shelf of seven padlocked, neatly labeled boxes while the cables behind them run into one tangled knot. Top: ONE SERVICE, ONE REPO. Bottom: IT FELT LIKE DISCIPLINE.

The boundaries were fake

The system was never seven things. It was one thing, cut in seven places.

A customer doesn't click on a repo. A customer clicks a button, and that click travels through the front end, the API, a queue and a job. In a polyrepo, every leg of that trip lives somewhere else, and almost nobody has all of it on their machine.

So nobody sees the whole system. An engineer clones their repo and learns their repo. Ask where a field comes from and the search stops at the edge of the repo. “That's in the other repo” becomes an acceptable answer.

Refactoring stops at the same edge. You can't rename what you can't see, so the bad name survives for years and everyone learns to translate.

A repo boundary hides the system from the people who work on it.

A pulp poster: seven engineers each peer through their own small window at one piece of a single enormous machine while a customer presses its big red button. Top: ONE SYSTEM. Bottom: CUT IN SEVEN PLACES.

Seven of everything

Seven lint configs. Seven pipelines. Seven sets of env files. Seven READMEs, each wrong in its own way.

No two of them match, because nobody shares a config across repos. They copy it once and the copies drift. Someone fixes the pipeline in one repo and the other six never hear about it. A new hire spends the first week on a scavenger hunt.

Security scanning is where seven of everything stops being annoying and starts being dangerous.

SAST and DAST tools get set up per repo. Seven onboardings, seven baselines, seven dashboards, seven lists of findings somebody marked “won't fix.” The repo nobody remembered to add is the repo that never gets scanned.

Worse, a static scanner can only follow data through code it can see. User input enters in one repo and reaches the query in another. The scanner sees two harmless halves and passes both.

Seven clean reports don't add up to one secure system.

A pulp poster: a security guard stamps PASS on six numbered repo doors while a burglar strolls through an unmarked seventh door. Top: SIX DOORS SCANNED. Bottom: GUESS WHICH ONE HE USED.

AI reads what you give it

I was building in monorepos long before AI showed up. AI didn't make the case for one repo. AI made the case a lot stronger.

AI works from what it can see. Open one repo and AI sees one seventh of the system. It reads the front end, finds a call to an API it can't open, and guesses what's on the other side. The guess comes back sounding exactly as sure as a fact.

Give AI the whole system and it can follow the click from the button to the database row. It can change the API and every caller in one pass. You review one diff, in one place.

AI with the whole repo can still be wrong. AI with a seventh of the repo has no choice.

An engineer stuck at the edge of a repo can walk over and ask someone. AI has the folder you opened and nothing else.

AI can finally read the whole system at once. A polyrepo hands it one folder.

A pulp poster: a robot at a desk holds one thin folder labeled FRONT END and types confidently while six filing cabinets sit locked behind glass and an engineer holds the keys. Top: YOU GAVE IT ONE FOLDER. Bottom: IT GUESSED THE REST.

What the monorepo cost

Here is the whole bill.

CI had to learn which folder changed. For a while, deploys fired when they shouldn't have and stayed quiet when they should have fired.

Code that had never agreed on formatting had to share one set of hooks and lint rules. Somebody lost those fights.

The clone got bigger. The commit log filled up with other people's work.

That was it. A few weeks of cleanup, and then nobody thought about it again. The monorepo charged us once. The polyrepo charged us every day.

A pulp poster: at a window labeled MONOREPO an engineer pays one small bill stamped PAID IN FULL; at a window labeled POLYREPO a long line of engineers feeds coins into a toll machine marked EVERY DAY. Top: ONE BILL. Bottom: THE OTHER ONE NEVER STOPS.

What still gets its own repo

My rule now: a repo boundary is for a different audience, not a different folder.

Shapio has its own repo because it's open source. Strangers clone it. It has its own license, its own releases and its own users, and none of them should have to care about anything else I build.

A different team is not a different audience. Neither is a different language. “It deploys separately” isn't a reason either. A pipeline can deploy a folder.

For most of my career the rule was one service, one repo.

Now the rule is one system, one repo.