r/devops • • Oct 19 '26

Architecture To monorepo or not?

My startup is in consumer electronics. The product is 1 device with 1-2 peripherals that come with it. Users connect to a mobile app with a backend that does data analysis on what the product measures.

ATM I have 4 repos: a flutter app and a FastAPI backend with sqlite. The embedded side uses PlatformIO+Arduino for the device/hub, and same stack for the peripehrals.

The DevOps is getting unwieldy. On the one side, I'd like everything to be in one place so agents can easily build up a context and CI/CD is not scattered. On the other hand, I hate working with massive project trees and loading up vscode would be a nightmare.

Thoughts? At work I use git submoduels but I was told that's not a monorepo.

40 Upvotes

55 comments sorted by

76

u/stevecrox0914 Oct 19 '26

I prefer seperate git repositories.

The CI process can assume the repository root has the build management configuration. That makes CI and CD far simplier

Each repository has to publish its artefacts for other repositories to use them.

That encourages a release process and encourages your programmers to respect a dependency.

It encourages you to treat each unit as a self contained item, which ensures good code boundaries.

Lastly a single repository with git sub modules of your repositories gives many of the actual benefits of a monorepo. Best of all worlds in my opinion

4

u/BigBootyBear Oct 19 '26

I agree with your point about published artifacts, which is what I do at work where the root CI/CD consumes the dependencies as an image their respective CIs all build and publish to a registry.

Do you think that changes the pictures with embedded projects that are not deployed as containers?

6

u/stevecrox0914 Oct 19 '26 • Bravo

Most of my work has either been in DevOps or Data Engineering working on pipelines.

The golden rule is a clear entry and exit condition for each step with a minimal of dependencies, and information managed in a central source of truth (see micro service best practices).

There is a tendency in both fields for someone relatively new to do something overly clever (like embed dependencies in a docker image). That works as long as the person who created it stay around. Someone new else won't like it and will have different opinions.

The other big rule is how close to zero configuration and how much are you calling the standard lifecycle calls for the build management solution. The closer to zero and only standard calls the easier the solution is to maintain.

So if your dealing with a Python project, you don't pull in a docker image you pull down from a pypi repo.

If your deploying a system as containers the cd should pull down the released docker conainers.

1

u/Shidima Oct 19 '26

You still have a final artifact that gets build right?

1

u/BigBootyBear Oct 19 '26

With embedded it's different since each chip needs to be flashed with a different binary since they all need difference machine instructions sets. Unlike a container file, theres no final artifact.

1

u/AdministrativeBad752 Oct 20 '26

But do you have a test system, and do you know which chip has been flashed with which version of the pre-compiled codebase? And with which compiler as well?

1

u/pdp10 Oct 20 '26 edited Oct 20 '26

Those are artifacts. They're probably versioned together as one, even though they're deployed separately.

13

u/AdministrativeBad752 Oct 19 '26

I’d add clearer ownership to this. Moving to separate repos made it easier for us to see who owned what and focus on one problem at a time. It also helped us step back and reason about each component independently.

For us, that translated into a boost in velocity pretty quickly after the switch.

5

u/Rollingprobablecause Director - DevOps/Infra Oct 19 '26

This is exactly how I'd position this as well, thinking about scale at the beginning is so important because what will happen over time is that as your service grows and lets say you get successful, everyone eventually ends up with giant multiple "monorepo" archtypes where we just keep adding across various repos without separation. Having code-owner tags at the beginning plus clear docs will help massively.

I'd also add that (especially if you're in GitHub) using dependabot and enforcing it without dismissal being turned on will help you out in the long run. You can introduce auto-merge for minor dependency updates and force devs to learn the process early on.

14

u/WonderfulTill4504 Oct 19 '26 edited Oct 20 '26

Avoid submodules unless you enjoy the complexities of pinning your main repo to a module. I have a few of those and they suck balls.

Go to mono-repo and put a layer on top of it to manage the sub projects like buck2. If is pure python is even simpler, each submodule is self contained with a is own pyproject.toml.
If is Java, use Gradle with Kotlyn or even Maven (you probably like pain but each to its own). Avoid Ant.
For C++ try to use something like Conan to avoid mounting compilers and shit over NFS.

There are many ways to skin this cat. Looks like you have a code base so moving independent projects into a mono-repo is your first task so try to keep their own folder structure (and fix the ones fucked) and use buck2.

7

u/brian_sword Oct 19 '26

