Monorepo Structure
Turborepo-based monorepo architecture for code reuse, unified tooling, and simplified dependency management.
All applications and packages are organized in a single repository using Turborepo for orchestration. This structure enables shared code, consistent tooling, and simplified dependency management across frontend and backend applications.
Overview
All applications and packages coexist in one repository with clear organizational boundaries:
apps/- Applications (API, Web, Docs, etc.)packages/- Shared packages (core, react, ui, etc.)tools/- Shared tooling configurations (ESLint, TypeScript)
Why Monorepo?
We chose a monorepo over standalone repositories for several key benefits:
- ✅ Code reuse - Shared UI components, types, and utilities across apps
- ✅ Unified tooling - Consistent linting, formatting, and build standards
- ✅ Faster CI/CD - Turborepo caching speeds up builds and tests
- ✅ Simplified dependencies - Automatic synchronization across workspace packages
- ✅ Better DX - Single repository, consistent developer experience
Package Dependency Graph
Organization
Applications (apps/)
Each application is self-contained but can import shared packages:
apps/fastify- Fastify backend APIapps/next- Next.js frontend applicationapps/docu- Documentation site (Fumadocs)
Packages (packages/)
Packages follow strict dependency rules and use different dependency strategies based on package type:
core- Generated runtime-agnostic API client + types (via hey-api from OpenAPI) - no runtime dependenciesreact- React-specific hooks and TanStack Query integration (generated via hey-api) - peer dependencies for framework depsui- Shared UI components (Shadcn/ui based) - bundles dependencies for simplicityemail- Email template library (React Email) - bundles dependencies for consistencynotif- Notification service - bundles tightly-coupled deps, peer for config/enverror- Error handling utilities with Sentry integration (platform-specific exports) - peer dependencies for optional platform depsutils- Shared utilities (logger, async helpers, web3 utilities) - peer dependencies for flexibility
Dependency Direction
Strict one-way dependencies prevent circular references:
core → react
↑
apps/fastify (OpenAPI)
↓
apps/nextWorkspace Configuration
The monorepo uses pnpm workspaces for dependency management:
workspace:*protocol for internal package dependencies- Symlink-based resolution for fast local development
- Proper hoisting of shared dependencies
Development Workflow
- Local development - Direct TypeScript imports (no build step)
- Package builds -
tsupcompiles packages to ESM for publishing - CI/CD - Turborepo orchestrates builds with intelligent caching
- Publishing -
prepackscripts switch exports todist/for npm