Overview
i18n Doctor is built as a monorepo using pnpm workspaces for dependency management and Turborepo for task orchestration. This structure promotes code reuse, consistent tooling, and efficient builds across multiple packages.Workspace Layout
The repository is organized into two main directories:Package Details
apps/www - Main Web Application
The core Next.js application serving the i18n Doctor web interface.
Directory Structure
Directory Structure
- Next.js 15 with App Router and React 19
- Turbopack for development and production builds
- Tailwind CSS v4 for styling
- Server and client components architecture
- API routes for scanning and data operations
www (private)
Scripts:
packages/ui - Shared UI Library
Reusable UI primitives and components shared across the workspace.
This package uses raw TypeScript source exports with no build step. The www app transpiles it directly via
transpilePackages: ["@workspace/ui"] in next.config.ts.@workspace/ui
Exports:
@workspace/ui/ui/*- Base UI primitives@workspace/ui/components/*- Complex components@workspace/ui/lib/*- Utility functions@workspace/ui/hooks/*- React hooks
- Base UI (@base-ui/react)
- Radix UI primitives
- shadcn-style component patterns
- Class Variance Authority for variants
- Tailwind CSS for styling
packages/eslint-config - ESLint Configuration
Package Name: @workspace/eslint-config
Shared ESLint flat config for consistent linting across all packages.
Features:
- Modern ESLint flat config format
- Next.js-specific rules
- TypeScript integration
- Import sorting and organization
- Zero warnings policy (
--max-warnings 0)
packages/typescript-config - TypeScript Configuration
Package Name: @workspace/typescript-config
Shared TypeScript configuration bases for consistent type checking.
Configs:
base.json- Common settingsnextjs.json- Next.js-specific settingsreact-library.json- React library settings
pnpm Workspaces
The monorepo uses pnpm workspaces for efficient dependency management.Workspace Configuration
Dependency Management
Installing Dependencies:workspace:*:
- Deduplication of shared dependencies
- Consistent versions across packages
- Faster installs with content-addressable storage
- Automatic symlinks between workspace packages
Turborepo Task Orchestration
Turborepo orchestrates build tasks across the monorepo with intelligent caching and parallelization.Task Pipeline
Task Execution
Task Dependencies
The^ prefix in dependsOn means “run this task on dependencies first”:
@workspace/ui is built before apps/www during the build process.
Environment Variables
Turborepo explicitly declares environment variables required for each task:- build: Requires
DATABASE_URLand optionalGITHUB_TOKEN - lint: Can use
GITHUB_TOKENfor extended checks - dev: No special environment requirements
Caching Strategy
Turborepo caches task outputs for faster subsequent runs:- build: Caches
.next/**except.next/cache/** - lint: Caches lint results
- dev: Never cached (persistent task)
- Task inputs (source files, dependencies)
- Environment variables declared in
env .env*files for build task
Root Package Configuration
- Enforces Node.js >= 20
- Pins pnpm version to 10.4.1
- All scripts delegate to Turborepo
- Prettier for code formatting
Development Workflow
Initial Setup
Adding a New Package
Running Tasks
Benefits of This Structure
Code Reuse
Shared UI components and configurations reduce duplication
Consistent Tooling
Unified linting, formatting, and type-checking rules
Efficient Builds
Turborepo caching speeds up repeated builds by 10x or more
Scalability
Easy to add new apps and packages as the project grows
Type Safety
Shared TypeScript configs ensure consistent typing
Developer Experience
Fast hot reload, incremental builds, and clear error messages
Common Commands Reference
| Command | Description |
|---|---|
pnpm install | Install all dependencies |
pnpm dev | Start all apps in dev mode |
pnpm build | Build all packages/apps |
pnpm lint | Lint all packages/apps |
pnpm format | Format code with Prettier |
pnpm --filter www dev | Start only the www app |
turbo run build --force | Build without cache |
turbo run build --dry | Show what would be built |
Troubleshooting
Module not found errors
Module not found errors
Run
pnpm install at the root to ensure all workspace links are created.Turborepo cache issues
Turborepo cache issues
Clear the Turbo cache and rebuild:
TypeScript errors in @workspace/ui
TypeScript errors in @workspace/ui
Ensure
transpilePackages is configured in next.config.ts:Next Steps
Architecture Overview
Understand the high-level system architecture
Tech Stack
Explore the complete technology stack