Scaffolding
Feature Scaffolding
VS Code Snippets
The FastEndpoints VS Extension adds the following handy code snippet shortcuts to make it faster to scaffold/expand new classes in your project:
epreq
Scaffolds an endpoint with only a request dto
public class Endpoint : Endpoint<Request>
epreqres
Scaffolds an endpoint with request and response dtos
public class Endpoint : Endpoint<Request, Response>
epnoreq
Scaffolds an endpoint without a request nor response dto
public class Endpoint : EndpointWithoutRequest
epres
Scaffolds an endpoint without a request dto but with a response dto
public class Endpoint : EndpointWithoutRequest<Response>
epdto
Scaffolds the request & response dtos for an endpoint
public class Request {}
public class Response {}
epval
Scaffolds an endpoint validator for a given request dto
public class Validator : Validator<Request>
epmap
Scaffolds an endpoint mapper class for the given request, response and entity dtos
public class Mapper : Mapper<Request, Response, Entity>
epsum
Scaffolds a summary class for a given endpoint and request dto
public class Summary : Summary<Endpoint, Request>
epdat
Scaffolds a static data class for an endpoint
public static class Data
epfull
Scaffolds the complete set of classes for a full vertical slice
VS New Item Template
If you're doing vertical slice architecture and placing each individual feature in their own namespace, you can take advantage of the FastEndpoints VS Extension that will add a new item to the "add new file" dialog of visual studio to make it convenient to add feature file sets to your project.
Once installed, your visual studio add new item dialog will have FastEndpoints Feature File Set listed under Installed > Visual C# node. Then, instead of entering a file name, simply enter the namespace you want your new feature to be added to followed by .cs
A new feature file set will be created in the folder you selected.
There will be 4 new files created under the namespace you chose.
Data.cs - Use this class to place all of your data access logic.
Models.cs - Place your request, response DTOs and the validator in this file.
Mapper.cs - Domain entity mapping logic will live here.
Endpoint.cs - This will be your new endpoint definition.
Click here for an example feature file set.

Dotnet New Template
If you prefer working with the cli, you can use our dotnet new template to create a new feature file set.
Installation:
dotnet new -i FastEndpoints.TemplatePack
Usage:
The following command will use the namepsace MyProject.Comments.Create
Method POST
Route: api/comments
Files will be created in folder Features/Comments/Create:
dotnet new feat --name MyProject.Comments.Create \
-m post \
-r api/comments \
-o Features/Comments/Create
All Options
> dotnet new feat --help
FastEndpoints Feature Fileset (C#)
Author: @lazyboy1
Options:
-t|--attributes Whether to use attributes for endpoint configuration
bool - Optional
Default: false
-p|--mapper Whether to use a mapper
bool - Optional
Default: true
-v|--validator Whether to use a validator
bool - Optional
Default: true
-m|--method Endpoint HTTP method
GET
POST
PUT
DELETE
PATCH
Default: GET
-r|--route Endpoint path
string - Optional
Default: api/route/here
Project Scaffolding
If you prefer working with the CLI, you can use our dotnet new template to create a new FastEndpoints project.
Installation
dotnet new --install FastEndpoints.Template
Usage
dotnet new fastendpoints --name [PROJECT-NAME]
Features
This dotnet template includes:
- FastEndpoints
- FastEndpoints.Generator (Source generation)
- FastEndpoints.Swagger
All Options
FastEndpoints API (C#)
Author: Stefan Bogdanović
Options:
-auth|--cookie-auth Adds Cookie Authentication.
bool - Optional
Default: false
-log|--serilog Adds Serilog.
bool - Optional
Default: false
-t|--tests Adds an integration test project.
bool - Optional
Default: true