Monorepo Tips and Tricks
Published ....
Last modified ....
Share this post on BlueskySee discussion on Bluesky
I've been noodling on monorepos for a while now, and I wasn't sure how I wanted to start sharing some of my thoughts on managing monorepos and making it easier to work within them.
For context, I helped setup and manage a large scale web monorepo while I was at Wayfair, and I've done the same at Fireworks as well. While I don't claim to know everything about monorepos, I have a number of years working within them with a large number of contributors (and 100's of contributions to the main branch per week on average).
This post (and future posts about monorepos), focuses in on "node monorepos", e.g. those that use package managers like npm, bun, yarn, pnpm, deno, etc and where the code uses JavaScript/TypeScript, or otherwise usually relies on node_modules. However some of these recommendations may apply to other kinds of monorepos as well.
I plan to write a bit more about monorepos in the future, but I figured I should start with some top of mind tips and tricks (really just a set of recommendations). These are presented in no particular order - if you have any questions on these feel free to reach out!
Dependency Management
1. Always specify dependencies within the workspace that depend on them
Often when working within a monorepo - some dependencies may have been resolved by other workspaces within the repo. For example, if you have a React application and several libraries used within that application, the dependency is most likely installed by either the app or the libraries. This can make it really easy to accidentally forget to properly declare a dependency within a new workspace.