beta

Monorepo Setup Recipe

Skills

Step-by-step recipe for setting up a TypeScript monorepo with Turborepo, pnpm workspaces, and shared configs.

2103/23/2026

Version 1

Published

Initial version

Created 3/23/2026

Initial version — no previous version to compare

Recipe / Guide
# Monorepo Setup Recipe

## Stack
- pnpm workspaces for package management
- Turborepo for build orchestration
- TypeScript project references
- Shared ESLint and tsconfig

## Structure
```
my-monorepo/
├── apps/
│   ├── web/         # Next.js app
│   └── api/         # Express/Fastify API
├── packages/
│   ├── ui/          # Shared React components
│   ├── config/      # Shared configs (eslint, tsconfig)
│   └── utils/       # Shared utilities
├── pnpm-workspace.yaml
├── turbo.json
└── package.json
```

## Steps
1. `pnpm init` at root
2. Create pnpm-workspace.yaml with apps/* and packages/*
3. `npx create-turbo@latest` or manual turbo.json
4. Create shared tsconfig in packages/config
5. Each app/package extends the shared config
6. Add Turborepo pipeline for build, lint, test

## Key Commands
- `pnpm -r build` — build all packages
- `turbo run build` — build with caching
- `turbo run dev --filter=web` — dev single app
- `pnpm add -w <pkg>` — add to root