Skip to content

Create a Monorepo for Web Projects

This guide will bootstrap a monorepo for web projects, with the following features:

  • Building using pnpm

Setup project

Create a new directory for the project and change directory into it

mkdir my-monorepo && cd my-monorepo

Create a package.json

pnpm init

Create a PNPM workspace

Create a pnpm-workspace.yaml with the paths of packages you want to be part of the workspace.

pnpm-workspace.yaml
packages:
    - "packages/*"
    - "apps/*"

Create a .npmrc and enable hoisting, some tools need it.

.npmrc
shamefully-hoist = true

Last update: August 5, 2023
Created: May 27, 2023