Monorepo & One Lingua Franca: TypeScript

Rafael Rozon
5 min readMar 29, 2021

Building a Web App Series: Issue #2

Photo by Nick Fewings on Unsplash

I guess the first technical decision when building a web app is: where will it live? Traditionally, there were 2 options: a monorepo or multi repositories. But I have seen it, and it’s possible to have a hybrid. Use a monorepo for some projects and also other multiple repositories, each one for a single project. I’m choosing the monorepo model, but I can always go hybrid and have some projects in their own repository if things change. What follows is why and how it may look like it.

But, first, a little digression.

What is a monorepo?

A monorepo is a source code repository that contains many projects. Traditionally software has been split into multiple projects, and each one gets its own folder and source control history. A monorepo is a single folder with many other sub-folders where each one is a project in itself. Usually, there is one single source control history, but there are alternative setups.

A few more definitions for what follows:

  • Web App: the UI that the user interacts with
  • Project: source code for an application
  • Application: source code that is up and running. That’s a crude explanation, but it seems clear. This would be a web server, a database, a Redis server, etc.

Why to chose a monorepo?

In my experience, these are some of the challenges I have seen when multiple teams are changing multiple projects at the same time:

  • The logic gets spread out everywhere, and it’s hard to find code and understand how things work.
  • Duplication of code, configuration, assets, etc.
  • Refactoring and implementation that cross projects are hard to do.
  • Managing the dependencies between projects can be difficult when there are multiple levels of dependency. Package D is updated, then package C, B needs to be updated so package A can get new versions of packages C and B. Multiply that by 5 packages and things get complicated.

This is what I want to avoid, and in addition to that there are some benefits too, which are important for me:

--

--