https://github.com/sayeed1999/aspnetcore.webapi.template
Build any small-large scale web api in ASP.NET Core which includes Clean Architecture, CQRS, Mediatr, Functional Testing, and many more using this template.
https://github.com/sayeed1999/aspnetcore.webapi.template
asp-net-core clean-architecture docker dotnet-core functional-testing hacktoberfest template-project unit-test webapi
Last synced: 3 months ago
JSON representation
Build any small-large scale web api in ASP.NET Core which includes Clean Architecture, CQRS, Mediatr, Functional Testing, and many more using this template.
- Host: GitHub
- URL: https://github.com/sayeed1999/aspnetcore.webapi.template
- Owner: sayeed1999
- License: mit
- Created: 2024-10-18T06:37:38.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-10-20T17:17:17.000Z (8 months ago)
- Last Synced: 2024-10-29T08:06:00.101Z (8 months ago)
- Topics: asp-net-core, clean-architecture, docker, dotnet-core, functional-testing, hacktoberfest, template-project, unit-test, webapi
- Language: C#
- Homepage:
- Size: 129 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# ASP.NET Core Web API Template
**AspNetCore.WebApi.Template** is an open-source project to speed up the API development process of any small-large scale application in ASP.NET Core. This comes with out-of-the box prebuilt setups including -
- **ASP.NET Core** Web API with **PostgreSQL** database
- **Docker** container support with hot reloading support for local development
- **Clean Architecture** with **FluentValidation**, **CQRS** and **Mediatr**
- **OData** integration support
- Sample code for **CRUD operation** on Products, Categories
- Sample code for **functional testing** of business usecases
- any many more..## Table of Contents
- [Architecture](#architecture)
- [Set Up Environment Variables](#set-up-environment-variables)
- [Run with Docker](#run-with-docker)
- [Add a Migration](#add-a-migration)
- [Contribute to this Project](#contribute-to-this-project)
- [Special Thanks](#special-thanks)## Architecture
This project is built on top of **Clean Architecture** with **CQRS** and **Mediator** pattern in **ASP.NET Core**.
To get a high-level overview of the responsibilites each of the layers in this project, please refer to -
- [Presentation Layer](src/Web/README.md)
- [Application Layer](src/Application/README.md)
- [Infrastructure Layer](src/Infrastructure/README.md)
- [Domain Layer](src/Domain/README.md)## Set Up Environment Variables
- Clone the repository & navigate to project root directory.
- Set necessary environment variables in your machine by following the .env.example file e.g
```bash
export POSTGRES_USER=xxx
export POSTGRES_PASSWORD=xxx
export PGADMIN_EMAIL=xxx
export PGADMIN_PASSWORD=xxx
```## Run with Docker
- Ensure Docker is installed on your system.
- Run the docker containers using the following command.
```bash
docker compose -f docker-compose.local.yml up -d
```- Hit the healthcheck endpoint to see API is working on not.
```
URI: /GET localhost:5000/health
```- Test hot reloading working or not inside Docker container.
Change any code (comment out a single endpoint) and save the code and see docker container has updated on real-tme.
- Stop the docker container using the following command.
```bash
docker compose -f docker-compose.local.yml down
```## Add a Migration
Run the following command to add a migration
```bash
dotnet ef migrations add --project ./src/Infrastructure --startup-project ./src/Web --output-dir ./Data/Migrations
```## Contribute to this Project
Please refer to contribution guide [page](./CONTRIBUTING.md).
## Special Thanks
I used the following two templates to start my own template:
- [jasontaylordev/CleanArchitecture](https://github.com/jasontaylordev/CleanArchitecture)
- [jasontaylordev/NorthwindTraders](https://github.com/jasontaylordev/NorthwindTraders)