Skip to content
| Marketplace
Sign in
Visual Studio>Tools>Template OnionAPI
Template OnionAPI

Template OnionAPI

Fuji Nguyen

|
4,491 installs
| (3) | Free
Visual Studio template that scaffolds a .NET 10 ASP.NET Core Web API following clean architecture with Domain, Application, Infrastructure.Persistence, Infrastructure.Shared, and WebApi projects wired with a lightweight mediator, FluentValidation, EF Core, Swagger, and Serilog...
Download

The template bundles a prewired .NET 10 clean-architecture Web API solution: Domain, Application, Infrastructure.Persistence, Infrastructure.Shared, WebApi hosts plus matching test projects, already configured with lightweight mediator, FluentValidation, EF Core, Swagger, Serilog, sample CQRS features, seeding, and DI extensions so you can scaffold a Clean Architecture API stack in Visual Studio with one click.

When utilizing the OnionAPI template to initiate a new project in Visual Studio, it automatically generates a solution comprising five distinct projects. Each project is prefixed with the given project name and boasts its own customizable namespace within the source code. The purposes of these projects are outlined below:

  1. Domain: This project serves as the repository for entities and common models integral to the application.
  2. Application: Within this project, you'll find interfaces, CQRS features, exceptions, and behaviors crucial for the application's functionality.
  3. Infrastructure.Persistence: Home to the data access API, this project is built on Entity Framework, facilitating interaction with the underlying database.
  4. Infrastructure.Shared: This project encompasses common services such as the Mail Service, Date Time Service, Mock, and others that are shared across different components of the application.
  5. WebApi: This project hosts API controllers responsible for exposing REST API resources. Additionally, it provides endpoints accessible via Swagger, allowing for seamless interaction with the API.

The underlying technology stack employs a loosely-coupled and inverted-dependency architecture, incorporating sound design patterns and best practices. Here's a breakdown of the key components:

  1. NET 10: A framework designed for the development of RESTful services (web APIs) using C#, providing a solid foundation for creating scalable and performant applications.

  2. Repository Pattern: This pattern introduces an abstraction layer between the data access layer and the controller, enhancing modularity and maintainability in the application's design.

  3. CQRS (Command and Query Responsibility Segregation) Pattern: This architectural pattern separates read and update operations for a data store, optimizing performance, scalability, and security. Leveraging lightweight mediator and Mapster enhances the implementation of this pattern.

  4. Entity Framework Core: A lightweight, extensible, open-source, and cross-platform iteration of the renowned Entity Framework data access technology. It simplifies database interactions within the application.

  5. Swagger: Recognized as an industry standard, Swagger is employed for REST API documentation and testing. It streamlines the process of creating and maintaining comprehensive API documentation.

  6. Bogus: A realistic and user-friendly mock data .NET library, facilitating rapid design and testing of REST APIs. It aids in generating authentic-looking mock data for various scenarios.

  7. Serilog: Serving as a robust solution, Serilog is utilized for logging WebAPI requests and errors. It enhances the monitoring and debugging capabilities of the application by providing detailed logs of requests and errors.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft