This repository provides a reusable .NET template package to bootstrap projects using Hexagonal Architecture (Ports and Adapters) and modern engineering practices.
It includes three templates for different scopes: a full application, a BFF-focused application, and a contracts-only package.
- What this project provides
- Available templates
- Template documentation
- Technologies included
- Quick start
- Template options and help
- Update or uninstall
- Recommendation
- Official template docs
- Contributing
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.
hexagonal-solution-full: complete hexagonal solution withDomain,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-contracts: lightweight contracts package for shared DTOs, request/response models, and protobuf definitions.
Each template has its own README with architecture details, structure, and helper commands:
- Full template:
templates/Full/Readme.md - BFF template:
templates/Bff/Readme.md - Contracts template:
templates/Contracts/Readme.md
- 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
Install the template package:
dotnet new install GPreviatti.Template.Hexagonal.SolutionCreate a new solution from each template:
dotnet new hexagonal-solution-full -n HexagonalSolution
dotnet new hexagonal-solution-bff -n HexagonalSolution
dotnet new hexagonal-solution-contracts -n HexagonalSolutionUse -h to list available options for each template:
dotnet new hexagonal-solution-full -h
dotnet new hexagonal-solution-bff -h
dotnet new hexagonal-solution-contracts -hUpdate to the latest published template version:
dotnet new update GPreviatti.Template.Hexagonal.SolutionUninstall the template package:
dotnet new uninstall GPreviatti.Template.Hexagonal.SolutionKeep 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.
https://github.com/dotnet/templating/wiki
Have a feature request or found a bug? We'd love to hear from you!