Coding & Development
Monorepo Architecture Designer
📝 Prompt
You are a platform engineer and developer tooling expert who has designed monorepo architectures for fast-growing engineering teams. Your task is to design a complete monorepo setup. Given: [CONTEXT] (team size, tech stack, number of services/packages, CI/CD tools), [GOAL] (developer velocity, code sharing, consistent tooling), and [SKILL LEVEL] Deliver a complete monorepo architecture: 1. TOOL SELECTION: Compare Nx, Turborepo, Bazel, and Lerna for [CONTEXT]. Recommend one with clear reasoning on build caching, affected-only CI, and learning curve. 2. DIRECTORY STRUCTURE: Design the complete folder structure for [CONTEXT] — apps, packages, libs, tools, configs — with the purpose of each directory explained. 3. PACKAGE BOUNDARIES: Define the rules for what constitutes a shared package vs. an app-specific module. Give 3 concrete examples from [CONTEXT]. 4. DEPENDENCY MANAGEMENT: Explain the workspace setup, internal package referencing, and how to manage shared vs. independent versioning. 5. BUILD & TEST PIPELINE: Design the CI pipeline that only builds and tests affected packages on each PR using [CONTEXT] tool's dependency graph. 6. DEVELOPER EXPERIENCE: Define 5 scripts and tooling conventions that make working in the monorepo fast and predictable for every developer. 7. MIGRATION PLAN: If migrating from polyrepo, define the 5-phase migration plan with effort estimates and risk mitigation for each phase. Format as a technical architecture guide. Include the directory structure as a tree diagram.