Product sample · .NET

Northwind API

A typed minimal API in C# .NET 8: customers and orders with pagination, validation, RFC 7807 problem details and an OpenAPI document, tested with xUnit and run through Docker when the local SDK is missing.

.NET 8runtime
C#language
xUnittests
OpenAPIcontract
live demo
Northwind API
The problem

A small API that behaves like a real one.

Sample APIs often skip the parts that make an API usable: consistent errors, bounded pagination, a contract, and tests for validation instead of only the happy path.

Northwind API is deliberately small but complete: typed records in, typed records out, problem details on failure, and a test suite that checks both.

What we built

Types, validation, and a contract.

  • Minimal API endpoints for customers and orders with typed request and response records.
  • Pagination and sorting with bounded page sizes, so a client cannot ask for everything.
  • RFC 7807 problem details for validation and not-found responses.
  • An in-memory repository with deterministic seed data.
  • OpenAPI document generated from the endpoints, plus a static explorer demo.
Architecture

How it is put together

src/Northwind.Api/
 ├─ Program.cs (minimal API setup)
 ├─ Endpoints/ (customers, orders)
 ├─ Domain/ (records, validation)
 └─ Data/ (in-memory repository with seed)
src/Northwind.Tests/ xUnit tests for handlers and validation
scripts/test.sh runs dotnet test, with a Docker fallback

Stack

.NET 8C#Minimal APIxUnit

Security and money

  • Endpoints return typed records, so the OpenAPI document and the tests describe the same shapes.
  • Validation produces problem details with a field pointer, not a generic 400.
  • Page size is capped, and the cap is tested, not just documented.
  • The Docker fallback in scripts/test.sh keeps the test command identical on a machine without the SDK.
Screens

Product surfaces

Northwind API, the working demo
Northwind API, the working demo
Similar work

Building something in this category?

We can walk you through the architecture, the payment integration and the failure cases on a call, including the parts that were hard.