A monorepo should make shared ownership and coordinated changes easier, not merely put folders in one repository.
Course navigationPhase 02⌄
Monorepo, pnpm Workspaces & Repository Foundation
Create a pnpm monorepo whose boundaries, scripts, shared configuration, and dependency ownership are understandable before feature code grows.
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.
Principles to keep while coding
Use pnpm workspaces to make package boundaries explicit and dependency installation deterministic.
Keep shared configuration in dedicated packages instead of duplicating compiler and lint settings.
Run repository-wide tasks from the root while allowing app-specific commands when debugging.
Guided phase lab
Do these in order. Each step should end with evidence before the next one starts.
- 01
Create the repository root and initialize Git before generating applications.
- 02
Declare workspace globs and explain why apps and packages are separate categories.
- 03
Create web and API workspaces without copying node_modules between them.
- 04
Create a shared TypeScript configuration package and consume it through workspace dependencies.
- 05
Add root dev/build/typecheck/test scripts that delegate to workspaces.
- 06
Inspect pnpm why/list output so you can explain where a dependency is owned and why.
pnpm -w install
pnpm --filter web dev
pnpm --filter api start:dev
pnpm -r typecheck
git statusPredict what each command proves before running it. A command is useful only when its output answers a question.
Failures you should know how to diagnose
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.
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.
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.
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.
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.
Monorepo Mental Model
Create the TaskFlow Root Repository
pnpm Workspaces and Dependency Boundaries
Root Scripts and Workspace Commands
Git Repository Hygiene
Professional Monorepo Workflow and Troubleshooting
Hands On Lab Exercises and Phase Exit
Workspace Command Reference and Practical Patterns
Repository Design Decisions and Anti Patterns
Guided Build Lab
Purpose Create a pnpm monorepo whose boundaries, scripts, shared configuration, and dependency ownership are understandable before feature code grows.
Debugging Workshop
Goal Learn to diagnose this phase's failures systematically instead of reinstalling packages, changing random configuration, or copying a fix without understanding it.
Phase Synthesis & Independent Challenge
Mission Rebuild the capability of Phase 02 without following the exact code line-by-line. The goal is transfer: can you use the ideas when the variable names, UI, or route shape changes?
Mastery Capstone Lab
Integrate Phase 02 without following a transcript.
Exercises that increase independence
Create the repository root and initialize Git before generating applications.
Create web and API workspaces without copying node_modules between them.
reproduce and diagnose — Installing app-only dependencies at workspace root.
deliver TaskFlow repository root with apps/web, apps/api, shared packages, workspace metadata, root scripts, and clean Git hygiene.
Can explain workspace protocol dependencies and Can run one app and the whole repository intentionally.
Do not leave the phase only because you reached the bottom
Phase exit criteria
Scenario and concept quiz
These questions test engineering choices rather than whether you remember a lesson title.
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/*"