sk-shahnawaz / aspdotnet-template

Template repository for ASP.NET Core Web API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ASP.NET Core Template

The purpose of this repository is to standardize development and deployment workflow for ASP.NET Core based server side development. It contains a sample web API application built with .NET Core.

Best practices related to .NET Development have been followed while developing this template application. It is however, not absolute and any improvement in this template is highly encouraged. :star: :rocket: :octocat:

Badges

build

Contributions

Please read CONTRIBUTING.md before starting to contribute in this project.

Table of Contents

Pre-requisites

  • Git Version Control System
  • .NET 6 SDK & Runtime
  • EF Core Command Line Tool v 6.0.0+
  • PostgreSQL v13.2 / SQL Server 2017 Express Edition+ with SQL Server Authentication enabled
  • Visual Studio 2022 Community Edition / Visual Studio Code with OmniSharp extension installed / JetBrains Rider
  • Docker v20.10.6 build 370c289 or above
  • Docker Compose v3.7+
  • Additional setup needed for generating unit test coverage reports described here

Structure

Solution Projects

Project Type Project Name Usage
ASP.NET Core Web API ASP.NET-Core.WebAPI Main web API project
.NET Core Class Library NET-Core.Library.Domain Application domain logic de-coupled
.NET Core Console Application NET-Core.Console.DB.PostgreSQL Sample PostgreSQL database configurations with Entity Framework (EF) Core migration pre-configured
.NET Core Console Application NET-Core.Console.DB.SqlServer Sample SQL Server database configurations with Entity Framework (EF) Core migration pre-configured
XUnit NET-Core.XUnit.UnitTests Unit testing project

Repository Root Miscellaneous Items

Item Name Type Purpose
.github Directory Contains GitHub Action scripts (CI/CD)
.vs Directory Contains Visual Studio setting files
.dockerignore File Contains definitions of files to be ignored by Docker Engine during image building process
.editorconfig File
.gitignore File Contains definitions of files to be ignored by Git
Scripts Directory Contains all scripts related to this repository
Scripts\repository-files-renamer.ps1 File This Powershell script file can be used to automatically renaming directories/files, replacing file contents to set up a new solution from this template repository
CONTRIBUTING.md File GitHub repository contributions mark-up file
docker-compose.yml File Docker compose file to build the application docker image along with PostgreSQL image, PostgreSQL specific migrations and with networking / volumes etc.
Dockerfile File Dockerization script file of the application
LICENSE.md File GitHub repository license mark-up file
README.md File GitHub repository readme mark-up file

Pre-configured Features:

  • Console logging using Serilog
  • Application monitoring using Sentry & New Relic
  • HTTPS redirection
  • Health check endpoint
  • CORS
  • Dependency Injection
  • EF Core with in-memory database setup or PostgreSQL or SQL Server database setup with Migrations and Seed Data
  • Data access from persistence medium through EF Core using Generic Repository Pattern, Unit of Work pattern
  • AutoMapping
  • Pagination in API response
  • Sample GET/POST/PUT/PATCH/DELETE APIs
  • Filtration, Sorting support on GET APIs through OData
  • HATEOAS complaint API response
  • Consistent & Machine readable error response using ProblemDetails
  • API Versioning
  • Open API documentation support using Swagger
  • Unit Testing setup using XUnit, Moq, Generic Repository Pattern
  • Code Coverage Report Generation setup with report summary in GitHub PR as Bot Comment
  • Git Ignore, Docker Ignore, Dockerfile and Docker Compose script for containerization
  • GitHub actions
  • Script to auto renaming components (files/directories, file contents) for setup of new solution from this template.

Known Issues

  • Containairization / Dockerization with HTTPS certification and PostgreSQL image
  • Containairization / Dockerization with HTTPS certification and SQL Server image

Learning

About

Template repository for ASP.NET Core Web API

License:MIT License


Languages

Language:C# 93.4%Language:PowerShell 5.1%Language:Dockerfile 1.5%