Understanding monorepos
The structure of a dedicated repository has always been very similar; we have a single package.json
in the root, a single node_modules
folder containing the resolved dependencies, and a set of source and configuration files, usually scattered between the root and some specific folders such as src
. A quite popular setup is shown in Figure 9.1:
Figure 9.1 – Common setup for a repository with a single package
In the common setup, we have some folders for CI/CD pipeline definitions and potential tools that are useful for managing the repository, as well as auxiliary files such as project documentation. Of course, for a Node.js project, we’ll see a node_modules
directory, as well as a package.json
file.
In contrast, a monorepo will contain multiple package.json
files with multiple node_modules
(or alternative) folders. Likewise, the source files and potentially some of the configuration will also be scattered across multiple...