yasikovsky.AspNetCoreTemplate
1.1.1
dotnet new install yasikovsky.AspNetCoreTemplate::1.1.1
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:
- AutoMapper - an object mapper with a dependecy injection extension
- Dapper - a simple ORM mapper
- Dapper.SimpleCRUD.yasikovsky - a fork of Dapper.SimpleCRUD, a library for CRUD helpers for Dapper
- Microsoft.AspNetCore.Authentication.JwtBearer - for generating and serving JWT tokens
- Npgsql - a PostgreSQL data provider
- Serilog - a logging library with a bunch of extensions -- Serilog.AspNetCore for dependency injection -- Serilog.Exceptions for better exception handling -- Serilog.Sinks.Console for native console logging
- ServiceStack.Text - useful JSON manipulation library
- Swashbuckle.AspNetCore - for automagically generating Swagger API documentation
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
- .NET 6 SDK for platform of your choice
- ASP.NET Core 6 Runtime for the above
Usage
- Install the template nuget package:
dotnet new --install yasikovsky.AspNetCoreTemplate
- Navigate to your empty project folder
- 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"
Changelog
1.0 - Initial release
1.1 - Added:
- Dockerfiles
- Preconfigured Docker-compose.yaml file with example environment variable file
- 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
Future improvements
Docker support will be coming soon™.
-
net6.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.