Online / 5 & 6 February 2022


From microrepos to monorepo: thrilling adventures in refactoring

On how to tame, and accelerate, builds and tests in a 25 module monorepo

Building a monorepo composed of more than 25 modules, internal dependencies and iOS and Android app to boot is a challenge. Doing so fast and under a certain cost threshold might seem daunting. However, in polypoly we’ve tried to do it for the past few months, creating our own build/test tool with 0 dependencies and a straightforward approach to what a monorepo needs, when it needs.

Testing needs to follow the F.I.R.S.T. principles, of which the first one, Fast, is possibly the most important. Fast testing ensures that developers respond quickly to all kind of testing errors, and of course it keeps the cost of testing low.

Monorepos have additional challenges: dependencies cross language boundaries, dependence graphs are not explicit, and there's the risk of centralising some, none, or all the submodule upstream dependencies.

At polypoly we have been using a monorepo since May 2021. In this talk we will show how we have tackled this challenge with a series of GitHub actions, as well as creating a tool, build.js, which is geared towards dealing with monorepos.

We will show how this tool partially solves the speed issue, and what are our plans, going forward, to make tests faster and deal with implicit dependency graphs. We will also examine best practices in the area of monorepo builds for projects whose majority is written in Javascript/Typescript.


Photo of Juan Julián Merelo Juan Julián Merelo