# New ASP.NET Core API project checklist
This document can be used as a checklist of items to do when creating ASP.NET Core API projects. With some modifications, it can be suited for other project types too.
## Choose the project template
There are a number of choices here. Choose the one that suits you, i.e.:
- Default ASP.NET Core templates (Empty, Web API, MVC...)
- [ASP.NET Core API Boxed](https://github.com/Dotnet-Boxed/Templates) is an excellent, partially opiniated choice, with a lot of boilerplate code provided
- [Jason Taylor's Clean Architecture](https://github.com/jasontaylordev/CleanArchitecture) template is great, but strongly opinionated
- [ASP.NET Boilerplate](https://github.com/aspnetboilerplate/aspnetboilerplate) is another popular, but strongly opinionated, option
## Prepare the project
- [ ] Name the project, i.e. `MyProject`
- [ ] Define the project root namespace and use it as a namespace prefix in all classes, i.e. `MyCompany.MyProject`
- [ ] Organize the project folder
- [ ] Use David Fowler's [.NET project structure](https://gist.github.com/davidfowl/ed7564297c61fe9ab814)
- [ ] `src` folder contains the main project code
- [ ] `tests` folder contains automated tests (unit, integration, UI...)
- [ ] `docs` folder contains documentation, markdown files, etc.
- [ ] `build` folder contains build scripts (MSBuild, shell, PowerShell, etc.)
- [ ] `artifacts` folder contains build output (not included to source control)
- [ ] `lib` folder contains dependencies that are not available as NuGet packages
- [ ] Root folder contains the solution file
- [ ] Add `.gitignore` file to the root folder
- Generate it using `dotnet new gitignore`
- Generate it using [gitignore.io](https://gitignore.io/)
- Or download from [GitHub](https://github.com/github/gitignore)
- [ ] Add `.gitattributes` file to the root folder
- Download from [GitHub](https://github.com/alexkaratarakis/gitattributes)
- [ ] Add README.md file to the root folder, with the short project description
- [ ] Add LICENSE file to the root folder
- [Choose an open source license](https://choosealicense.com/) if the project is open source
- [tl;dr Legal](https://tldrlegal.com/) to learn more about specific licenses
- [Generate license text](https://www.binpress.com/license-generator/) for closed source licenses
## Initialize source control
- [ ] Create a project on Git server (GitHub, BitBucket, Azure DevOps...)
- [ ] Do `git init` in root folder
- [ ] Add origin with `git remote add origin <url>`
- [ ] Commit and push the first version
- `git checkout main`
- `git commit -m "chore: initial version"`
- `git push origin main`
## Define conventions
- [ ] Define backend code conventions
- [ ] Add `.editorconfig` file with conventions
- Basic functionality - https://editorconfig.org/
- Learn more about [.NET code style additions](https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/code-style-rule-options)
- Use [Muhammad Rehan Saeed's](https://github.com/RehanSaeed/EditorConfig) or [Roslyn's](https://github.com/dotnet/roslyn/) `.editorconfig` file as base
- Use Visual Studio 2019+ and JetBrains Rider editors to tweak
- [ ] Add `Directory.build.props` file to root folder
- [ ] Add Roslyn analyzers as `PackageReference`s to `Directory.build.props`, to enforce conventions in all projects
- Use StyleCop.Analyzers, SonarAnalyzer.CSharp, Roslynator, StyleChecker...
- [ ] Define frontend conventions
- [ ] Define git conventions
- [ ] Define branching strategy (feature branches, trunk based, etc.)
- [ ] Enforce push rules on server
- i.e. no direct push to `main` branch
- [ ] Enforce code review rules on server
- i.e. require at least one reviewer for each pull request
- [ ] Introduce [Conventional Commits](https://www.conventionalcommits.org/)
- [ ] *Optionally* include task number in commit messages
## Improve README.md file
Add the following:
- [ ] Project architecture description
- [ ] Project URLs
- test environment URL, issue management URL, external documentation URL...
- [ ] Getting started for developers
- [ ] dependencies
- [ ] project configuration
- [ ] how to build the project, etc.
- [ ] Conventions description (if necessary)
- [ ] Description of the environments
- [ ] Deployment scenarios
*Note: Some of those can be added as separate files in `docs` folder and referenced from the main `README.md` file.*
## Prepare the test project(s)
...
## Prepare automated builds
...