Monorepo (repository เดียวสำหรับหลายโปรเจกต์/service) และ polyrepo (repository แยกต่อโปรเจกต์) เป็นสองกลยุทธ์สำหรับการจัดระเบียบโค้ดข้ามหลายโปรเจกต์ แต่ละแบบมี trade-off ที่สำคัญซึ่งส่งผลต่อการทำงานร่วมกัน, เครื่องมือ และการ scale — การเข้าใจมันช่วยในการตัดสินใจเชิงสถาปัตยกรรมที่สำคัญ
Monorepo — repo เดียวสำหรับทุกอย่าง
Many projects/services/libraries in a SINGLE repository:
✓ SHARED code/libraries easy to use and refactor (one place, atomic changes)
✓ ATOMIC commits across projects (change an API and all its consumers together)
✓ Unified tooling, versioning, CI; consistent standards; easy cross-project visibility
✓ Simplified dependency management (one version of shared code)
✗ Repo can get HUGE (needs scaling tooling — sparse checkout, build caching)
✗ Needs sophisticated build/CI tooling (Nx, Turborepo, Bazel) to be efficient
✗ Broad access; CI must be smart (only build what changed)
→ Used by Google, Meta, etc. (with heavy tooling investment).
