Monorepo Guide
My Dashboard is organized as a monorepo containing multiple related packages and applications. This guide explains the structure, benefits, and best practices for working with our monorepo setup.
📁 Repository Structure
my-dashboard/
├── client/ # React frontend application
│ ├── src/
│ ├── public/
│ ├── package.json
│ └── vite.config.ts
├── server/ # Node.js backend API
│ ├── src/
│ ├── docs/
│ ├── package.json
│ └── tsconfig.json
├── docs/ # Docusaurus documentation
│ ├── docs/
│ ├── src/
│ ├── package.json
│ └── docusaurus.config.ts
├── shared/ # Shared utilities and types (future)
│ ├── types/
│ ├── utils/
│ └── package.json
├── README.md
└── .gitignore
🎯 Benefits of Monorepo
Code Sharing
- Shared Types - Common TypeScript interfaces across client and server
- Utilities - Reusable functions and helpers
- Constants - Shared configuration and constants
- Validation - Common validation schemas
Development Efficiency
- Single Repository - All code in one place
- Unified Tooling - Consistent linting, testing, and build processes
- Atomic Changes - Update multiple packages in a single commit
- Simplified Dependencies - Shared development dependencies
Coordination Benefits
- Version Synchronization - Keep related packages in sync
- Cross-package Refactoring - Easy to update across boundaries
- Integrated Testing - Test interactions between packages
- Unified CI/CD - Single pipeline for all packages
🔍 Best Practices
Code Organization
- Clear Boundaries - Well-defined package responsibilities
- Minimal Coupling - Reduce dependencies between packages
- Shared Abstractions - Common interfaces and types
- Consistent Structure - Similar folder structure across packages
Dependency Management
- Hoist Common Dependencies - Share dev dependencies at root
- Version Alignment - Keep related dependencies in sync
- Peer Dependencies - Use for shared runtime dependencies
Development Practices
- Atomic Commits - Changes that affect multiple packages
- Cross-package Testing - Integration tests across boundaries
- Consistent Tooling - Same linting and formatting rules
- Documentation - Clear package purposes and APIs