A “Megarepo” is exactly what it sounds like: All your code lives in ONE source folder.
It is distinct from a “Monorepo”, where your code is split into different packages.
In a Megarepo, there is just one package, one package.json, one tsconfig.json
, one src
folder, etc. It is then up to the build tools to figure out how to slice and dice everything properly.
Moving to a Megarepo structure is a very liberating experience. Here are some of the benefits:
- It removes artificial boundaries between packages
- You’ll never find yourself wondering: “should I add this to package x? or y? or create a new package?”
- Better code organization
- Once you get over the idea of organizing in “packages”, you can start organizing your code in a more granular way. For example, based on topics. We’ll talk about that later
- Less code!
- You can get rid of all the overhead, duplication, and clutter that comes with each new package. And you can get rid of most tools as well.