|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Repository Structure |
| 6 | + |
| 7 | +This is a **multi-project repository** containing .NET project templates and supporting infrastructure: |
| 8 | + |
| 9 | +### Main Projects |
| 10 | +- **TimeWarp.Architecture/** - Complete distributed microservices architecture template |
| 11 | +- **TimeWarp.Console/** - Console application template |
| 12 | +- **TimeWarp.Templates/** - Template packaging and documentation |
| 13 | + |
| 14 | +## Development Commands |
| 15 | + |
| 16 | +### TimeWarp.Architecture (Main Template) |
| 17 | +Navigate to `TimeWarp.Architecture/` directory first: |
| 18 | + |
| 19 | +**Running Applications:** |
| 20 | +- `./Run.ps1` - Runs the Aspire orchestrator (Development environment) |
| 21 | +- `./RunDocker.ps1` - Run using Docker containers |
| 22 | +- `./RunTailwind.ps1` - Build Tailwind CSS for Web.Spa |
| 23 | + |
| 24 | +**Testing:** |
| 25 | +- `./RunTests.ps1` - Runs all test suites using Fixie framework |
| 26 | +- `dotnet fixie Tests/[ProjectName]` - Run specific test project |
| 27 | +- `dotnet fixie Tests/[ProjectName] --tests [ClassName]` - Run specific test class |
| 28 | +- `dotnet fixie Tests/[ProjectName] --tests [ClassName.MethodName]` - Run specific test method |
| 29 | +- `dotnet test Tests/EndToEnd.Playwright.Tests` - Run Playwright E2E tests |
| 30 | + |
| 31 | +**Frontend Development (Web.Spa):** |
| 32 | +- `npm run css:build` - Build Tailwind CSS |
| 33 | +- `npm run tailwind-watch` - Watch and rebuild CSS changes |
| 34 | +- `npm run build` - Build TypeScript |
| 35 | +- `npm run lint` - Lint TypeScript files |
| 36 | +- `npm run prettier` - Format code |
| 37 | + |
| 38 | +### Template Management |
| 39 | +- `dotnet new --install TimeWarp.Architecture` - Install the architecture template |
| 40 | +- `dotnet new timewarp-architecture -n MyApp` - Create new project from template |
| 41 | + |
| 42 | +## Architecture Overview |
| 43 | + |
| 44 | +### TimeWarp.Architecture Template |
| 45 | +A **distributed microservices architecture** demonstrating enterprise .NET patterns: |
| 46 | + |
| 47 | +**Core Technologies:** |
| 48 | +- **.NET 9** with C# latest features |
| 49 | +- **Blazor WebAssembly/Server** with TimeWarp State management |
| 50 | +- **MediatR** for CQRS patterns ("Object In, Object Out") |
| 51 | +- **FastEndpoints** for minimal APIs (instead of controllers) |
| 52 | +- **Fixie** testing framework (NOT MSTest/xUnit) |
| 53 | +- **.NET Aspire** for service orchestration |
| 54 | +- **Entity Framework Core** with multiple database providers |
| 55 | +- **FluentUI + Tailwind CSS** for styling |
| 56 | + |
| 57 | +**Key Patterns:** |
| 58 | +- **Endpoint-Centric Design**: Each API endpoint has dedicated request/response DTOs |
| 59 | +- **Mixin System**: Code reuse through `.mixin` files in `Common.Contracts/Mixins/` |
| 60 | +- **Source Generation**: Custom Roslyn analyzers create FastEndpoint implementations |
| 61 | +- **AssemblyMarker Pattern**: Each assembly has sealed `AssemblyMarker` class |
| 62 | + |
| 63 | +### Container Applications Structure |
| 64 | +``` |
| 65 | +ContainerApps/ |
| 66 | +├── Web/ # Blazor client + server |
| 67 | +├── Api/ # Dedicated API service |
| 68 | +├── Grpc/ # gRPC service |
| 69 | +├── Aspire/ # Service orchestration |
| 70 | +└── Yarp/ # API Gateway/Reverse Proxy |
| 71 | +``` |
| 72 | + |
| 73 | +## Feature Development Guidelines |
| 74 | + |
| 75 | +### API Contract Structure |
| 76 | +- **Location**: `Features/[PluralizedFeatureName]/` |
| 77 | +- **Commands**: Write operations (Create, Update, Delete) |
| 78 | +- **Queries**: Read operations (prefixed with "Get") |
| 79 | +- **Validation**: FluentValidation with shared mixins |
| 80 | + |
| 81 | +### UI Development (FluentUI + Tailwind) |
| 82 | +- **Layout**: Use `TimeWarpPage` with FluentUI `Stack`/`Grid` |
| 83 | +- **Colors**: FluentUI palette only (automatic light/dark theme support) |
| 84 | +- **Tailwind**: Limited to spacing (`m-*`, `p-*`), hover effects, responsiveness |
| 85 | +- **Avoid**: Tailwind colors, typography, borders that conflict with FluentUI |
| 86 | + |
| 87 | +## Task Management Workflow |
| 88 | + |
| 89 | +Uses **Kanban folder-based system** in `Kanban/` directory: |
| 90 | + |
| 91 | +### Workflow Structure |
| 92 | +- `Backlog/` - Tasks not ready (B### prefix) |
| 93 | +- `ToDo/` - Ready tasks (### prefix) |
| 94 | +- `InProgress/` - Active development |
| 95 | +- `Done/` - Completed tasks |
| 96 | + |
| 97 | +### Definition of Done |
| 98 | +**API Endpoints:** |
| 99 | +- Server: Endpoint, Handler, Validator, Mapper |
| 100 | +- Contracts: Request, Response, RequestValidator |
| 101 | +- Integration tests for Handler and Endpoint |
| 102 | + |
| 103 | +**Client Features:** |
| 104 | +- State, Actions, Components/Pages |
| 105 | +- Integration tests (ShouldClone, ShouldSerialize) |
| 106 | +- Action tests and E2E tests |
| 107 | + |
| 108 | +## Testing Framework |
| 109 | + |
| 110 | +**Primary Framework**: Fixie (not MSTest/xUnit) |
| 111 | + |
| 112 | +### Test Organization |
| 113 | +``` |
| 114 | +Tests/ |
| 115 | +├── Analyzers/ # Source generator tests |
| 116 | +├── Common/ # Shared library tests |
| 117 | +├── ContainerApps/ # Microservice tests |
| 118 | +├── EndToEnd.Playwright.Tests/ # E2E browser tests |
| 119 | +├── Libraries/ # Custom library tests |
| 120 | +└── Web.*.Integration.Tests/ # Integration tests |
| 121 | +``` |
| 122 | + |
| 123 | +### Test Commands |
| 124 | +- End-to-end tests use `dotnet test` (Playwright) |
| 125 | +- All other tests use `dotnet fixie` (Fixie framework) |
| 126 | +- Filter by tags: `dotnet fixie -- --Tag Fast --Tag Smoke` |
| 127 | + |
| 128 | +## Important Development Notes |
| 129 | + |
| 130 | +- **Namespace**: All projects use `TimeWarp.Architecture` as root namespace |
| 131 | +- **Nullable Reference Types**: Disabled by design choice |
| 132 | +- **Generated Code**: Excluded via `Directory.Build.targets` |
| 133 | +- **Feature Flags**: Via preprocessor directives (`cosmosdb`, `api`, `grpc`, `web`, `yarp`) |
| 134 | +- **State Management**: TimeWarp patterns with Redux DevTools integration |
| 135 | +- **Assembly Markers**: Each assembly must contain sealed `AssemblyMarker` class |
| 136 | + |
| 137 | +## Documentation |
| 138 | + |
| 139 | +Comprehensive documentation available in: |
| 140 | +- `TimeWarp.Architecture/Documentation/` - Architecture and development guides |
| 141 | +- Online docs: https://timewarpengineering.github.io/timewarp-architecture/ |
0 commit comments