When starting migration from a 6 year old codebase written in a myriad of different technologies, we wanted to incorporate some of the lessons learned when building the next version of our application. We wanted to be building in a way that would carry Buffer through the next 6 years of development.
We started by pulling some of the reusable utilities into packages hosted in separate repositories. Breaking up the application into separate packages allows each package to be updated incrementally or completely rewritten as needed. This pattern is much better for handling technology changes and changes in product direction. This is because you don’t have to get things right on the first iteration. However, we quickly found that package maintenance and synchronization costs were piling up as we added more packages.
This is where we started to explore using a monorepo to synchronize packages and reduce maintenance costs. We started using a tool called Lerna to manage packages and later added Yarn workspaces to further enhance the developer experience. The addition of these tools was game changing. The tools allowed us to forget about updating package versions and made it easy to debug packages locally without having to sacrifice the developer experience. On top of this we’re able to share code across teams and even across applications with minimal effort.
In this talk I’ll do a live demo showing how to setup a monorepo with the same tools we use at Buffer.