- Rename eslint-config → core-eslint, typescript-config → core-typescript in all docs (package map, AGENTS.md, overview.md, dependency-flow.md, etc.) - Document the five-tag model (app, feature, core, core-composition, tooling) — refinement of ADR-006's three-tag mention - Document core-trpc's core-composition tag (transitively reaches features through core-api's AppRouter type) - Note Turborepo boundaries as a second enforcement layer alongside ESLint - Add ADR-010 explaining the two-layer enforcement decision and five-tag refinement Files updated: - docs/architecture/overview.md: package map, enforcement layers, five-tag section - docs/architecture/dependency-flow.md: boundary rules, enforcement strategy - docs/architecture/vertical-feature-spec.md: package names, five-tag model - AGENTS.md: package map, boundary rules, commands - CLAUDE.md: tooling package names, quick-start command - packages/core-eslint/AGENTS.md: tag clarification - packages/core-typescript/AGENTS.md: tag clarification - packages/core-api/AGENTS.md: core-composition tag - packages/core-cms/AGENTS.md: core-composition tag - packages/core-trpc/AGENTS.md: core-composition tag + rationale - docs/decisions/adr-010-turbo-boundaries.md: new ADR Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
49 lines
2.3 KiB
Markdown
49 lines
2.3 KiB
Markdown
# Clean Architecture Monorepo Template
|
|
|
|
## Quick Start
|
|
|
|
```bash
|
|
pnpm install # Install all dependencies
|
|
pnpm dev # Start all dev servers
|
|
pnpm build # Build all packages
|
|
pnpm test # Run all tests
|
|
pnpm turbo boundaries # Validate workspace dependency graph
|
|
docker compose up -d # Start PostgreSQL
|
|
```
|
|
|
|
## Project Overview
|
|
|
|
Turborepo + pnpm monorepo organized by vertical features. Each feature (`auth`, `blog`, `media`, `marketing-pages`, `navigation`) owns its Clean Architecture layers. Core packages (`core-shared`, `core-cms`, `core-api`, `core-trpc`, `core-ui`) provide foundation. Two tooling packages (`core-eslint`, `core-typescript`) provide shared configs. Workspace boundaries are enforced by ESLint (lint-time) and Turborepo (build-graph time). Supports Next.js and TanStack Start as frontend frameworks, Payload CMS for content management, and comprehensive agent-optimized documentation.
|
|
|
|
## Read First
|
|
|
|
- `AGENTS.md` — Package map, boundary rules, per-package conventions
|
|
- `docs/architecture/overview.md` — High-level architecture and package responsibilities
|
|
- `docs/architecture/vertical-feature-spec.md` — Design spec with rationale and decision log
|
|
- `docs/guides/adding-a-feature.md` — End-to-end new feature walkthrough
|
|
|
|
## Key Conventions
|
|
|
|
- **Relative imports in `src/`** — Source files use relative paths (`../repositories/...`), not `@/` alias
|
|
- **`@/` alias in tests** — Test files (`*.test.ts`) use `@/` to import from `src/`
|
|
- **`vitest.config.ts`** — Every package must define `resolve.alias: { "@": path.resolve(__dirname, "./src") }`
|
|
- **`tsconfig.json` rootDir** — Set `"rootDir": "."` so TypeScript finds both `src/` and test files
|
|
- **Payload repositories via constructor** — Feature packages receive Payload config at constructor time, not as a direct dependency
|
|
- **App bootstrap** — Each app calls `bindProduction*()` per feature at startup to wire Payload into InversifyJS containers
|
|
|
|
## MCP Servers
|
|
|
|
Start Storybook before UI work: `pnpm dev --filter @repo/storybook`
|
|
|
|
Storybook MCP available at `http://localhost:6006/mcp` — use `list-all-documentation` to discover existing components before creating new ones.
|
|
|
|
## Key Ports
|
|
|
|
| Service | Port |
|
|
|---|---|
|
|
| Next.js | 3000 |
|
|
| Payload CMS | 3001 |
|
|
| TanStack Start | 3002 |
|
|
| PostgreSQL | 5432 |
|
|
| Storybook | 6006 |
|