project.cookiecutter provides a streamlined process to setup a web API project with support for OAuth, Azure, and Auditing in both Aspire and Docker modes.
The solution consists of the following projects:
- Base Project (Docker only)
- API
- Abstractions
- Database
- Migrations
- Tests
install Cookiecutter using the following command:
python3 -m pip install --user cookiecutter
You can set up your project in two ways:
GitHub URI: Point to the project.cookiecutter GitHub repository. Local Clone: Clone the project.cookiecutter repository locally and run the command from your machine.
Example command:
cookiecutter {uri/path to project.cookiecutter}
Note: You cannot change the defaults if using the GitHub setup.
If you cloned the repository, you can customize the default settings by editing the .cookiecutterrc file located at the root of the cookiecutter project.
Example command:
cookiecutter {path to project.cookiecutter} --overwrite-if-exists --config-file={ path to the .cookiecutterrc file }
You can create a project in one of two modes: Aspire or Docker. During setup, you’ll be asked whether you want to use Aspire. Selecting "No" defaults to Docker.
When using Aspire mode, you must have OAuth set up and an active Azure subscription. Below is the information you will need to proceed.
OAuth information if using OAuth, You will need to have the following information for all environments:
- Application Name
- Audience
- Domain
Command Line Setup
- Create a directory for your project
- Navigate to the project folder
- Run the command
- Open the solution in Visual Studio
- Run the Hosting project
Cloning Setup
- Clone the
project.cookiecutter
- Create a project directory
- Navigate to the project folder
- Run the command
- Open the solution in Visual Studio
- Run the Hosting project
As of April 4, 2025, Aspire does not support Azure Cosmos DB for MongoDB for deployment. Therefore, an infra folder will be created under the application host project, containing all the Bicep files needed for deployment, including MongoDB.
By default, the MongoDB Bicep file is configured with:
- MongoDB (RU) configuration.
- hidden-workload-type: Development/Testing.
- locationName: East US 2.
By default, the mongo bicep file is configured to use the MongoDB (RU) configuration, with the hidden-workload-type to be 'Development/Testing' and the locationName of 'East US 2'
Refer to the Microsoft documentation for more information.
When using this Mode, you will need to have OAuth and Azure already setup and configured. Below is the information you will need to proceed.
OAuth information If you use OAuth, you will need to have the following information for all environments:
- Application Name
- Audience
- Domain
Azure information If you use Azure, you will need to have the following information:
- Tenant Id
- Subscription Id
- Location
- Key Vault (all environments)
- ex:{projectName}-Staging
- Storage connection string
- Storage container name (all environments)
- ex: {projectName}assetsstaging
- Container Name (all environments)
- ex: staging
- Container Registry Name (all environments)
- ex: cr3hmn6weg7opbk.azurecr.io
- Container User (all environments)
- ex: cr3hmn6weg7opbk
Command Line Setup
- Create a directory for your project
- Navigate to the project folder
- Run the command
- Open the solution in Visual Studio
- Run docker-compose in Debug mode
- If using OAuth, retrieve your OAuth credentials and store them in Manage User Secrets.
Cloning Setup
- Clone the
project.cookiecutter
- Create a project folder
- Navigate to the project folder
- Run the command
- Open the solution in Visual Studio
- Run docker-compose in Debug mode
- If using OAuth, retrieve your OAuth credentials and store them in Manage User Secrets.