Offside

Offside documentation

Português

Domain errors as Result, not exceptions. The domain returns an Error; ASP.NET Core maps it to Problem Details (RFC 7807). Messages live in JSON catalogs, not in C#.

Start here

Page What it covers
Getting started Install, register, and return your first Problem Details response
Concepts Error, ErrorKind, Result, primary error, catalogs, the escape hatch
Domain guide Writing domain code with Result<T>: factories, Custom, Bind/Map/Combine
ASP.NET Core guide ToHttpResult / ToActionResult, status selection, the response shape, 500 handling
Messages and cultures Catalog format, culture fallback, {token} interpolation
CLI offside init — agent skills and catalog templates
API reference Every public type and member, in one page
FAQ Design decisions and common pitfalls

The shape of it

// Domain — knows nothing about HTTP
public Result<Order> Get(string id)
{
    var order = _orders.Find(id);
    return order is null
        ? Result<Order>.Failure(Error.NotFound("order", id))
        : Result<Order>.Success(order);
}
// Endpoint — one line
app.MapGet("/orders/{id}", (string id, HttpContext http) => _orders.Get(id).ToHttpResult(http));
// Response  404, application/problem+json
{
  "type": "https://httpstatuses.io/404",
  "title": "NotFound",
  "status": 404,
  "detail": "order '42' was not found.",
  "traceId": "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01",
  "errors": [
    { "code": "not_found", "kind": "NotFound", "detail": "order '42' was not found.", "field": null }
  ]
}

Packages

Package Target frameworks Role
Offside netstandard2.0, net8.0, net10.0 Error, ErrorKind, Result / Result<T>, JSON resolver, AddOffside
Offside.AspNetCore net8.0, net10.0 ToHttpResult / ToActionResult, Problem Details, AddOffsideAspNetCore
Offside.Tool net8.0 offside init — agent skills and catalog templates

The core package has no ASP.NET dependency, so domain projects can reference it freely.

Elsewhere