Skip to content

yasikovsky/asp-net-core-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ASP.NET Core API & Worker template

What is this?

This is a template you can use to quickly create a multiplatform ASP.NET Core 6 application that runs an API server and a worker process as two projects under one solution. It also features fully configured packages that I use the most when developing ASP.NET apps, which are:

Also has a bunch of extension methods and useful methods I've written over the years and come back to all the time:

  • Custom Database Gateway service for Database queries with dependency injection
  • Custom PostgreSQL Database resolver for Dapper.SimpleCRUD
  • Custom Dapper type handlers for Enums (generic), List<Guid>, List<string>, List<int>, RoleType and object (serialized to JSON)
  • Role and Claim support with RequireRole and RequireClaim attributes that work with controllers and also generate Swagger annotations
  • FilterModel and SqlFilterAttribute classes that help translate data request models with filters and sorting to database queries with joins across multiple tables
  • solution-wide appsettings.json and appsettings.[environment].json to set-up config files once and share them between the API and Worker projects

Prerequisites

Usage

  1. Install the template nuget package:
dotnet new --install yasikovsky.AspNetCoreTemplate
  1. Navigate to your empty project folder
  2. Create a project files using the template

With example values:

dotnet new yaspnet

Or with your own options:

dotnet new yaspnet --ProjectName "MyProject" --DbHostname "127.0.0.1" --DbPort "5432" --DbDatabase "mydatabase" --DbUsername "myusername" --DbPassword "mypassword" --GitHubOrgName "my-org-name"
  1. Finish it up with restoring NuGet packages:
dotnet restore

Changelog

1.0.0

  • Initial release

1.1.0

  • Added Dockerfiles
  • Added Preconfigured Docker-compose.yaml file with example environment variable file
  • Added Github Actions runner to publish Docker packages to GitHub package repository when creating new release (important to tag them in the vX.X.X format)
  • PasswordSalt is now a random UUID
  • JwtAuthSecret is now two joined random UUIDs

1.1.1

  • Small template modifications

About

An ASP.NET Core 6 API & Worker template

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published