minimal-api-patterns

star 2

ASP.NET Core Minimal APIs patterns for endpoints, DTOs, validation, and service integration. Use when implementing API endpoints, defining request/response contracts, or structuring API projects with clean separation of concerns.

michaellperry By michaellperry schedule Updated 1/11/2026

name: minimal-api-patterns description: ASP.NET Core Minimal APIs patterns for endpoints, DTOs, validation, and service integration. Use when implementing API endpoints, defining request/response contracts, or structuring API projects with clean separation of concerns.

ASP.NET Core Minimal API Patterns

Use when adding or adjusting Minimal API endpoints, DTOs, validation, or OpenAPI metadata in GloboTicket.

When to use

  • Defining or updating endpoint groups in src/GloboTicket.API/Endpoints
  • Creating/maintaining request/response DTOs and validators in GloboTicket.Application
  • Wiring services into handlers (no repositories in endpoints)
  • Enforcing auth/authorization per group or route and documenting responses

Core principles

  • Group related routes with MapGroup, shared auth, tags, and OpenAPI
  • Return DTOs only; validate inputs with FluentValidation before executing handlers
  • Inject application services into handlers; keep domain/data access out of endpoints
  • Centralize error handling via filters; standardize validation/problem responses
  • Apply policies/roles per route; name/describe endpoints for Swagger
  • Cache read endpoints where safe; prefer async + cancellation tokens

Resources

Default locations

  • Endpoint groups: src/GloboTicket.API/Endpoints
  • DTOs/validators: src/GloboTicket.Application/DTOs and Validators
  • Services: src/GloboTicket.Application/Services
  • Filters/middleware: src/GloboTicket.API (filters or middleware folder)

Validation checklist

  • Endpoint groups require auth and are tagged/named
  • DTOs returned instead of domain entities; validators applied in handlers
  • Handlers inject services (no repositories); tenant/context checks live in services
  • Error/validation filters registered on groups or globally
  • Swagger metadata set (names, summaries, Produces/Accepts)
  • Read endpoints use caching when appropriate; async handlers accept CancellationToken
Install via CLI
npx skills add https://github.com/michaellperry/aaad --skill minimal-api-patterns
Repository Details
star Stars 2
call_split Forks 0
navigation Branch main
article Path SKILL.md
More from Creator
michaellperry
michaellperry Explore all skills →