claude-test/CLAUDE.md
Martin Švrčina 01feed4703 Update CLAUDE.md to reflect current project state
- Add NSwag client generation details and usage convention
- Add TypeScript, Pinia, Axios to frontend stack
- Change project structure from 'planned' to actual
- Document BaseModel and AppDbContext conventions
- Mark JWT/FluentValidation as planned (not yet implemented)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-17 00:43:24 +01:00

65 lines
2.7 KiB
Markdown

# claude-test
A Facebook Events replacement webapp for a private friend group.
## Stack
- **Backend:** .NET 8 Web API, Clean Architecture, EF Core 8 + Pomelo.EntityFrameworkCore.MySql, NSwag, JWT auth (planned)
- **Database:** MySQL
- **Frontend:** Vue 3 (Vite), Vuetify 3, TypeScript, Pinia, Axios
- **API client:** Auto-generated TypeScript client via NSwag on every backend build
- **Version control:** Gitea at https://git.svrcina.eu/martin/claude-test.git
## Project Structure
```
claude-test/
├── ClaudeTest.sln
├── backend/
│ ├── ClaudeTest.API/ # Controllers, middleware, DI config, nswag.json
│ ├── ClaudeTest.Application/ # Services, DTOs, validators (FluentValidation)
│ ├── ClaudeTest.Domain/ # Entities, domain interfaces
│ │ └── Common/BaseModel.cs # Base entity: Id, Created, Updated, Deleted
│ └── ClaudeTest.Infrastructure/ # EF Core, AppDbContext, repositories
│ └── Persistence/AppDbContext.cs
└── frontend/ # Vue 3 + Vuetify 3 app
└── src/api/apiClient.ts # Auto-generated by NSwag (gitignored)
```
## Conventions
- REST API with consistent JSON responses and HTTP status codes
- EF Core code-first migrations (never edit migrations manually)
- All entities inherit from `BaseModel` (Id, Created, Updated, Deleted)
- `AppDbContext` sets `Created`/`Updated` automatically via `ChangeTracker`
- All timestamps stored as UTC (`DateTime.UtcNow`)
- DTOs for all API input/output (never expose domain entities directly)
- FluentValidation for all request validation
- Async/await throughout the backend
- Vue 3 Composition API (`<script setup>`) only — no Options API
- Pinia for frontend state management
- Never call API directly from Vue components — always use the generated `apiClient.ts`
## NSwag API Client Generation
NSwag runs automatically as a post-build step on `ClaudeTest.API`.
- Config: `backend/ClaudeTest.API/nswag.json`
- Output: `frontend/src/api/apiClient.ts` (gitignored, regenerated on each build)
- Template: Axios — generates one typed client class per controller
- Uses `$(NSwagExe_Net80)` in the MSBuild target (required for .NET 8)
## Deployment
- **Development:** run natively — .NET CLI, `vite dev`, local MySQL
- **Production/testing:** Docker Compose with 3 containers:
- `api` — .NET 8 Web API
- `frontend` — nginx serving built Vue app
- `db` — MySQL
- **Server:** same machine as Gitea (already running Docker)
- **Reverse proxy:** nginx running on the host, proxying to Docker containers
## Development Approach
This project is also a learning experience for working effectively with Claude.
When starting a new feature, use `/plan` to align on approach before writing code.