GM.API
1.4.0
dotnet add package GM.API --version 1.4.0
NuGet\Install-Package GM.API -Version 1.4.0
<PackageReference Include="GM.API" Version="1.4.0" />
<PackageVersion Include="GM.API" Version="1.4.0" />
<PackageReference Include="GM.API" />
paket add GM.API --version 1.4.0
#r "nuget: GM.API, 1.4.0"
#:package GM.API@1.4.0
#addin nuget:?package=GM.API&version=1.4.0
#tool nuget:?package=GM.API&version=1.4.0
<p align="center"> <img src="https://raw.githubusercontent.com/gmetskhvarishvili/GM.API/master/icon.png" alt="GM.API" width="140" height="140" /> </p>
GM.API
An opinionated ASP.NET Core Web API starter for .NET. A single AddGMAPI / UseGMAPI pair wires up
controllers, CORS, API versioning, Swagger docs, FluentValidation, Serilog, and a set of middlewares
(exception handling, request logging with sensitive-data masking, and request localization). Part of
the GM.* family of packages. Targets net10.0.
Packages
This repository ships six packages that version and release in lockstep:
| Package | What it provides |
|---|---|
GM.API |
The umbrella package — AddGMAPI/UseGMAPI, base controllers, Serilog host builder. |
GM.API.Application |
GM.Mediator wiring + validation & performance pipeline behaviours, paged-list models. |
GM.API.Cors |
One-call CORS policy (AddGMCors/UseGMCors). |
GM.API.Middlewares |
Exception handling, request logging (with masking), localization middlewares. |
GM.API.Shared |
Shared primitives built on GM.Mapper. |
GM.API.Versioning |
URL-segment API versioning + API explorer. |
Install
dotnet add package GM.API
GM.API pulls in the companion packages; add the smaller ones directly if you only need a slice
(e.g. just GM.API.Middlewares).
Use
using GM.API.Startup;
var builder = ProgramExtension.CreateGMBuilder(args); // WebApplicationBuilder + Serilog + config
builder.Services.ConfigureGMServices(
builder.Configuration,
policyName: "DefaultCors",
swaggerOptionsName: "SwaggerDocOptions");
var app = builder.Build();
app.UseGMServices(); // docs, routing, CORS, logging, localization, exception handling, controllers
app.Run();
What you get
- Thin controllers —
BaseControllerexposes a lazily-resolvedIMediatorand pagination helpers. - Validation — FluentValidation auto-validation plus a mediator
RequestValidationBehavior. - CORS, versioning, Swagger — wired from configuration in one call each.
- Middlewares — RFC-7807 exception handling, request/response logging with sensitive-field masking,
and
Accept-Language-driven request localization. - Serilog — host configured from
appsettings.json, with environment/process/thread enrichers.
Requirements
Contributing & releases
Versioning is automated from Conventional Commits — see CONTRIBUTING.md. All six packages release together under one version.
License
MIT — see LICENSE.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- FluentValidation (>= 12.1.1)
- FluentValidation.AspNetCore (>= 11.3.1)
- FluentValidation.DependencyInjectionExtensions (>= 12.1.1)
- GM.API.Application (>= 1.4.0)
- GM.API.Cors (>= 1.4.0)
- GM.API.Middlewares (>= 1.4.0)
- GM.API.Shared (>= 1.4.0)
- GM.API.Versioning (>= 1.4.0)
- GM.Documentation (>= 1.3.0)
- GM.Exceptions (>= 1.2.1)
- Refit (>= 14.0.1)
- Serilog.AspNetCore (>= 10.0.0)
- Serilog.Enrichers.Environment (>= 3.0.1)
- Serilog.Enrichers.HttpContext (>= 8.3.0)
- Serilog.Enrichers.Process (>= 3.0.0)
- Serilog.Enrichers.Thread (>= 4.0.0)
- Serilog.Settings.AppSettings (>= 3.0.0)
- Serilog.Settings.Configuration (>= 10.0.1)
- Serilog.Sinks.Async (>= 2.1.0)
- Serilog.Sinks.Graylog (>= 3.1.1)
- Serilog.Sinks.RollingFile (>= 3.3.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.