I think a monorepo would be a great choice in your case, since the Flutter app, FastAPI backend, and embedded firmware are all parts of the same product. Having everything in one place can make CI/CD and AI assisted development easier.

But it is also important not to force everything into one giant workspace. You can keep each component in its own directory with separate dependencies, build scripts, and CI jobs.

6

u/solatic Oct 19 '26

Forget the repository structure for one minute. Focus on the deployment cadence and how quickly you can get something rolled out in production.

  • FastAPI backend you can continuously deploy on a moment's notice
  • Flutter app needs time to get through review for the app stores, let's say it takes you several days on average to get a change past review
  • Embedded app is extremely difficult to update after-the-fact

If you haven't shipped anything to production / customers yet, everything is in a garage, then a monorepo makes sense. You deploy changes to the Arduino multiple times a day as you build the thing. Letting an agent make changes to FastAPI + Flutter + embedded at the same time is awesome. You can start with a monorepo.

Eventually though that monorepo is gonna lie to you. You can't actually roll out the change to embedded or Flutter as quickly as you roll out the FastAPI changes. And that's gonna bite you when an agent removes something from the backend that people running an older version of the mobile app still need, or when the agent changes mobile to add visibility into something new in the embedded code that just doesn't exist out there yet.

Start with monorepo while you're iterating on the MVP. Break out into polyrepo when release cadence reality catches up to you and having formal interfaces between backend / frontend / embedded helps you release each one independently, and make changes to each one independently, within its natural release cadence.

4

u/SikhGamer Oct 19 '26

Love monorepos. If all your stuff is constantly talking backwards and forwards then it's the only way.

3

u/soylentgraham Oct 22 '26

hate monorepos.
Take down the whole company when someone screws up.
No way to manage backwards compatibility or versioning between modules.

Monorepos are only good for one single team of 3.
If you want to start working wide, its a nightmare

1

u/SikhGamer Oct 22 '26

We've got nearly 5 teams of 5 working in a single monorepo. It works fine.

1

u/soylentgraham Oct 22 '26

I mean, at Unity it's thousands of devs over like 100 teams in one monorepo (for ~3 products iirc)
It worked; but it could have been a lot lighter and more stable

3

u/LogicalExtension Oct 19 '26

Monorepo is great if you have a whole lot of stuff that moves together and needs to stay that way or re-uses a bunch of common code. One git commit can make changes across everything that touches it.

It's not all rainbows and lollipops though.

A well structured series of git repos isn't really any harder for an agent to navigate, and in many cases can be easier. A huge monorepo can result in agent context windows getting filled quickly while it tries to figure out how everything fits together.

Both can be helped by good AGENT.md files.

3

u/kolorcuk Oct 19 '26

Great repos, 4 repos seems very ok.

I do not get, just clone 4 repos for you agent.

3

u/the_frisbeetarian Oct 19 '26

I would not prematurely split repositories until there is an obvious reason for doing so. Testing a product e2e is way easier to do in a monorepo. From an agentic standpoint it is also easier to iterate on a monorepo with Claude versus the inverse. My company has hundreds of repos. I would love to unwind all of that. The majority of our day isn’t spent developing the product. It is spent coordinating dependencies.

2

u/Relevant_Pause_7593 Oct 19 '26

Monorepos here might solve these problems- but it will also create new ones. Are some things better? Sure. But now you have to manage merge queues, etc.

What is ok, is to combine a couple repos together- because overly distributed repos can crest headaches too.

2

u/115v Oct 19 '26

Never was a fan of mono repos. As long as you’re documenting properly it should be fine

2

u/BoBoBearDev Oct 19 '26

GUI components, monorepo. Otherwise, there is no reason to use monorepo. Microservices was supposed to be independent.

2

u/mysteryweapon Oct 19 '26

I have a friend that works for an org that recently decided that monorepo was the way to go

Everything was starting to be migrated to it, and then they found that the GHA were overwhelming hosted enterprise GitHub

The solution? Why, build your bespoke github server instead

I hear that mono repos can be great in the right situation, but they can also be absolutely terrible, and I don't think they are appropriate for every org

3

u/Rollingprobablecause Director - DevOps/Infra Oct 19 '26

TBF

Everything was starting to be migrated to it, and then they found that the GHA were overwhelming hosted enterprise GitHub

GHA is just overwhelmed by anything and everything all the time these days. They are migrating from GCP to Azure + all the AI vibe coding it's just not a reliable service right now.

