Backend Guide
The backend is optional and designed to be added without disrupting frontend-first workflows.
Architecture Boundaries
The backend follows clean architecture:
- API layer: HTTP transport, middleware, endpoint wiring
- Core layer: domain entities, contracts, and business rules
- Infrastructure layer: database and external service implementations
- Test layer: behavior verification
This separation keeps domain logic portable and easier to test.
Request Lifecycle
- Request arrives at API endpoint
- Middleware applies shared concerns (errors, telemetry, policy)
- Domain logic runs through core contracts
- Infrastructure persists or fetches data
- Response is returned in a consistent envelope
Error and Health Conventions
- Domain exceptions map to meaningful HTTP status codes
- Unexpected exceptions are logged and returned as safe responses
- Readiness and liveness endpoints are available for orchestration
Local Development
Use the app host for full-stack local orchestration (database, API, frontend, and dashboard).
Use backend-only execution for focused API iteration.
Build and Test
cd backend
dotnet build
dotnet test
Adding New Features
Keep new features aligned to layer boundaries:
- Define domain models/contracts in core
- Implement persistence/integration in infrastructure
- Expose behavior through API endpoints
- Add tests for behavior and error cases