Configuration
Golden Path architectures are configurable. You can customize layer naming, endpoint styles, and ID strategies to match your team's conventions.
Solution Options
When creating a solution, you can specify options that affect how templates are processed and code is generated. These options are defined in the SolutionOptions interface:
- Name
domainLayer- Type
- string
- Description
Name for the domain layer. Default:
Domain. Alternative:Core.
- Name
applicationLayer- Type
- string
- Description
Name for the application layer. Default:
Application. Alternative:UseCases.
- Name
apiLayer- Type
- string
- Description
Name for the API layer. Default:
Api. Alternative:Web.
- Name
endpointStyle- Type
- string
- Description
API endpoint implementation style. One of:
controller,minimal-api,fast-endpoints. Default:minimal-api.
- Name
idStrategy- Type
- string
- Description
Entity identifier strategy. One of:
guid,typed-id. Default:guid.
Layer naming
Layer naming controls the project and namespace names for each architectural layer. This affects both the generated project structure and all template variable substitutions.
| Layer | Default | Alternative |
|---|---|---|
| Domain | Domain | Core |
| Application | Application | UseCases |
| API | Api | Web |
The layer names flow through as template variables ({DomainLayer}, {ApplicationLayer}, {ApiLayer}) and affect project names, namespaces, and folder structure.
Default naming
OrderService/
OrderService.Domain/
OrderService.Application/
OrderService.Infrastructure/
OrderService.Api/
Alternative naming
OrderService/
OrderService.Core/
OrderService.UseCases/
OrderService.Infrastructure/
OrderService.Web/
Endpoint style
The endpoint style determines how API endpoints are implemented. Golden Path supports three styles, each with its own template set.
Controller — Traditional ASP.NET MVC controllers with [ApiController] attribute, routing via attributes, and action methods.
Minimal API — Lightweight endpoints using app.MapGet() / app.MapPost() with lambda handlers. The default style.
Fast Endpoints — Endpoint-per-feature pattern using the FastEndpoints library. Each endpoint is a class with Configure() and HandleAsync() methods.
Template files are prefixed with the style name (e.g., controller.Endpoint.cs) and filtered during processing.
Controller style
[ApiController]
[Route("api/[controller]")]
public class OrdersController : ControllerBase
{
[HttpGet("{id}")]
public async Task<IActionResult> Get(Guid id)
{
var query = new GetOrderQuery(id);
var result = await _sender.Send(query);
return Ok(result);
}
}
Minimal API style
app.MapGet("/api/orders/{id}", async (
Guid id, ISender sender) =>
{
var result = await sender.Send(
new GetOrderQuery(id));
return Results.Ok(result);
});
Fast Endpoints style
public class GetOrderEndpoint
: Endpoint<GetOrderRequest, OrderResponse>
{
public override void Configure()
{
Get("/api/orders/{id}");
}
public override async Task HandleAsync(
GetOrderRequest req, CancellationToken ct)
{
var result = await _sender.Send(
new GetOrderQuery(req.Id));
await SendAsync(result);
}
}
ID strategy
The ID strategy controls how entity identifiers are typed.
Guid — Standard System.Guid. Simple and widely supported. No additional types needed.
Typed ID — Strongly-typed ID records (e.g., OrderId(Guid Value)). Prevents accidentally passing an OrderId where a CustomerId is expected. Requires additional record definitions.
The strategy is applied through conditional blocks in templates:
// {{#if typed-id}}
public record OrderId(Guid Value);
// {{/if}}
Guid strategy
public class Order : AggregateRoot<Guid>
{
public Guid Id { get; private set; }
public Guid CustomerId { get; private set; }
}
Typed ID strategy
public record OrderId(Guid Value);
public record CustomerId(Guid Value);
public class Order : AggregateRoot<OrderId>
{
public OrderId Id { get; private set; }
public CustomerId CustomerId { get; private set; }
}
How options flow through the system
Options are set when calling create_solution and stored in the solution configuration. They affect template processing through three mechanisms:
- Layer variables —
buildLayerVariables()maps option values to{DomainLayer},{ApplicationLayer},{ApiLayer}template variables - Condition flags —
buildConditions()generates boolean flags liketyped-id,guid,controller,minimal-apifor conditional blocks - Template filtering —
filterTemplatesByEndpoint()removes templates that don't match the selected endpoint style