1

u/pdp10 Oct 20 '26

They are migrating from GCP to Azure

Sounds totally like a technically-driven decision.

1

u/jake_mok-Nelson Oct 24 '26

For a startup where products are highly related, a monorepo makes sense. Especially in a time of LLMs where harnesses rely on git pretty heavily.

When you realise your API has a lot of consumers and is needing extra attention, break it out, and so on.

You're not a large enterprise, and you don't need the extra process this early in all likelihood.

1

u/jameshearttech Oct 19 '26

At work our main repo is a mid-sized monorepo containing 50+ projects. I work in it daily with VS Code in a dev container running claude code in the terminal.

1

u/zMynxx Oct 19 '26

I believe it depends on the lifecycle of the generated artifact, whether it is shared on not

1

u/Kookoombar Oct 19 '26

On the embedded point: the flashed binary is still an artifact, it's just a .bin or .hex rather than an image. Have CI build each firmware target, name the file with the version and git SHA, and publish it somewhere versioned like an S3 bucket or the release assets. Add a small manifest saying which app and backend versions it was tested with, so flashing a device is just pulling a known file.

Whichever repo layout you pick, that artifact step is what keeps releases traceable, and it makes rollbacks a lot less painful when a device is already out in someone's house.

1

u/Triple-B-564 Oct 19 '26

I’d go for monorepo/not change your current setup (giving value to customer, get more customer is more important than repo setup).

You’ve got one product with tightly related pieces: firmware, peripherals, backend, and mobile app. That usually means changes tend to span multiple repos, especially around protocols, data formats, versioning, and release coordination.

Your CI/CD concern is valid, but it’s usually manageable with path-based triggers so you only build/deploy the parts that changed. So a change in Flutter doesn’t need to trigger firmware builds, and vice versa.

I’d avoid git submodules unless you have a very specific reason to use them. They add complexity without really giving you the same benefits as a true monorepo.

That said, there’s no perfect answer.

For a startup, the bigger priority is delivering value quickly rather than spending too much time optimizing repo structure too early. A monorepo can make coordination easier, especially when different parts of the product need to stay in sync.

1

u/ryan_builds_ci Oct 19 '26

the thing that usually decides this is where the contract between device, app and backend lives. if the payload format or api schema changes, you want that change in one PR that touches all three sides, otherwise the versions drift quietly and you find out in the field. one pattern that helps is a single repo with path-filtered CI, so firmware only builds when firmware/ changes while the app and backend stay independent. and for the vscode thing, opening just the subfolder you're working in means the tree size mostly stops mattering.

1

u/disoculated Oct 19 '26

Unless you're going to only have a very small team of developers forever, or if you are big enough to have a team that manages your developer infrastructure, you will probably not see a big benefit from a monorepo. It can be challenging enough to just get an entire company into a single github organization.

1

u/Rakn Oct 20 '26

Monorepos in bigger companies need dedicated teams managing them. If you are a 1-3 person startup it doesn’t really matter too much. The important thing to remember is that just because it’s all in one repository doesn’t mean it’s doesn’t require some sort of structure.

1

u/hamzezn Oct 20 '26

We run about a dozen products (FastAPI backends, several frontends, a mobile app) in one repo, mostly so AI agents and CI see everything in one place. It works, with a few things I'd do differently from the start:

  • Don't mix monorepo and submodules. We kept one project as a submodule inside the monorepo and lost uncommitted work more than once, because a reset or checkout in the parent quietly moved the submodule's HEAD. Pick one model.
  • Give each component its own folder with its own build file and its own short README for agents (what it is, how to run it, what not to touch). Then you point the agent at one folder, and VS Code can open just that folder too, so the big tree stops being a problem.
  • Trigger CI per path (on: push: paths: ['firmware/**']) so a Flutter change doesn't rebuild the firmware.
  • Keep Docker build contexts per service. A context at the repo root gets slow fast once a few node_modules folders exist.

For 4 repos that all ship as one product, I'd merge them. The firmware is the only part I'd think twice about, since it releases on a different cadence, but a folder plus path-filtered CI handles that fine.

1

u/aidenclarke_12 Oct 20 '26

4 repos that size still makes a small monorepo, path filters in ci keep each folder building separately and Vscode can just open the subfolder you need

1

