Mono Repo Structure
Overview
The MOOD MNKY ecosystem uses a mono repository architecture to organize all codebase components and ensure consistency across our digital products. This approach allows us to share code, maintain unified standards, and streamline development workflows.Our mono repo is managed with Turborepo, providing parallel execution, incremental builds, and a structured development experience.
Repository Organization
Apps
Next.js app (MNKY VERSE + Dojo + LABZ) in
apps/web/Shopify
Liquid theme and theme app extension
Supabase
Migrations and Edge Functions at repo root
Extensions
Theme app extension (blocks, embed)
Config
Root package.json, turbo.json, pnpm-workspace
Directory Structure
The mood-mnky-command monorepo uses a single Next.js application (apps/web/) that hosts MNKY VERSE, The Dojo, and MNKY LABZ via route groups:
The Supabase config lives in
supabase/ at the repo root. Migrations, Edge Functions, and config are in that directory. Run supabase start and supabase db reset from the repo root.Application Structure
Theapps/web/ Next.js app uses the App Router with route groups:
- apps/web
- Shopify Theme
Package Structure
Shared packages follow a consistent structure to make them easy to consume:Infrastructure and Data Organization
Our infrastructure and data follow a clear organization:- Supabase
- Agent Integration
Dependency Management
We use a combination of tools to manage dependencies in our mono repo:Package Manager
pnpm is our primary package manager, chosen for its efficient handling of dependencies in a mono repo structure.
Workspace Configuration
Our workspaces are configured in pnpm-workspace.yaml:And the root package.json:
Supabase Integration
The Supabase integration follows our structured organization:Migrations
Migrations
Migrations live in Run
supabase/migrations/ at the repo root. Each migration is a timestamped SQL file applied in sequence:supabase db reset from the repo root to apply all migrations.Supabase Client
Supabase Client
The app uses
@supabase/supabase-js from apps/web/lib/. Create clients with NEXT_PUBLIC_SUPABASE_URL and NEXT_PUBLIC_SUPABASE_ANON_KEY (or SUPABASE_SERVICE_ROLE_KEY for server-side).Development Workflow
Developing in our mono repo follows these principles:- Task Isolation: Work on isolated features or bugfixes in dedicated branches
- Local Development: Use Turborepo’s filtering to run only relevant applications and packages
- Dependency Management: Add shared code to appropriate packages rather than duplicating across apps
- Testing: Write tests for shared packages to ensure reliability across applications
- Documentation: Document shared components and utilities to facilitate reuse
Setting Up Supabase for Development
To set up Supabase for local development:Start Supabase Local Development
Apply Migrations
migrations directory and reset the database to a clean state.Typical Development Commands
CI/CD Integration
Our continuous integration pipeline is configured to handle our mono repo structure efficiently:Change Detection
The pipeline detects which packages and apps have changed to determine what needs to be built and tested.
Dependency Analysis
It analyzes dependencies to ensure that changes to shared packages trigger builds and tests for dependent apps.
Parallel Execution
Build and test jobs run in parallel for independent packages and apps to minimize pipeline time.
Best Practices
Code Organization
- Keep apps and packages focused on specific concerns
- Extract shared code into dedicated packages
- Maintain consistent file structure across apps
Dependencies
- Minimize dependencies between packages
- Avoid circular dependencies
- Properly declare all dependencies in package.json
Performance
- Use Turborepo’s caching for faster builds
- Implement code splitting within apps
- Optimize package sizes
Testing
- Write tests for shared packages
- Use mocks for complex dependencies
- Ensure tests run in isolation
Documentation
- Document package APIs and component usage
- Maintain README files for all packages
- Use TypeScript for type safety
Versioning
- Follow SemVer for all packages
- Document breaking changes
- Keep package versions in sync when appropriate
Resources
Turborepo Documentation
Official documentation for our build system
pnpm Workspaces
Documentation for pnpm workspace features
Internal Architecture Docs
Detailed architecture documentation for the MOOD MNKY ecosystem
Supabase Documentation
Official Supabase documentation
For questions about our mono repo structure, please contact the MOOD MNKY development team.