A production-ready .NET 8 Minimal API starter with clean architecture, dual pagination, global error handling, and a fully extensible repository layer — ready to run in one command.
One-time payment · Unlimited projects · Lifetime access
What's included
BaseRepository with 7 overridable hooks for validation and mapping. Add a new resource in minutes without touching the core CRUD logic.
No exceptions for control flow. Every operation returns ErrorOr<T> — errors propagate cleanly through the entire stack from the database up to the HTTP response.
List endpoints return a lightweight SummaryResponse. Single-item endpoints return the full DetailResponse. Smaller payloads, cleaner contracts.
Offset pagination for back-office UIs with page numbers. Cursor pagination for feeds and large collections — O(log n) via MongoDB _id index, consistent under concurrent writes.
Every unhandled exception is caught and converted to an RFC 7807 ProblemDetails JSON response with trace ID. No stack traces leaked to the client.
API and MongoDB spin up together with one command. Health-check-gated startup — the API waits for MongoDB to be ready. No race conditions, no manual setup.
Liveness probe at /health/live and readiness probe at /health/ready (checks MongoDB). Drop-in for Kubernetes or any load balancer.
Every endpoint, model, error, and parameter is documented with XML comments wired into Swagger UI automatically. Open /swagger and everything is already there.
The hook system
BaseRepository handles all CRUD logic.
You override the hooks that matter for your domain — everything else runs automatically.
Each hook returns ErrorOr<T> so any failure aborts the operation cleanly before the database is touched.
OnValidateCreateAsync — uniqueness, ranges, business rulesOnMapCreateAsync — server-side fields: slugs, tenant IDsOnMapToDetailAsync — build the full single-item responseOnMapToSummaryAsync — build the lightweight list responseOnValidateUpdateAsync — validate the fully merged entityOnMapUpdateAsync — recompute derived fields on updateOnValidateDeleteAsync — guard against invalid deletionsprotected override Task<ErrorOr<Product>> OnMapCreateAsync( ProductCreateRequest request, Product entity, CancellationToken ct) { // Slug is server-side — never from the client entity.Slug = ToSlug(request.Name); return Task.FromResult<ErrorOr<Product>>(entity); } protected override Task<ErrorOr<ProductDetailResponse>> OnMapToDetailAsync( Product entity, CancellationToken ct) { var response = ProductDetailResponse.From(entity); // Computed at response time — never stored in DB response.FormattedPrice = $"€{entity.Price:F2}"; return Task.FromResult<ErrorOr<ProductDetailResponse>>(response); }
Pagination
Classic page 1, 2, 3 navigation. Returns totalCount, totalPages, hasNext, hasPrev. Ideal for back-office UIs and small-to-medium collections.
O(log n) performance via MongoDB _id index. Consistent results even under concurrent writes. No degradation as your collection grows.
Pricing
NET 8 Minimal API Starter Kit
€35
One-time payment. No subscription. Yours forever.
Secure checkout via Lemon Squeezy · Instant delivery by email
FAQ
No — by design. Auth requirements vary too much across projects (JWT, API keys, OAuth, Keycloak). The kit gives you a clean, production-ready foundation and you add the auth layer that fits your project.
Unlimited. One purchase covers you for as many projects as you want, for your entire team, forever.
The kit targets .NET 8. It uses Minimal API features introduced in .NET 7 and refined in .NET 8 — it will not run on older versions without changes.
No. Docker is included for convenience but the project runs fine with a local MongoDB instance — just configure the connection string in appsettings.json.
A .zip file with the complete source code, delivered instantly to your email. Unzip, copy .env.example to .env, run docker compose up --build and you're running in under a minute.