Monorepo Party šŸŽ‰

This is a collection of curated monorepo resource. Itā€™s maintained by Joel Hooks to support learners in a monorepo workshop.

Github Repo for Cascadiajs 2022 Workshop

You can edit this page on github.

Table of Contents

What are monorepos?

A monorepo is a single repository used to house multiple often related applications, utilities, libraries, and tools.

In a lot of ways a monorepo is the opposite of a monolith.

At itā€™s simplest form a monorepo is an software architecture decision on how projects and code get organized.

A monorepo allows for your projects and code to be collocated, meaning itā€™s there right next to other code, and allows for more efficient knowledge share and collaboration even when many individuals and teams are involved.

Does a monorepo solve all of these problems? No.

Itā€™s just a tool, but itā€™s a pretty good one!

Monorepo Concept Map

a visual diagram of a selection of concepts in a monorepo

open in miro

Choosing a Package Manager

There are three primary choices for managing package managers in the node ecosystem.

npm

is the primary registry for node packages and also has a CLI that is installed by default with node. There might be reasons to choose this package manager for a monorepo, but we wonā€™t.

yarn

mature and safe with good workspace options and you could use it with no other tools to manage your monorepo.

šŸŽ‰ pnpm

ā€œperformant npmā€ is built to be performant in monorepos and has nice ergonomics so this is our choice for now. Hereā€™s an overview video.

drake loves pnpm and not yarn or npm

Monorepo Guides

monorepo.tools is an excellent intro into the world of monorepos from the folks at nrwl. It gives a balanced look at the current landscape and provides a feature comparison across different tooling for monorepos. nrwl created and maintains the awesome Nx tool which is a great option for automating most monorepo tasks.

monorepo.guide is a ā€œmonorepo style guideā€ from Thinkmill. This is tool agnostic and their how-to doesnā€™t use any specific monorepo tooling and focuses on workspaces within the yarn package manager. The Thinking in Monorepos article is a great place to start to get in the monorepo mindset.

Monorepo Tools

You can maintain a monorepo without tools, but you probably donā€™t want to.

šŸŽ‰ Turborepo

Created by Jared Palmer and now part of Vercel, Turborepo is a lightweight task runner, and not much else. This is generally considered a ā€œfeatureā€ and one of the design considerations for Turbo was how it can ā€œdo lessā€ in the space and stay out of your way.

Turbo Quick Start

Run the generator:

npx npx create-turbo@latest

Nx

Nx is a full-featured monorepo powerhouse that does a lot more than just running tasks. Nx provides a mature tool with powerful code generation, plugins, and other integrations that are very useful.

Nx Core Tutorial

Run the generator:

npx create-nx-workspace@latest

Monorepo Examples

These are example monorepos using Turborepo.