Skip to content

Repository files navigation

Zenvera .NET Examples

.NET PR validation Build examples License

Learn modern .NET by comparing working implementations side by side.

zenvera.dotnet-examples is a .NET 10 reference-example monorepo covering API protocols, authentication mechanisms, infrastructure integrations, API gateways, native UI, and three approaches to Clean Architecture. Every example is intentionally scoped, independently understandable, and documented with its trade-offs and production considerations.

Created and maintained by Vishwa Kumar. Visit vishwa.me for more engineering articles, projects, and contact information.

This is a learning and comparison repository—not one enterprise application, a production bounded context, or a drop-in production platform.

Start here

Choose a path based on what you want to learn:

I want to… Start with Continue with
Learn ASP.NET Core APIs Minimal REST API MVC, endpoint-per-file, FastEndpoints
Compare API protocols Native gRPC Transcoding, GraphQL, SOAP
Understand authentication REST API key JWT, Identity, OAuth 2.0
Learn Clean Architecture Simple service layer Custom CQRS, CQRS with MediatR
Explore infrastructure patterns Infrastructure overview Redis, RabbitMQ, Key Vault, Serilog, and background processing
Explore gateways and UI API gateway comparison Ocelot, YARP, .NET MAUI
Learn Aspire local orchestration Aspire reference AppHost + ServiceDefaults + SQL + REST + Blazor

For a guided progression through the entire repository, follow the recommended learning path.

What is included

API styles

Use the same Todo domain to see how delivery style changes the shape of an application.

Style Examples What you can compare
REST 4 Minimal APIs, MVC controllers, endpoint-per-file organization, and FastEndpoints
gRPC 2 Native Protocol Buffers and JSON transcoding
GraphQL 1 Schema, queries, mutations, and resolver-based delivery
SOAP 1 CoreWCF contracts, operations, data contracts, and WSDL interoperability

Authentication

Compare where credentials travel, how they are validated, and what must be hardened for real systems.

Protocol Demonstrated mechanisms
REST API key, Basic authentication, JWT bearer, ASP.NET Core Identity with JWT, OAuth 2.0 with Duende
gRPC API-key metadata, JWT bearer metadata, mutual TLS
GraphQL API key, JWT bearer, Firebase authentication

See the authentication comparison matrix for credential transport, rotation, revocation, relative strength, and recommended use.

Architecture, integration, infrastructure, and UI

Area Examples Focus
Clean Architecture 3 Simple service layer, CQRS with a custom dispatcher, and CQRS with MediatR
API gateways 2 Ocelot and YARP routing boundaries
Infrastructure 6 Redis, RabbitMQ, Azure Key Vault, Serilog, MongoDB/SQL sinks, and hosted background work
User interface 1 .NET MAUI native client consuming the Todo REST API
Aspire reference 1 Self-contained AppHost, ServiceDefaults, SQL, REST API, and Blazor portal

The complete catalog lists every example, project path, framework, external dependency, build status, test status, and recommended learning sequence.

Example maturity levels

Maturity describes the teaching scope—not production readiness.

Level Meaning Typical examples
Level 1 — Focused Pattern Example Demonstrates one technology or implementation concern with minimal ceremony Authentication, gateways, infrastructure, MAUI
Level 2 — Layered Example Separates delivery from reusable domain or persistence concerns REST, gRPC, GraphQL, and SOAP Todo examples
Level 3 — Architecture Reference Preserves Domain, Application, Infrastructure, host, and tests Three gRPC Clean Architecture variants

Small examples are deliberately not forced into four Clean Architecture projects. Architecture-reference examples retain the complete separation because dependency direction is the lesson.

Five-minute quick start

Prerequisites

  • .NET SDK 10; global.json selects SDK 10.0.301 with feature-band roll-forward.
  • A trusted ASP.NET Core development certificate for HTTPS examples.
  • Docker Desktop or another Compose-compatible / Aspire-compatible container engine for Redis, RabbitMQ, MongoDB, SQL Server, and the Aspire reference sample.
  • Platform-specific .NET MAUI workloads only for the native UI example.

Run the first example

The Minimal REST API is self-contained and uses a local SQLite database:

git clone https://github.com/VishwamKumar/zenvera.dotnet-examples.git
cd zenvera.dotnet-examples
dotnet restore solutions/zenvera.api-styles.slnx
dotnet run --project src/ApiStyles/Rest/Exp.Todo.RestApi.Minimal --launch-profile https

Open the address printed by ASP.NET Core and use the Swagger/OpenAPI UI to exercise Todo CRUD operations. The generated SQLite database is ignored by Git.

Build the public, self-contained learning categories independently:

dotnet build solutions/zenvera.api-styles.slnx
dotnet build solutions/zenvera.authentication.slnx
dotnet build solutions/zenvera.architecture.slnx
dotnet build solutions/zenvera.integration.slnx
dotnet build solutions/zenvera.reference.slnx

Solutions and repository navigation

The repository provides one authoritative root solution and smaller category solutions for easier exploration.

