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
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.
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.
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.
Run the generator:
npx create-nx-workspace@latest
Monorepo Examples
These are example monorepos using Turborepo.
- cal.com this is a large scale well put together monorepo that covers a lot of bases using Turborepo. Itās well worth study and solves a lot of difficult production problems around building and testing an application at scale. One unique aspect is that the repository also includes some private packages that are imported using git submodules which keeps those packages/apps internal for business reasons while allowing the core to be open source.
- Turbo Kitchen Sink Example is an official Turbo example that covers a lot of ground and is a great reference. It imports a next.js application and a remix application as well as some other ā nice to haveā features to explore.
- Skill Recordings Products is a monorepo maintained by the folks that produce egghead.io, Epic React, Just JavaScript, and Testing Accessibility among others and features next.js and remix applications and a library of packages that support delivering developer education products.
- Turborepos with Over 100 āļøs is a spreadsheet featuring all 180+ repos on github that have over 100 stars and depend on Turborepo. The odds are that if you need some configuration or structure youāll be able to find it in here.