An ASP.NET Core 10 minimal API CRUD starter in C# that stores one resource, items, in PostgreSQL through Npgsql 10 and one pooled NpgsqlDataSource. It is for .NET developers who want an endpoint group, a repository with plain SQL, validation, JSON errors, a database health check, an OpenAPI document and xUnit tests.
by Light CloudCRUD APIs
Program.cs does the wiring on one screen: Kestrel listens on the port in PORT, JSON uses a snake_case naming policy, AddDatabase registers DatabaseOptions and a pool capped at 5 connections, and two Map...Endpoints calls add the routes. Settings come through ASP.NET Core configuration, so the DB_* values can be environment variables or entries in appsettings.json, and an empty value counts as unset. It serves plain HTTP with no HTTPS redirect, since TLS ends at the proxy in front of it. The current tests cover the models rather than the HTTP routes, so a WebApplicationFactory integration test is a sensible early addition. On Light Cloud CrudApi.csproj is built and run as a container on PORT with the database variables set, and every push to your copy redeploys.
This template serves the OpenAPI document at /openapi/v1.json but no UI. Add a package such as Scalar.AspNetCore and map it in Program.cs next to app.MapOpenApi().
Add a model in Models/, a repository in Data/ modelled on ItemRepository.cs with its own CREATE TABLE, and an Endpoints/ file with a Map...Endpoints method. Register the repository and call the map method in Program.cs.
Each query is a few lines of SQL, which keeps the starter small and shows exactly what runs against the database. You can add EF Core with the Npgsql provider later; the endpoints only talk to ItemRepository.
Start PostgreSQL in Docker with docker run -d --name items-db -p 5432:5432 -e POSTGRES_PASSWORD=postgres postgres:16, copy .env.example to .env, which sets DB_SSLMODE=disable, and load it with set -a && . ./.env && set +a before dotnet run.
Yes. Publish with dotnet publish CrudApi.csproj -c Release -o out and run dotnet out/CrudApi.dll with PORT and the DB_* variables set, on any host with the ASP.NET Core 10 runtime and a PostgreSQL database. The repo has no Dockerfile, so add one if your host needs an image.
Start a C# minimal API on .NET 8 with settings, CORS, health check and Docker set up

Start a Java CRUD API on PostgreSQL with Spring Boot, Swagger UI and Bean Validation
Start a Go CRUD API on PostgreSQL with Gin, pgx, input validation and route tests