u/pdp10 Oct 20 '26
  • The crazy-like-a-fox purpose of a monorepo is to make atomic changes all at once across a codebase, instead of planning and executing more-loosely coupled change in multiple repos.
  • I've personally been burned badly by monorepos. In that case there were historic mistakes made that aren't part of the canonical monorepo paradigm, but ultimately the issue was a business need to sell off one product line without touching the others.

I'd like everything to be in one place so agents can easily build up a context

Think hard about what you just typed.

Consumer electronics can easily have a written contract API to loosely-couple the backend and the client. Smooth operations are going to need strategy to cope with aged client codebases, anyway.

1

u/ight-bet Oct 21 '26

Yeah you can definitely mono repo this.

Depends how many people are developing.

You can at least combine flutter, fast api and db stuff. Leaving the embedded out. But if not many devs just throw it all in 1

1

u/hiasmee Oct 21 '26

Do mono for dev, split later for production.

We have mono repository with:

  • docs
  • app / mobile / ios | android
  • backend
  • infrastructure
  • website
  • AGENTS.md

And I love it. We have two mobile aps and one desktop app. For every feature we had to do commits to different repos. Now one feature one pr. It is simple and fast.

When our dev and beta phase are done we will probably split it, but now, if you don't want to outsource some features, this is the best solution at least for us.

And it is better for AI agentic development process.

1

u/sngz Oct 21 '26

can't believe some of the answers I'm reading here. monorepo vs multiple repo is a choice to solve organizational issues that seep into technical costs. there are trade offs to using both.

1

u/abhinavs1920 Oct 19 '26

Four repos is below the size where monorepo tooling pays for itself. The pain you're describing isn't repo count, it's CI being defined four times - reusable workflows from one shared repo make the scatter mostly go away while the trees stay small. The agent-context problem is solvable without merging too: a workspace file or a thin index repo the agent clones alongside the real ones. Submodules are the worst of both options: monorepo tree, separate-repo tooling.

1

u/zukke3000 Oct 19 '26

Does it matter? Stuff like that is an imitation of work. Just pick something and stick to it, until it gets painful. Focus of bringing value to your startup, not on rewriting pipelines each Thursday.

0

u/Manic5PA Oct 19 '26

Monorepo is a bit like microservices, where it can make sense in some cases, but 99% of the people doing it have no real use case to justify the effort and end up building something truly abominable.

0

u/notrufus Oct 19 '26

I have a monorepo for the majority of my system. 3 typescript apps for a shop management system.

I have a separate repo for some FOSS libraries that are free for whoever to use.

One plus is that AI works really well with them. Since all of the context/skills/etc are shared, making changes involving multiple services are really easy to coordinate.

Also, CI versions everything and deploys them consistently every time a merge to main happens, that way if there’s an issue, I can roll everything back to the previous working system.

0

u/Brothapleasedont Oct 19 '26

I've never been forced to work in a monorepo, so anytime I see them it hurts. I feel like with monorepos you trade wayyyy too much architectural felixibility for convenience. They feel like immediate tech debt to me, but I've never been a monorepo guy.

0

u/ChiRho84 Oct 20 '26

Monorepos are for monoliths. Also, Conway's Law.

0

u/[deleted] Oct 19 '26

[deleted] — view deleted comment

0

u/disoculated Oct 19 '26

Somebody isn't familiar with the vast majority of large scale tech companies.

Sure, some SAY they're monorepo, but then you really look and oh, that team? Oh, they think the monorepo is too complicated for their need so they just have one of their own. And then that other team got one because they saw the first team got one and they insisted. Oh, and the Security team? They want control of permissions themselves so they have their own org. The ad people? They have to work with partners, so they need their own Git instance as a barrier against sharing our code with unvetted resources. And Network infra? They're still on SVN. They did promise to move to git, back in 2015, but they haven't had cycles. Maybe next quarter. Honest.

23

u/[deleted] Oct 19 '26

[removed] — view removed comment

2

u/chocopudding17 Oct 19 '26

Stop, slopper.

6

u/[deleted] Oct 19 '26

[removed] — view removed comment

1

u/twnbay76 Oct 20 '26

I don't disagree with most of your proposals

But I will say that just because components aren't written in the same language doesn't mean they don't depend on each other and share context.

A single API contract change for instance can have implications at all 3 software layers potentially and one layer getting it wrong can easily be a hidden bug.

Part of the pitch for something like maven is a language agnostic module system to be able to dependency manage tooling with completely different build systems.

Is inline groovy or XML or abandoned maven plugins sexy? No. But the goal is achieved nonetheless