Back to prompts
Coding & DevelopmentPremiumadvanced
0.0

Monorepo Architecture — Design a Scalable Multi-Package Repository

Plan your monorepo structure, tooling, CI/CD, and dependency management before writing a single line of code.

Copy & Paste this prompt
You are a monorepo architect who has designed repository structures for teams of 5 to 500 engineers.

Design a monorepo architecture for my project.

What I'm building: [DESCRIBE YOUR PROJECTS — e.g., 'web app + mobile app + shared component library + API']
Language(s): [TypeScript / Python / Go / Mixed]
Team size: [NUMBER OF DEVELOPERS]
Current structure: [SEPARATE REPOS / MESSY MONOREPO / STARTING FRESH]
Package manager preference: [NPM / PNPM / YARN / NO PREFERENCE]

Deliver:

1. DIRECTORY STRUCTURE — Complete folder layout with explanations
2. TOOLING SELECTION — Pick the right tools and explain why:
   - Build system: [Turborepo / Nx / Bazel / Lerna + custom]
   - Package manager: [with workspace config]
   - Versioning: [independent / locked / changesets]
3. DEPENDENCY MANAGEMENT — Rules for:
   - How packages depend on each other
   - Shared dependencies (hoisted vs local)
   - Version pinning strategy
4. CI/CD PIPELINE — Build only what changed:
   - Affected package detection
   - Parallel build and test strategy
   - Deploy pipeline per app
   - Cache strategy (local + remote)
5. DEVELOPER EXPERIENCE — How does a new developer:
   - Clone and set up in <5 minutes
   - Create a new package
   - Run/test a single package
   - Understand what depends on what
6. SCALING CONCERNS — What breaks at 50 packages? 100? 500? How to prevent it.
#monorepo#architecture#tooling#ci-cd#developer-experience

Works with

chatgptclaudecopilot

💡 Pro Tips

  • Start with Turborepo if you're under 20 packages — it's the simplest
  • The #1 monorepo mistake: not having a shared config package
  • Remote caching can cut CI time by 80% — set it up on day one

✨ Example Output

TOOLING: Turborepo + pnpm workspaces
WHY: Best cache hit ratio for TypeScript projects and zero config. Nx is more powerful but overkill for your 3-person team.

STRUCTURE:
/apps/web — Next.js frontend
/apps/api — Express API
/packages/ui — Shared React components
/packages/shared — Types, utils, constants
/packages/config — ESLint, TSConfig, Prettier presets

NEW DEV SETUP: git clone → pnpm install → pnpm dev (everything runs)

🧠 Why This Works

Monorepos provide code sharing and atomic commits but require careful architecture to avoid slow builds and dependency hell. This prompt designs the workspace structure, build tooling, and CI/CD strategy that makes monorepos scale with your team.

📅 When to Use This Prompt

Use when consolidating multiple repositories into a monorepo, when setting up a new monorepo from scratch for a multi-package project, or when your existing monorepo has performance issues with builds, tests, or dependency management.

🎯 What You'll Get

You'll receive a complete monorepo architecture with package structure, shared dependency strategy, build tool configuration (Turborepo/Nx/Lerna), CI/CD optimizations using affected-only builds, and release/versioning workflow.

🔗 Related Prompts

Coding & DevelopmentPremium

CI/CD Pipeline Architect

Design a complete CI/CD pipeline — build, test, deploy, monitor — with config files ready to use.

ci-cddevopsgithub-actions
4.8
advanced