Course navigationPhase 02
Volume 01 · Phase 02

Monorepo, pnpm Workspaces & Repository Foundation

Create a pnpm monorepo whose boundaries, scripts, shared configuration, and dependency ownership are understandable before feature code grows.

13lessons + labs
8klesson words
6source references
What you will ship

Phase outcome and project increment

Learning outcome

Create a pnpm monorepo whose boundaries, scripts, shared configuration, and dependency ownership are understandable before feature code grows.

Concrete deliverable

TaskFlow repository root with apps/web, apps/api, shared packages, workspace metadata, root scripts, and clean Git hygiene.

Figure 2.1 — Where this phase lives in TaskFlow
Repository root
pnpm-workspace.yaml
apps/*
packages/*
workspace dependencies
root scripts
Turbo/task graph
Trace the flow left-to-right for implementation and right-to-left for debugging. At every arrow, ask what data crosses the boundary and what proves it is trustworthy.
Instructor mental model

Principles to keep while coding

01

A monorepo should make shared ownership and coordinated changes easier, not merely put folders in one repository.

02

Use pnpm workspaces to make package boundaries explicit and dependency installation deterministic.

03

Keep shared configuration in dedicated packages instead of duplicating compiler and lint settings.

04

Run repository-wide tasks from the root while allowing app-specific commands when debugging.

Code-along path

Guided phase lab

Do these in order. Each step should end with evidence before the next one starts.

  1. 01

    Create the repository root and initialize Git before generating applications.

  2. 02

    Declare workspace globs and explain why apps and packages are separate categories.

  3. 03

    Create web and API workspaces without copying node_modules between them.

  4. 04

    Create a shared TypeScript configuration package and consume it through workspace dependencies.

  5. 05

    Add root dev/build/typecheck/test scripts that delegate to workspaces.

  6. 06

    Inspect pnpm why/list output so you can explain where a dependency is owned and why.

TerminalVerification commands
pnpm -w install
pnpm --filter web dev
pnpm --filter api start:dev
pnpm -r typecheck
git status

Predict what each command proves before running it. A command is useful only when its output answers a question.

Debugging studio

Failures you should know how to diagnose

Failure drill 1

Installing app-only dependencies at workspace root

Predict the symptom, capture evidence at the nearest boundary, change one variable, and verify the same reproduction after the fix.

Failure drill 2

Duplicating tsconfig settings in every package

Predict the symptom, capture evidence at the nearest boundary, change one variable, and verify the same reproduction after the fix.

Failure drill 3

Using relative imports across app boundaries instead of package contracts

Predict the symptom, capture evidence at the nearest boundary, change one variable, and verify the same reproduction after the fix.

Failure drill 4

Committing build output, environment files, or node_modules

Predict the symptom, capture evidence at the nearest boundary, change one variable, and verify the same reproduction after the fix.

Watch-order style

Lessons

The source chapters come first. Every phase now ends with a guided build, a debugging workshop, and an independent challenge so reading turns into transferable skill.

Practice ladder

Exercises that increase independence

Guided

Create the repository root and initialize Git before generating applications.

Practice

Create web and API workspaces without copying node_modules between them.

Debug

reproduce and diagnose — Installing app-only dependencies at workspace root.

Independent

deliver TaskFlow repository root with apps/web, apps/api, shared packages, workspace metadata, root scripts, and clean Git hygiene.

Explain-back

Can explain workspace protocol dependencies and Can run one app and the whole repository intentionally.

Mastery gate

Do not leave the phase only because you reached the bottom

Phase exit criteria

Knowledge check

Scenario and concept quiz

These questions test engineering choices rather than whether you remember a lesson title.

0/0 correct · 0/8 answered
01Which practice best matches Phase 02's engineering goal?
02Which practice best matches Phase 02's engineering goal?
03Which practice best matches Phase 02's engineering goal?
04Which practice best matches Phase 02's engineering goal?
05You are working through the Phase 02 lab. Which next action is the most disciplined step?
06You are working through the Phase 02 lab. Which next action is the most disciplined step?
07You are working through the Phase 02 lab. Which next action is the most disciplined step?
08You are working through the Phase 02 lab. Which next action is the most disciplined step?
Source snapshot

Reference files

Attempt the work first. Use snapshots to compare a checkpoint, not as a substitute for understanding.

reference/TaskFlow_Root_Snapshot/.gitattributes
* text=auto

*.sh text eol=lf
*.bat text eol=crlf
*.cmd text eol=crlf

*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.pdf binary
reference/TaskFlow_Root_Snapshot/.gitignore
# Dependencies
node_modules/
.pnpm-store/

# Framework/build output
.next/
dist/
coverage/

# Logs
*.log

# Environment secrets
.env
.env.*
!.env.example

# OS noise
.DS_Store
Thumbs.db
reference/TaskFlow_Root_Snapshot/.node-version
24.21.0
reference/TaskFlow_Root_Snapshot/README.md
# TaskFlow

TaskFlow is the production-style project used by the Full-Stack Developer 2026 course.

## Course baseline

- Node.js 24.21.0
- pnpm 12.4.2
- Windows-first development workflow

## Workspace

- `apps/` - deployable applications
- `packages/` - reusable packages introduced only when needed

## Current phase

Phase 02 - Monorepo, pnpm Workspaces and Repository Foundation
reference/TaskFlow_Root_Snapshot/package.json
{
  "name": "taskflow",
  "version": "0.0.0",
  "private": true,
  "packageManager": "pnpm@12.4.2",
  "engines": {
    "node": ">=24.21.0 <25"
  },
  "scripts": {
    "workspace:list": "pnpm list -r --depth -1"
  }
}
reference/TaskFlow_Root_Snapshot/pnpm-workspace.yaml
packages:
  - "apps/*"
  - "packages/*"