This solution combines the tutorial Create a minimal API with ASP.NET Core with article Create a web API with ASP.NET Core and MongoDB in order to implement an example of minimal API using MongoDb as database.
Additionaly, Keycloak is used as Authorization Server to secure the minimal API as explained in the StackOverflow post Secure asp net core rest api (with keycloak).
Visual Studio 2022 (latest version) or Visual Studio Code with C# Extension (latest version) and .NET 8.0 SDK
The components of the project can run in containers. The project contains a Dockerfile and a docker-compose file to orchestrate the api, MongoDb repository and Keycloak Authorization Server.
The Mongo image was pulled from Docker Hub and docker-compose uses a volume for MongoDb to be created with docker volume create mongodata
command.
The Keycloak image was pulled from Quai.io and docker-compose uses a volume for Keycloak to be created with docker volume create keycloakdata
command.
The project supports both Visual Studio + Docker Desktop on Windows and VS Code on Linux. For Linux it is needed to install docker and docker-compose using the package manager of chosen distro.