Trellis.Asp.Templates
1.0.153-alpha
dotnet new install Trellis.Asp.Templates@1.0.153-alpha
Trellis.Asp.Templates
dotnet new trellis-aspscaffolds a single-service ASP.NET application on the Trellis framework with Clean Architecture (API + Application + Domain + ACL), optional API versioning, EF Core, OpenAPI, and test infrastructure.
Quick Start
dotnet new install Trellis.Asp.Templates
dotnet new trellis-asp -n MyService --author-name "Your Name"
cd MyService; dotnet run --project Api\src
The template restores packages after creation. A restore failure makes dotnet new return a non-zero
exit code; generated files remain on disk. Use --skip-restore for deferred/offline creation, then run
dotnet restore explicitly. Once the app is running, use the API endpoint or OpenAPI UI from the Api project output.
What's Included
Trellis organizes your service into clear layers so business logic stays isolated from HTTP and infrastructure concerns.
Api -> Application -> Domain
\-> Acl -----------^
| Folder | Purpose |
|---|---|
Api\src |
ASP.NET entry point, middleware, configuration, HTTP endpoints |
Api\tests |
API and middleware tests |
Application\src |
Commands, queries, handlers, and application orchestration |
Application\tests |
Application-layer tests |
Domain\src |
Aggregates, value objects, specifications, and core business rules |
Domain\tests |
Domain tests |
Acl\src |
EF Core, repositories, environment/resource naming, external adapters |
Acl\tests |
Infrastructure tests |
.devcontainer |
Codespaces / Dev Container setup for a ready-to-code environment |
DockerOpenTelemetry |
Local observability helper for viewing traces, metrics, and logs |
build |
Build and automation scripts |
Features
- Trellis-based service structure for clean, layered ASP.NET applications
- Railway-Oriented Programming patterns for explicit success and failure flows
- Domain-Driven Design friendly layout with domain, application, API, and ACL projects
- CQRS-style application layer with handlers and request separation
- Test projects for every layer
- EF Core-ready infrastructure setup
- OpenTelemetry support for local observability
- API starter files, HTTP samples, and local app settings
- Common named-route pagination links for both profiles, with the version-aware host policy enabled by
--api-versioning - Dev Container support for Codespaces and VS Code
- Agent-neutral
AGENTS.mdinstructions and version-aligned.agentdocsreferences for Trellis-friendly code generation
Template Parameters
| Parameter | Description | Default |
|---|---|---|
-n, --name |
Service name. Also drives solution, directory, and namespace naming. | MyService |
--author-name |
Author value written into Directory.Build.props. |
Your Name |
--root-namespace |
Valid C# root namespace and assembly prefix. | Derived from -n |
--api-versioning |
Generate date-versioned controllers instead of unversioned APIs. | false |
--database |
sqlite, postgres, sqlserver. |
sqlite |
--auth |
External jwt/OIDC or entra. |
jwt |
--telemetry-exporters |
otlp, azure-monitor, both. |
otlp |
--deployment |
none, container, azure (App Service). |
none |
--skip-restore |
Skip post-creation restore. | false |
Azure requires an explicit server provider; SQLite/Azure fails restore/build and deployment preflight.
PostgreSQL and SQL Server profiles include compose.database.yaml for local development. Generated
README.md describes connection configuration, production identity, Cosmos, and deployment bootstrap.
See the shared option defaults.
Solution filenames and their references preserve the literal -n value, including hyphens.
The default C# namespace is sanitized separately, and --root-namespace does not rename the solution.
The Entra profile expects v2 access tokens with the API application's client-ID GUID as aud,
not the calling client's ID or an api://... audience. Configure the API registration's
api.requestedAccessTokenVersion as 2; requested scopes may still use api://<client-id>/....
The generated production guidance describes the tenant-specific issuer and required claims.
Documentation
- Trellis docs: https://xavierjohn.github.io/Trellis/
- Dev Container guide:
template/.devcontainer/README.md - OpenTelemetry guide:
template/DockerOpenTelemetry/README.md
Related repositories
xavierjohn/Trellis— the framework:Result<T>,Maybe<T>, value objects, DDD primitives, ASP.NET / EF Core / Mediator integration.xavierjohn/Trellis.Microservices— microservice trust-boundary packages: YARP gateway integration + consumer-side actor provider for multi-tenant ABAC.- Microservices template —
dotnet new trellis-microservicesProject Tracker starter with Aspire. xavierjohn/Trellis.ServiceLevelIndicators— latency SLI metrics library for emitting operation-duration histograms via System.Diagnostics.Metrics + OpenTelemetry.
Requirements
- .NET 10 SDK
License
MIT.
This package has no dependencies.
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.153-alpha | 73 | 10/20/2026 |
| 1.0.151-alpha | 96 | 10/8/2026 |