Solution Scope
zenvera.dotnet-examples.slnx All 49 maintained projects
solutions/zenvera.api-styles.slnx REST, gRPC, GraphQL, SOAP, and shared Todo persistence
solutions/zenvera.authentication.slnx REST, gRPC, and GraphQL authentication examples
solutions/zenvera.architecture.slnx Clean Architecture variants and their tests
solutions/zenvera.integration.slnx Ocelot and YARP gateways
solutions/zenvera.infrastructure.slnx Infrastructure-focused Weather hosts
solutions/zenvera.user-interface.slnx .NET MAUI client
solutions/zenvera.reference.slnx Aspire AppHost reference (API, Blazor, ServiceDefaults, tests)

Open the root or a category .slnx in Visual Studio, Rider, or the .NET CLI. Every maintained project belongs to the root solution.

External services and private packages

Most API-style, authentication, gateway, and architecture examples compile without starting external infrastructure. Runtime requirements are documented in each example README.

Local service definitions are available for Redis, RabbitMQ, MongoDB, and SQL Server:

Copy-Item deploy/local/.env.example deploy/local/.env
docker compose --env-file deploy/local/.env -f deploy/local/compose.yml up -d

Read the local infrastructure runbook for ports, safe development defaults, health checks, and shutdown commands.

A note for public visitors

Several infrastructure examples use the author's private Zenvera.Shared.* packages. Their source projects remain visible for architectural study, but restoring them requires authorized access to the configured GitHub Packages feed. No token or package credential is stored in this repository.

If you do not have access, use the API styles, authentication, architecture, integration, or background-service examples; they remain independently explorable. Maintainers can configure private-feed access using the CI validation runbook.

Azure Key Vault, Firebase, mutual-TLS certificates, and gateway downstream services require their own development resources or credentials at runtime.

Testing and validation

The three Level 3 architecture references contain automated tests:

dotnet test src/Architecture/CleanArchitecture/GrpcTodo/Simple/tests/Exp.Todo.Tests
dotnet test src/Architecture/CleanArchitecture/GrpcTodo/Cqrs/tests/Exp.Todo.Tests
dotnet test src/Architecture/CleanArchitecture/GrpcTodo/CqrsMediatR/tests/Exp.Todo.Tests

Focused examples include reproducible manual scenarios in their READMEs. CI validates the tracked example manifest, repository hygiene, restore, build, tests, formatting, Markdown links, and Docker Compose configuration. See the CI validation runbook.

Architecture principles

  • Keep each example focused on the technology or decision it teaches.
  • Use layering only when it makes delivery, application, domain, or persistence boundaries clearer.
  • Preserve full dependency direction in architecture-reference examples.
  • Share only materially identical Todo, Weather, contracts, or test utilities.
  • Keep protocol contracts and example-specific behavior local.
  • Prefer one root solution plus category solutions over copied repository-level solutions.
  • Document intentional omissions and production hardening instead of presenting samples as production-ready.

The repository itself is described in the high-level design, C4 documentation, and reference-example monorepo ADR.

Repository evolution

This repository is not a collection of newly created, one-time samples. It brings together examples that were developed and refined over multiple .NET generations.

  1. The original examples began as independent repositories on .NET 8, each focused on a particular API style, authentication mechanism, architecture option, infrastructure capability, or UI framework.
  2. Those repositories were progressively maintained and upgraded to .NET 9 while remaining independently runnable.
  3. The examples were later consolidated into this reference monorepo and upgraded to .NET 10.
  4. Naming, documentation, dependencies, build configuration, solutions, and CI validation were normalized while preserving the behavior and educational intent of each example.

This history explains why the repository contains both compact focused examples and fully separated architecture references. Consolidation was not used as a reason to rewrite every implementation into one style or force Clean Architecture onto small demonstrations.

Production-use disclaimer

These examples are learning references, not certified production templates. Depending on the example, they may simplify or omit threat modeling, authorization depth, secret rotation, certificate lifecycle, database migrations, resilience, telemetry, high availability, accessibility, load testing, deployment policy, and operational ownership.

Use each README's Production considerations section as the beginning of an engineering review—not as evidence that the example is production-ready.

Contributing

Contributions are welcome when they preserve the repository's comparison-first purpose.

  • Keep an example's learning objective narrow and assign a maturity level.
  • Do not redesign unrelated examples merely for stylistic uniformity.
  • Preserve public routes and protocol contracts unless the change explicitly teaches contract evolution.
  • Add new projects to the root solution, category solution, and build manifest.
  • Follow the Exp naming conventions and documented port map.
  • Never commit credentials, generated databases, build outputs, or user-specific files.
  • Update the catalog, README, tests, comparison matrix, and runbook affected by the change.
  • Use the example README template.

About the author

This repository is created and maintained by Vishwa Kumar.

If these examples help you, consider starring the repository and sharing the learning path with other .NET developers.

License

Licensed under the MIT License.

About

Curated .NET reference implementations covering API styles, authentication, Clean Architecture, integrations, infrastructure patterns, and UI frameworks.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages