The project is a template for new projects. It is always an ongoing project in order to adapt it to the newer versions of .NET environments. There is a CRUD operation with one entity. Also, the project includes security, tests, mappings, repository, middlewares, and so on.
The main point of the project is to create a base for new projects.
You can find the used technologies below.
- Visual Studio should be installed in order to reach the code. (https://visualstudio.microsoft.com/tr/downloads/) Other compilers like Visual Studio Code, Rider and so on. works as well.
- .NET 6 SDK and .NET Core Runtime should be installed. SDK is for development purposes and runtime is for running the project. (https://dotnet.microsoft.com/en-us/download/dotnet/6.0)
- Postman should be installed for the collections. (https://www.postman.com/downloads/) Requests are ready to use in collections so you can use it in order to test the API.
You can find two ways to start the project below.
First way;
- Clone the repo
https://github.com/ckaraboran/Boilerplate-new.git
- Find the Boilerplate.Api folder and run the project
C:\Projects\Boilerplate\Presentation\Boilerplate.Api>dotnet run
Second way;
There are endpoints for dummies in order to add, update, delete and get them by using database. You can find the related endpoints below.
(GET) {https://localhost:5001/api/dummy
(GET) https://localhost:5001/api/dummy/1
(POST) https://localhost:5001/api/dummy
(PUT) https://localhost:5001/api/dummy
(DELETE) https://localhost:5001/api/dummy/1
There are two ways to use the endpoints of the Boilerplate Api. The first way is to use Swagger which is integrated to API. The second way is to use Postman collections. The requests are ready to use in Postman collections.
Swagger
You can see the details about the requests by clicking the endpoint like below. You should execute after setting the request.
Postman
There are environment and collection files under docs/postman folder. You should import them to your Postman workspace by applying the steps in https://learning.postman.com/docs/getting-started/importing-and-exporting-data/.
After that, you can work on endpoints by modifying the requests.
There no business rules in Boilerplate API.
As you can see in the beginning of document, the project is integrated to Sonarqube Cloud. You can find the statistics of code smells, vulnerabilities, security hotspots and bugs. You can check the Sonarqube dashboard via https://sonarcloud.io/project/overview?id=ckaraboran_Boilerplate-new
You can find a couple of advices below in order to make the Insurance API better.
- Adding NewRelic (free) to show the logs in console and txt file (maybe Sentry integration)
- Adding fluent validation
- Adding mock library to put all mock objects into one place
- Adding Swagger specifications
- Adding summary comments
- Adding versioning
- Adding integration tests
- Adding more tests in Postman
- Adding audit log
- Adding custom ApiResponse object
- Adding rate limiting (HTTP 429 status code will be returned)
- Adding open telemetry
- Adding Elastic APM integration for monitoring about API
- Adding MediatR library in order to apply CQRS before the project getting bigger
- Adding cloud features
- Adding cancellation tokens
- Adding caches
- Checking Microsoft documents for performance tips (https://docs.microsoft.com/en-us/dotnet/api/system.threading.cancellationtoken?view=net-6.0)
- Adding Dockerfile
- Adding helm charts
- Adding Kubernetes deployment
And of course, we can enrich the project with many things more...