Narch.Forge.Validation 1.0.0

dotnet add package Narch.Forge.Validation --version 1.0.0
                    
NuGet\Install-Package Narch.Forge.Validation -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Narch.Forge.Validation" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Narch.Forge.Validation" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Narch.Forge.Validation" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Narch.Forge.Validation --version 1.0.0
                    
#r "nuget: Narch.Forge.Validation, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Narch.Forge.Validation@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Narch.Forge.Validation&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Narch.Forge.Validation&version=1.0.0
                    
Install as a Cake Tool

Forge

Forge beautiful ASP.NET Core APIs.

CI License: MIT .NET C#

Forge is an opinionated foundation library family for ASP.NET Core Web APIs. Drop one NuGet, call AddForge(), and your API has consistent responses, RFC 7807 errors, validation, pagination, correlation IDs, and structured logging — with full IntelliSense and zero boilerplate.

Packages (v1.0)

Package Version Purpose
Narch.Forge NuGet Core types: Result, Result<T>, Error, ApiResponse<T>, PagedResult<T>. No ASP.NET dependency.
Narch.Forge.Abstractions NuGet Interfaces & contracts only (currently IRequestContext).
Narch.Forge.AspNetCore NuGet ASP.NET Core middleware, filters, ProblemDetails handler, builder, registration extensions.
Narch.Forge.Validation NuGet FluentValidation integration with automatic 422 envelopes.

Namespaces and types remain under the Forge.* family — only the published NuGet IDs are prefixed with Narch..

Target frameworks: net10.0 (primary, LTS) and net8.0 (compat, dropped in v2).

Install

dotnet add package Narch.Forge.AspNetCore
dotnet add package Narch.Forge.Validation   # optional

Packages are published to nuget.org.

Quick start

using Forge.AspNetCore.EndpointConventions;
using Forge.AspNetCore.HealthChecks;
using Forge.AspNetCore.Registration;
using Forge.Results;
using Forge.Validation;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddForge(opt => opt
    .UseStandardResponseEnvelope(o => o.Version = "v1")
    .UseGlobalExceptionHandler()
    .UseCorrelationId()
    .UseRequestLogging()
    .UseProblemDetails());

builder.Services.AddForgeValidation(v =>
    v.AddValidatorsFromAssemblyContaining<Program>());

var app = builder.Build();
app.UseForge();
app.MapForgeHealthChecks();

app.MapGet("/users/{id:int}", (int id) =>
        id == 42
            ? Result<UserDto>.Success(new UserDto(42, "Ada", "ada@example.com"))
            : Result<UserDto>.Failure(Error.NotFound("USER_NOT_FOUND", $"User {id} not found")))
    .WithApiResponseEnvelope()
    .ProducesApiResponse<UserDto>();

app.Run();

public sealed record UserDto(int Id, string Name, string Email);

A GET /users/42 returns:

{
  "success": true,
  "data": { "id": 42, "name": "Ada", "email": "ada@example.com" },
  "errors": [],
  "meta": { "correlationId": "01J9...", "timestamp": "2026-05-14T10:30:00Z", "version": "v1" }
}

A GET /users/99 returns 404 with:

{
  "success": false,
  "data": null,
  "errors": [{ "code": "USER_NOT_FOUND", "message": "User 99 not found", "field": null }],
  "meta": { "correlationId": "01J9...", "timestamp": "2026-05-14T10:30:00Z", "version": "v1" }
}

Run the sample

The repository ships with a runnable demo at samples/Forge.Sample.Api that exercises every feature.

dotnet run --project samples/Forge.Sample.Api

Then browse to https://localhost:<port>/users/42, /users/99, /users?page=1&size=2, /explode/7, /health, etc.

Documentation

Quality bar

  • TreatWarningsAsErrors=true everywhere
  • 100% XML-doc coverage on public surface (CS1591 is a build error)
  • StyleCop, Roslynator, Meziantou, and .NET Analyzers on
  • xUnit + FluentAssertions; ≥85% line coverage in CI

License

MIT. See LICENSE.

Contributing

See CONTRIBUTING.md. Issues and PRs welcome.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 79 5/14/2026
0.1.0-preview.1 47 5/14/2026