Small url shortener application using Minimal APIs & following vertical slice architecture. The application makes use of the following packages:
Entity Framework Core- for data accessMediatR- for request handling & request middlewareFluentValidation- for validationXUnit- for unit & integration testsNSubstitute- for mockingAutoFixture- for creating test data
The application uses exception middleware & RequestPreProcessors (from MediatR) in order to simplify & minimize code duplication in the control flow of the api responses. However, the result pattern could have also been used.
Here is the list of things to do:
- Add output caching for read urls?
- Add auth for UrlMetadata management endpoints (either via azure active directory or Entity framework + identity)
- Add open telemetry
- Add automatic expiration of urls (e.g., after 6 months)
To add a migration to the Url.Shortener.Data.Migrator project do the following:
- Go to base path (
/) of the project - Run command
dotnet ef migrations add <migrationName> --startup-project tools\Url.Shortener.Data.Migrator\- make sure to replace<migrationName>with your actual migration name
- Run
docker-compose up -din the base folder of the project - Make sure to run the
Url.Shortener.Data.Migratorlocated in thetoolsfolder pointing to the docker db (update appsettings for this or user secrets), so that the db gets initialized. - Open
localhost:30001/swaggerto view the swagger ui - Open
localhost:30004to view the Seq ui
Note: docker-compose is meant to be used to only provide the required infrastructure locally.