Scaffold.Service is an opinionated template of a service built using ASP.NET Core. It is intended to be used as an example for, or as a bootstrap to, the development of other services and aims to address some common concerns when building microservices with ASP.NET Core. Scaffold is an example of a Service Template.
To bootstrap your next service with Scaffold.Service.
-
Install or update the template package from NuGet.org onto your computer by running;
dotnet new install Scaffold.Service
-
Create your new service by running;
dotnet new scaffold.service --output <SOLUTION_NAME>
-
Update
README.md
and all other documentation in your service so that it makes sense.
Alternatively just browse the template directory to copy and paste the parts of the service that you actually need.
Scaffold.Service comes pre-configured with or aims to make developing the following features in your next service a little bit more easier.
Other stuff you inherit when you bootstrap with Scaffold.Service.
- Architecture
- Code Analysis and Formatting
- Cross-platform Support
- Deterministic Builds
- Development Container
- Docker Support
- Entity Framework Support
- Nullable Reference Types
- Software Bill of Materials
- Test Structure
Stuff you might want to add to your service but not included with Scaffold.Service.
- API Versioning
- Authentication and Authorization
- Caching (See also Overview of caching in ASP.NET Core)
- Console Log Formatting
- Cross-Origin Resource Sharing (CORS)
- Feature Gates
- Forwarded Headers Handling
- Header Propagation
- Response Compressions
- Secrets Management
If building microservices, you may want to bring your own sidecars.
Scaffold.Service includes an example application which is intended to be replaced with your actual application when using this template. This example application has been included to help demonstrate features in this template.
The example application is a simple CRUD application where you can create Buckets and put Items in them. The Buckets have a size which represents the number of Items you can put in them. To Create, Read, Update and Delete Buckets or Items in the application, simply send HTTP POST, GET, PUT or DELETE requests to the service.
Explore the service by going to /swagger
in a web browser.
You are also invited to fork this repository to create your own template. Organizations may want to do this to pre-configure the template to work in their environment and incorporate their own sensible defaults.
For more information about custom templates, please checkout Custom templates for dotnet new.
Scaffold.Service has been inspired by and built from the prior experience and work of many others. In particular, Scaffold.Service heavily relies on the open-source community and those who support that community. Please consider contributing back to their open-source projects in whatever way you can.