nventive / DotNet.Backend.Template

.NET Core Templates for backend applications and open-source components.
Apache License 2.0
7 stars 3 forks source link
aspnetcore azure-functions csharp dotnet-core dotnet-template graphql

DotNet.Backend.Template

.NET Templates for backend applications and open-source components.

This project provides templates that include backed-in patterns and best practices based on experience of implementing many solutions using Microsoft technologies.

Generated projects can:

License Build Status Nuget

Getting Started

Prerequisites

Generate a Backend project

Run the template with the relevant options:

dotnet new nv-backend -n <project name> -C <company name> [options]

By default, the project will only generate a Core library to host the core business logic of the application. To generate suitable hosts to run and expose it, use the following options:

Option Description
--RestApi Generates an ASP.NET Core MVC project suitable for exposing REST APIs
--SPA Generates an ASP.NET Core project suitable for hosting SPAs
--Functions Generates an Azure Functions project
--Console Generates a Console (command-line) project
--Auth Add authentication (JWT-based) support in Web projects
--Azure Add Azure ARM Template and DevOps Pipeline

Options can be combined, e.g.

dotnet new nv-backend -n <project name> -C <company name> --RestApi --SPA --Functions --Console --Auth

For more details on each project type, see the Features / Backend section.

Generate a netstandard Component project

Run the template:

dotnet new nv-netstandard-component -n <component name> -C <company name>

For more details on what's provided, see the Features / Component section.

Features

Backend

Core

Regardless of the options provided to the template, there is always 2 projects that are generated: Core and Core.Tests, along with some supporting solution files.

Here is the set of feature provided as part of the Core feature set:

Implementation Get Started

Using the library

In order to use the library in the context of an application, it needs to be setup in a specific way. While the template options for head projects provide such an environment, if you need to do it yourself here is what's needed:

RestApi

When using the --RestApi option, 2 projects are added to the solution:

SPA

When using the --SPA option, the Web project is augmented with the following features:

Once the solution has been generated, go to the Web\ClientApp folder and generate the SPA client app here using the SPA tooling of your choice (e.g. Create React App or Angular CLI).

Auth

When using the --Auth option, the Web project is augmented with the following features:

Covering the entire scope of authentication and authorization is too large for this documentation. This option is only there to provide a starting point. Please refer to the ASP.NET Core documentation for more info.

Azure Functions

When using the --Functions option, 2 projects are added to the solution:

Console app

When using the --Console option, 2 projects are added to the solution:

Azure

When using the --Azure option, an Azure Resource Manager template is added to the solution.

To deploy the infrastructure, please install the Azure CLI and run the following commands:

$ az group create -l <Resource Group Location> -n <Name of the Resource Group>
$ az deployment group create --resource-group <Name of the Resource Group> --template-file azure.azrm.json --parameters projectName=<Project Name> environment=<Environment> billTo=<Dept or Individual> managedBy=<Dept or Individual>

e.g.

$ az group create -l canadacentral -n MyAwesomeApp.QA
$ az deployment group create --resource-group MyAwesomeApp.QA --template-file azure.azrm.json --parameters projectName=aweapp environment=qa billTo=HR managedBy=john.doe@example.org

The template has many parameters documented, but here is a few items included:

Also, an Azure DevOps build pipeline is included to get started faster. This is intended to be a starting point more than a turn key solution though.

NetStandard Component

Provides a base repository, solution and projects to create an open-source component.

Includes:

Changelog

Please consult the CHANGELOG for more information about version history.

License

This project is licensed under the Apache 2.0 license - see the LICENSE file for details.

Contributing

Please read CONTRIBUTING.md for details on the process for contributing to this project.

Be mindful of our Code of Conduct.

Acknowledgments