Skip to content

gpreviatti/hexagonal-solution-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

860 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hexagonal architecture solution template

Publish template in Nuget.org Mutation testing badge

This repository provides a reusable .NET template package to bootstrap projects using Hexagonal Architecture (Ports and Adapters) and modern engineering practices.

It includes four templates for different scopes: a full application, a BFF-focused application, a Blazor Web UI application, and a contracts-only package.

Table of contents

What this project provides

The package GPreviatti.Template.Hexagonal.Solution lets you quickly create solutions with:

  • clear layering and separation of concerns;
  • HTTP and gRPC integration patterns;
  • observability and test-first tooling support;
  • examples that help accelerate initial development.

Available templates

  • hexagonal-solution-simple: streamlined hexagonal solution with Core, Infrastructure, and WebApp layers plus unit/integration/load test projects — ideal for straightforward applications.
  • hexagonal-solution-full: complete hexagonal solution with Domain, Application, Infrastructure, WebApp, and test/load test projects.
  • hexagonal-solution-bff: Backend-for-Frontend oriented solution with HTTP/gRPC adapters, integration tests, and load tests.
  • hexagonal-solution-webui: Blazor Web App oriented solution with contracts/infrastructure separation and bUnit component unit tests.
  • hexagonal-solution-contracts: lightweight contracts package for shared DTOs, request/response models, and protobuf definitions.

Template documentation

Each template has its own README with architecture details, structure, and helper commands:

Technologies included

  • FluentValidation
  • OpenTelemetry
  • Entity Framework Core
  • gRPC / Protobuf
  • xUnit, Moq, AutoFixture
  • Docker and Docker Compose
  • k6 (load testing)
  • Stryker (mutation testing)
  • GitHub Actions
  • Hybrid cache
  • RabbitMQ

Quick start

Install the template package:

dotnet new install GPreviatti.Template.Hexagonal.Solution

Create a new solution from each template:

dotnet new hexagonal-solution-simple -n HexagonalSolution
dotnet new hexagonal-solution-full -n HexagonalSolution
dotnet new hexagonal-solution-bff -n HexagonalSolution
dotnet new hexagonal-solution-webui -n HexagonalSolution
dotnet new hexagonal-solution-contracts -n HexagonalSolution

Template options and help

Use -h to list available options for each template:

dotnet new hexagonal-solution-simple -h
dotnet new hexagonal-solution-full -h
dotnet new hexagonal-solution-bff -h
dotnet new hexagonal-solution-webui -h
dotnet new hexagonal-solution-contracts -h

Update or uninstall

Update to the latest published template version:

dotnet new update GPreviatti.Template.Hexagonal.Solution

Uninstall the template package:

dotnet new uninstall GPreviatti.Template.Hexagonal.Solution

Recommendation

Keep the provided Order sample scenario in place until your own domain scenario is implemented. It serves as a reference for architecture, project organization, and tests.

Official template docs

https://github.com/dotnet/templating/wiki

Contributing

Have a feature request or found a bug? We'd love to hear from you!

About

This is a dotnet solution template from projects based on hexagonal architecture and best practices

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Sponsor this project

 

Contributors