Fake Survey Generator - Project Foundation
Project Overview
Fake Survey Generator is a modern distributed application built with .NET 10.0 and Aspire orchestration. It demonstrates a microservice architecture with a React frontend, multiple backend services, and enterprise infrastructure patterns (Dapr, SQL Server, Redis, Azure deployment).
Architecture Overview
Frontend
- Framework: React 19 + Vite + TypeScript
- Location:
src/client/ui/
- Authentication: Auth0
- Styling: Tailwind CSS 4.1
- Build:
npm run build (TypeScript checking + Vite bundling)
- Dev Server: Runs on port 3000 (managed by Aspire)
Backend Services
Supporting Services
Aspire Orchestration
Resource Dependencies (from AppHost.cs)
sql-server (base)
↓
cache (base)
↓
api (depends on sql-server + cache)
↓
worker (depends on sql-server + cache)
↓
ui (depends on api)
All resources use WaitFor() to ensure dependency chain completion before starting.
Running Aspire
aspire run
This starts all resources in order and makes them available via:
Project Structure
Backend Solution
- FakeSurveyGenerator.Api - Main REST API service
- FakeSurveyGenerator.Worker - Background worker service
- FakeSurveyGenerator.Application - Business logic & application services
- FakeSurveyGenerator.ServiceDefaults - Aspire service configuration defaults
- FakeSurveyGenerator.Proxy - Proxy service for UI/API communication
- FakeSurveyGenerator.AppHost - Aspire orchestration & resource definitions
Test Projects
FakeSurveyGenerator.Application.Tests - Unit tests for business logic (TUnit)
- Uses: AutoFixture, NSubstitute (mocking), InMemory EF Core
FakeSurveyGenerator.Api.Tests.Integration - Integration tests (TUnit)
- Uses: Testcontainers (real SQL Server & Redis), Respawn (DB cleanup), AutoFixture
FakeSurveyGenerator.Acceptance.Tests - E2E tests (TUnit + Playwright)
- Uses: Aspire Hosting Testing library, Playwright for .NET, TUnit.Playwright
TestTests - Utility test project
All tests use TrxReport for result reporting and CodeCoverage analysis.
Build System
.NET Backend
- Target Framework: net10.0
- Package Management: Centralized in
Directory.Packages.props
- Version Management: Nerdbank.GitVersioning
- Key Dependencies:
- Aspire 13.1.0 (hosting, testing)
- EF Core 10.0
- AutoMapper
- MediatR
- FluentValidation
Frontend (Node.js)
- Build Tool: Vite
- Scripts:
npm run dev - Dev server with hot reload
npm run build - Production build (TypeScript check + Vite bundle)
npm run lint - Biome formatter
- Key Dependencies: React 19, Auth0 SDK, FontAwesome, Tailwind CSS 4.1
Build Commands
Backend (from repository root)
# Build all backend projects
dotnet build
# Run all tests with coverage
dotnet test
# Run specific test project
dotnet test src/server/FakeSurveyGenerator.Application.Tests/
dotnet test src/server/FakeSurveyGenerator.Api.Tests.Integration/
Frontend (from src/client/ui/)
# Install dependencies
npm install
# Development server
npm run dev
# Production build
npm run build
# Lint/format
npm run lint
Dapr Integration
Development Setup
- Secret Store: Local file-based (
dapr/components/local-file.yml)
- Configuration:
dapr/components/secrets.json
- Sidecar: Auto-managed by Aspire on API service
Production Setup
- Secret Store: Azure Key Vault
- Configuration: Via bicep deployments in
infra/ folder
Key Patterns & Conventions
API Endpoints
- User Registration:
POST /api/users/register (Auth0 token required)
- Survey Creation:
POST /api/surveys (creates survey for current user)
- Survey Retrieval:
GET /api/surveys/{id} (retrieve specific survey)
- Survey List:
GET /api/surveys (list all surveys for current user)
- Health Checks:
GET /health/live, GET /health/ready
Database & ORM
- ORM: Entity Framework Core 10.0 (code-first)
- Migrations: Managed via EF Core tooling
- Strategy: Application layer abstracts data access via repositories
Testing Patterns
- Unit Tests: Async/await patterns, arrange-act-assert structure
- Integration Tests: Real database/cache via Testcontainers, Respawn for cleanup
- Acceptance Tests: Aspire orchestration + Playwright for UI interaction
Common Development Tasks
Adding a New API Endpoint
- Create DTO/Command in Application layer
- Create handler in Application layer
- Register in Application DI setup
- Create controller action in Api project
- Add unit tests in Application.Tests
- Add integration tests in Api.Tests.Integration
Modifying Frontend Component
- Update React component in
src/client/ui/src/
- Run
npm run build to validate TypeScript
- Add UI assertions to E2E skill validation
Adding Feature End-to-End
- Implement backend logic (Application + Api layers)
- Update frontend (React component)
- Create unit tests
- Create integration tests
- Create acceptance test (Playwright)
- Validate with
aspire run + UI inspection
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: fake-survey-gen-foundation3description: Foundation knowledge about the Fake Survey Generator project architecture, Aspire orchestration, service topology, and build/test infrastructure. Use this skill as reference context when working on features for this project. Use when this capability is needed.4---56# Fake Survey Generator - Project Foundation78## Project Overview910**Fake Survey Generator** is a modern distributed application built with **.NET 10.0** and **Aspire orchestration**. It demonstrates a microservice architecture with a React frontend, multiple backend services, and enterprise infrastructure patterns (Dapr, SQL Server, Redis, Azure deployment).1112## Architecture Overview1314### Frontend15- **Framework**: React 19 + Vite + TypeScript16- **Location**: `src/client/ui/`17- **Authentication**: Auth018- **Styling**: Tailwind CSS 4.119- **Build**: `npm run build` (TypeScript checking + Vite bundling)20- **Dev Server**: Runs on port 3000 (managed by Aspire)2122### Backend Services23- **Api Service** (FakeSurveyGenerator.Api)24 - Main REST API for survey operations (create, retrieve, list surveys)25 - User management endpoints26 - Admin endpoints (health checks, version info, secret retrieval)27 - Connected to: SQL Server database, Redis cache28 - Health checks: `/health/live` and `/health/ready`29 - Dapr sidecar enabled for distributed capabilities3031- **Worker Service** (FakeSurveyGenerator.Worker)32 - Background job processing service33 - Connected to: SQL Server database, Redis cache34 - Runs alongside API service3536### Supporting Services37- **SQL Server** (sql-server)38 - Persistent data volume39 - Database: "database"40 - Both API and Worker depend on it4142- **Redis Cache** (cache)43 - Cache layer for performance44 - RedisInsight UI enabled (port 6379)45 - Both API and Worker depend on it4647- **Dapr Sidecar** (on Api service)48 - Components path: `../../../dapr/components`49 - Local file-based secret store for development50 - Configurable for Azure Key Vault in production5152## Aspire Orchestration5354### Resource Dependencies (from AppHost.cs)55```56sql-server (base)57 ↓58cache (base)59 ↓60api (depends on sql-server + cache)61 ↓62worker (depends on sql-server + cache)63 ↓64ui (depends on api)65```6667All resources use WaitFor() to ensure dependency chain completion before starting.6869### Running Aspire70```bash71aspire run72```7374This starts all resources in order and makes them available via:75- Aspire Dashboard: http://localhost:1988876- SQL Server: localhost:143377- Redis: localhost:637978- API: http://localhost:17623 (internal), exposed via proxy79- UI: https://localhost:300080- RedisInsight: http://localhost:80018182## Project Structure8384### Backend Solution85- **FakeSurveyGenerator.Api** - Main REST API service86- **FakeSurveyGenerator.Worker** - Background worker service87- **FakeSurveyGenerator.Application** - Business logic & application services88- **FakeSurveyGenerator.ServiceDefaults** - Aspire service configuration defaults89- **FakeSurveyGenerator.Proxy** - Proxy service for UI/API communication90- **FakeSurveyGenerator.AppHost** - Aspire orchestration & resource definitions9192### Test Projects93- **FakeSurveyGenerator.Application.Tests** - Unit tests for business logic (TUnit)94 - Uses: AutoFixture, NSubstitute (mocking), InMemory EF Core95 96- **FakeSurveyGenerator.Api.Tests.Integration** - Integration tests (TUnit)97 - Uses: Testcontainers (real SQL Server & Redis), Respawn (DB cleanup), AutoFixture98 99- **FakeSurveyGenerator.Acceptance.Tests** - E2E tests (TUnit + Playwright)100 - Uses: Aspire Hosting Testing library, Playwright for .NET, TUnit.Playwright101 102- **TestTests** - Utility test project103104All tests use **TrxReport** for result reporting and **CodeCoverage** analysis.105106## Build System107108### .NET Backend109- **Target Framework**: net10.0110- **Package Management**: Centralized in `Directory.Packages.props`111- **Version Management**: Nerdbank.GitVersioning112- **Key Dependencies**:113 - Aspire 13.1.0 (hosting, testing)114 - EF Core 10.0115 - AutoMapper116 - MediatR117 - FluentValidation118119### Frontend (Node.js)120- **Build Tool**: Vite121- **Scripts**:122 - `npm run dev` - Dev server with hot reload123 - `npm run build` - Production build (TypeScript check + Vite bundle)124 - `npm run lint` - Biome formatter125- **Key Dependencies**: React 19, Auth0 SDK, FontAwesome, Tailwind CSS 4.1126127## Build Commands128129### Backend (from repository root)130```bash131# Build all backend projects132dotnet build133134# Run all tests with coverage135dotnet test136137# Run specific test project138dotnet test src/server/FakeSurveyGenerator.Application.Tests/139dotnet test src/server/FakeSurveyGenerator.Api.Tests.Integration/140```141142### Frontend (from src/client/ui/)143```bash144# Install dependencies145npm install146147# Development server148npm run dev149150# Production build151npm run build152153# Lint/format154npm run lint155```156157## Dapr Integration158159### Development Setup160- **Secret Store**: Local file-based (`dapr/components/local-file.yml`)161- **Configuration**: `dapr/components/secrets.json`162- **Sidecar**: Auto-managed by Aspire on API service163164### Production Setup165- **Secret Store**: Azure Key Vault166- **Configuration**: Via bicep deployments in `infra/` folder167168## Key Patterns & Conventions169170### API Endpoints171- **User Registration**: `POST /api/users/register` (Auth0 token required)172- **Survey Creation**: `POST /api/surveys` (creates survey for current user)173- **Survey Retrieval**: `GET /api/surveys/{id}` (retrieve specific survey)174- **Survey List**: `GET /api/surveys` (list all surveys for current user)175- **Health Checks**: `GET /health/live`, `GET /health/ready`176177### Database & ORM178- **ORM**: Entity Framework Core 10.0 (code-first)179- **Migrations**: Managed via EF Core tooling180- **Strategy**: Application layer abstracts data access via repositories181182### Testing Patterns183- **Unit Tests**: Async/await patterns, arrange-act-assert structure184- **Integration Tests**: Real database/cache via Testcontainers, Respawn for cleanup185- **Acceptance Tests**: Aspire orchestration + Playwright for UI interaction186187## Common Development Tasks188189### Adding a New API Endpoint1901. Create DTO/Command in Application layer1912. Create handler in Application layer1923. Register in Application DI setup1934. Create controller action in Api project1945. Add unit tests in Application.Tests1956. Add integration tests in Api.Tests.Integration196197### Modifying Frontend Component1981. Update React component in `src/client/ui/src/`1992. Run `npm run build` to validate TypeScript2003. Add UI assertions to E2E skill validation201202### Adding Feature End-to-End2031. Implement backend logic (Application + Api layers)2042. Update frontend (React component)2053. Create unit tests2064. Create integration tests2075. Create acceptance test (Playwright)2086. Validate with `aspire run` + UI inspection209210---211> Converted and distributed by [TomeVault](https://tomevault.io/claim/marcelmichau) — claim your Tome and manage your conversions.212<!-- tomevault:4.0:skill_md:2026-04-11 -->