Packages Overview
The MOOD MNKY monorepo includes several shared packages that enable code reuse, maintainability, and consistency across applications. These packages provide common functionality, UI components, and configuration that all applications can leverage.All packages follow consistent structure and are published as workspace dependencies. See Monorepo Structure for details on package organization.
Package Architecture
Shared packages are organized to maximize reuse while maintaining clear boundaries:UI Components
ShadCN-based component library for consistent design
Supabase Client
Wrapped Supabase client with SSL support and type safety
ESLint Config
Shared linting configurations for code consistency
TypeScript Config
Shared TypeScript configurations and compiler options
Package Comparison
| Package | Purpose | Used By | Key Features |
|---|---|---|---|
| @repo/ui | UI Components | All apps | ShadCN components, theming, accessibility |
| @repo/supabase-client | Database Client | All apps | SSL support, type safety, singleton pattern |
| @repo/eslint-config | Linting | All apps | Consistent code style, shared rules |
| @repo/typescript-config | Type Safety | All apps | Shared TS config, strict mode |
Using Shared Packages
Installation
Packages are automatically available as workspace dependencies:Importing Packages
Package Development
- Create Package: Add new package to
packages/directory - Configure: Set up
package.jsonwith workspace reference - Build: Package builds automatically with monorepo build
- Use: Import in applications as workspace dependency
Package Structure
All packages follow a consistent structure:Creating New Packages
When to Create a Package
Create a new package when:- Code is used by multiple applications
- Functionality is self-contained and reusable
- You want to enforce consistent APIs
- Code represents a distinct domain or capability
Package Creation Steps
-
Create Directory:
-
Initialize Package:
-
Configure Workspace:
-
Add to Workspace:
Ensure
pnpm-workspace.yamlincludespackages/* - Build Configuration: Set up TypeScript and build scripts
Package Best Practices
API Design
- Clear Exports: Export only what’s needed
- Type Safety: Provide TypeScript types
- Documentation: Document public APIs
- Versioning: Follow SemVer for breaking changes
Testing
- Unit Tests: Test package functionality in isolation
- Integration Tests: Test package usage in apps
- Type Tests: Ensure TypeScript types are correct
Maintenance
- Keep Updated: Update dependencies regularly
- Document Changes: Maintain changelog
- Breaking Changes: Communicate breaking changes clearly
Package Usage by Application
| Package | Used By | Purpose |
|---|---|---|
| @repo/ui | All apps | Consistent UI components |
| @repo/supabase-client | All apps | Database access and auth |
| @repo/eslint-config | All apps | Code quality and consistency |
| @repo/typescript-config | All apps | Type safety and compilation |
Package Dependencies
Related Resources
- Monorepo Structure - Overall architecture
- Applications - Applications using packages
- Development Guides - Setup and workflows
- MNKY VERSE - See UI components in action
- TRVLR Sync - See Supabase client usage