Welcome to the "Let's Build It: URL Shortener in .NET" course on Dometrain! This course takes you on a journey through building a production-ready URL Shortener system from conception to production. This repository contains the source code for the course, which you can use to follow along.
The main branch contains the most up-to-date version of the code, reflecting the latest improvements, updates, and fixes. If you're following along with the course, the final version of the code for each section is available on its corresponding branch. Below is the link to each section. You can switch to any section branch to access the exact code snapshot for that course part.
- 4 - Development Environment and Continuous Integration
- 5 - Infrastructure as Code
- 6 - Managing Secrets
- 7 - Developing the URL Shortening Feature
- 8 - Generating Unique Tokens
- 9 - Implementing Authentication
- 10 - Implementing URL Redirection
- 11 - Developing URL Listing Feature
- 12 - Building the Client Web Application
- 13 - Exercise
- 14 - Implementing Health Checks
- 15 - Setting Up Telemetry
- 16 - Integrating Azure Front Door
- 17 - Implementing Network Security
This course aims to build the foundations of a globally scalable application. For that, it uses expensive Azure technology and features unavailable on the free tiers. The cost will naturally increase as the course progresses and we add more resources. So, it's progressively more costly. Also, during the course, we demo how to build 3 environments, which will increase the costs.
If you want to run and deploy the code while minimising the costs, we have some recommendations for you:
- Take advantage of Azure Free offers:
- Azure free account
- CosmosDB 30-day free offering
- Add the
enableFreeTier: true
property to the bicep module.
- Add the
- Microsoft Entra Free Trial
- Use a single environment. On the GitHub actions workflows, comment out the Jobs that deploy resources to Staging (stg) and Production (prd).
- While you are not taking the course, delete the resource group. It's easy to recreate once you are back to it since we are using infrastructure as code.
- Regularly review Azure Cost Management reports.
- Set up budget alerts.
https://learn.microsoft.com/en-us/cli/azure/
az login
az group create --name dometrain-urlshortener-dev --location westeurope
az deployment group what-if --resource-group dometrain-urlshortener-dev --template-file infrastructure/main.bicep
az deployment group create --resource-group dometrain-urlshortener-dev --template-file infrastructure/main.bicep
az ad sp create-for-rbac --name "GitHub-Actions-SP" \
--role contributor \
--scopes /subscriptions/89518450-6f9c-4039-8834-c5bab3ad3e92 \
--sdk-auth
az ad sp create-for-rbac --name "GitHub-Actions-SP" --role 'infra_deploy' --scopes /subscriptions/89518450-6f9c-4039-8834-c5bab3ad3e92 --sdk-auth
https://learn.microsoft.com/en-us/azure/role-based-access-control/troubleshooting?tabs=bicep
az webapp deployment list-publishing-profiles --name api-piza2nvlxc5jg --resource-group dometrain-urlshortener-dev --xml
az staticwebapp secrets list --name web-app-piza2nvlxc5jg --query "properties.apiKey"
- Base62 converter: https://math.tools/calculator/base/10-62