No description
  • C# 46.2%
  • CSS 27%
  • HTML 9.8%
  • Python 9.2%
  • Dockerfile 4.8%
  • Other 3%
Find a file Use this template
Repository files (latest commit first)
Filename Latest commit message Latest commit date
coding-agent 041cda9c50
Some checks failed
Build / build (push) Failing after 1m14s
Build / docker (push) Has been skipped
Phase 4: Documentation & template polish
- Rewrite README.md with badges, architecture overview, full getting started
- Add docs/architecture.md with request lifecycle and test strategy
- Add CONTRIBUTING.md with contribution guidelines
- Update AGENTS.md with Phase 3-4 context (health checks, OTel, etc.)
- Add OTEL_EXPORTER_OTLP_ENDPOINT to .env.example
2026-07-03 09:27:39 +00:00
.forgejo Phase 3: Architektur, Observability & CI 2026-07-03 09:14:03 +00:00
docs Phase 4: Documentation & template polish 2026-07-03 09:27:39 +00:00
nginx fix: use $http_host for X-Forwarded-Host to preserve port 2026-07-02 11:18:45 +00:00
src Phase 3: Architektur, Observability & CI 2026-07-03 09:14:03 +00:00
tests Phase 2: Tests, FluentValidation, and code quality improvements 2026-07-03 09:09:59 +00:00
.dockerignore feat: Initialize project structure and implement core functionality 2026-05-21 14:30:28 +02:00
.env.example Phase 4: Documentation & template polish 2026-07-03 09:27:39 +00:00
.gitignore feat: Directory.Build.props, EF Core DataStoring, Workflows, Domain Tests 2026-05-21 15:10:42 +02:00
.repomixignore feat: Directory.Build.props, EF Core DataStoring, Workflows, Domain Tests 2026-05-21 15:10:42 +02:00
AGENTS.md Phase 4: Documentation & template polish 2026-07-03 09:27:39 +00:00
CONTRIBUTING.md Phase 4: Documentation & template polish 2026-07-03 09:27:39 +00:00
Directory.Build.props feat: Directory.Build.props, EF Core DataStoring, Workflows, Domain Tests 2026-05-21 15:10:42 +02:00
docker-compose.yaml feat: add production environment configuration to .env.example and docker-compose.yaml 2026-07-02 10:41:34 +02:00
LICENSE Initial commit 2026-05-21 12:15:13 +00:00
ProjectName.sln Phase 2: Tests, FluentValidation, and code quality improvements 2026-07-03 09:09:59 +00:00
README.md Phase 4: Documentation & template polish 2026-07-03 09:27:39 +00:00
repomix.config.json feat: Directory.Build.props, EF Core DataStoring, Workflows, Domain Tests 2026-05-21 15:10:42 +02:00

dotnet-webapp-template

A production-grade layered .NET 10 template with clean architecture, full test coverage, and modern DevOps.

.NET 10.0
Database PostgreSQL (EF Core)
API Style Minimal APIs
UI Blazor Server
Auth JWT Bearer (API) + OIDC (UI) — optional
Observability OpenTelemetry (traces + metrics)
CI Forgejo Actions

Architecture

src/
├── CrossCutting/
│   └── DataClasses/                       # POCOs, DTOs, Result<T>
├── Logic/
│   ├── Domain/
│   │   ├── PlaceholderManagement/         # Domain logic (Managers)
│   │   └── PlaceholderManagement.Contract/
│   └── Business/
│       ├── PlaceholderWorkflows/          # Process orchestration
│       └── PlaceholderWorkflows.Contract/
├── Infrastructure/
│   └── DiMappings/                        # Centralized DI registration
├── Data/
│   ├── DataStoring/                       # EF Core DbContext + Repositories
│   └── DataStoring.Contract/
└── UI/
    ├── ServiceClient/                     # Minimal API (backend)
    └── WebClient/                         # Blazor Server (frontend)
Layer Purpose
DataClasses POCOs, DTOs — no logic, no dependencies
Domain (Contract + Impl) Business logic, domain state (Managers)
Business (Contract + Impl) Process orchestration (Workflows)
Infrastructure DI wiring, cross-cutting concerns
Data (Contract + Impl) EF Core persistence (Repositories)
UI — ServiceClient Minimal API with health checks, versioning, OpenTelemetry
UI — WebClient Blazor Server with OIDC auth

Key Patterns

  • Result<T> — all domain operations return success/failure (no exceptions for control flow)
  • Contracts/Implementation separation — every layer depends on abstractions
  • Repository pattern with explicit SaveChangesAsync (Unit of Work)
  • FluentValidation — request validation via validators
  • Global exception handling — structured error responses via IExceptionHandler

Prerequisites

  • .NET 10.0 SDK
  • PostgreSQL (via docker compose up -d or local install)
  • Node.js 22+ (for WebClient Tailwind CSS)

Quick Start

# 1. Clone and restore
git clone <repo-url> && cd dotnet-webapp-template
dotnet restore

# 2. Set up environment
cp .env.example .env    # edit as needed

# 3. Start infrastructure
docker compose up -d

# 4. Build and test
dotnet build
dotnet test

# 5. Run
dotnet run --project src/UI/ServiceClient
dotnet run --project src/UI/WebClient

# Or via Docker:
docker compose up

Development

Tests

dotnet test                         # build + run all tests
dotnet test tests/PlaceholderManagement.Tests/
dotnet test tests/PlaceholderWorkflows.Tests/
dotnet test tests/ServiceClient.Tests/

WebClient Tailwind CSS

cd src/UI/WebClient
npm ci
npm run build:css        # manual build
# Or let MSBuild do it automatically during dotnet build

Configuration

All configuration is in appsettings.json / environment variables. See .env.example for all options.

API Endpoints (ServiceClient)

Method Path Description
GET /health/live Liveness check
GET /health/ready Readiness check (DB)
GET /api/placeholder-items List all items
POST /api/placeholder-items Create item
GET /api/placeholder-items/{id} Get by ID
PUT /api/placeholder-items/{id} Update item
DELETE /api/placeholder-items/{id} Delete item

API versioning via ApiVersion query parameter (default: 1.0).

Renaming the Template

# Replace in all files:
#   RepoOwner     → your org/user
#   ProjectName   → your project name
#   Placeholder*  → your domain concepts
#   ProjectName.sln → your solution name

Documentation

File Content
docs/dotnet-coding-guide.md Coding conventions, Pattern Catalogue, architecture rules
docs/auth.md JWT + OIDC setup guides (Auth0, Azure AD, Keycloak)
docs/architecture.md Detailed architecture overview
AGENTS.md AI agent reference (opencode / cursor)

CI/CD (Forgejo Actions)

  • build.yaml — Restore → npm ci → Build → Test (+ coverage) → Publish → Docker
  • ai-review.yaml — Automatic AI code review on PRs (OpenAI-compatible API)

License

Apache License 2.0