This project contains the demo version of a Cheetah.WebApi built with .NET 10.
It showcases:
- Produce a message to Kafka
- Consume a message from Kafka
- Query the OpenSearch database
- OAuth2 security model
- Prometheus metrics
- Health checks
Before running this application, ensure the following requirements are met:
Local infrastructure (Kafka and OpenSearch) must be running. These can be started using Docker Compose from the cheetah-development-infrastructure repository.
A topic named cheetahwebapi must be created in Kafka. Create this through Redpanda Console at http://localhost:9898
The project uses NuGet packages from Trifork's GitHub Packages repository. You need a Personal Access Token (PAT) for a GitHub account with access to this repository.
A local HTTPS development certificate is required. Run:
# For Linux/macOS
dotnet dev-certs https -ep ~/.aspnet/https/aspnetapp.pfx -p "password"
dotnet dev-certs https -t
# For Windows (PowerShell)
dotnet dev-certs https -ep "$env:APPDATA/ASP.NET/https/aspnetapp.pfx" -p "password"
dotnet dev-certs https -tEnsure you have Docker Desktop installed and running.
You may need to enable virtualization in your BIOS.
Note: This project uses Linux containers.
- Navigate to Tools → Options
- Find NuGet Package Manager → Package Sources
- Add the following source:
https://nuget.pkg.github.com/trifork/index.json - Click OK
- Restart Visual Studio
- Open NuGet Package Manager and select the new source
- When prompted, enter your GitHub username and use your PAT as the password
Edit your $HOME/.nuget/NuGet/NuGet.Config file (recommended approach using environment variables):
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="github" value="https://nuget.pkg.github.com/trifork/index.json" />
</packageSources>
<packageSourceCredentials>
<github>
<add key="Username" value="%GITHUB_ACTOR%" />
<add key="ClearTextPassword" value="%GITHUB_TOKEN%" />
</github>
</packageSourceCredentials>
</configuration>Set the environment variables:
# Linux/macOS
export GITHUB_ACTOR='<your_github_username>'
export GITHUB_TOKEN='<your_personal_access_token>'
# Windows (PowerShell)
[System.Environment]::SetEnvironmentVariable('GITHUB_ACTOR', '<your_github_username>', [System.EnvironmentVariableTarget]::User)
[System.Environment]::SetEnvironmentVariable('GITHUB_TOKEN', '<your_personal_access_token>', [System.EnvironmentVariableTarget]::User)- Open
src/Cheetah.WebApi.slnin Visual Studio - Restore NuGet packages
- Set
Cheetah.WebApias the startup project - Press F5 to run with debugging or Ctrl+F5 to run without debugging
- Swagger UI (HTTPS): https://localhost:1851/swagger
- Swagger UI (HTTP): http://localhost:1751/swagger
- Health Check: https://localhost:1851/health
- Prometheus Metrics: http://localhost:1861/metrics
- OAuth Simulator: https://localhost:1852/swagger/index.html
This approach is useful when you don't need debugging and want to use fewer resources.
Set environment variables for NuGet authentication:
# Linux/macOS
export GITHUB_ACTOR='<your_github_username>'
export GITHUB_TOKEN='<your_personal_access_token>'
# Windows (PowerShell)
[System.Environment]::SetEnvironmentVariable('GITHUB_ACTOR', '<your_github_username>', [System.EnvironmentVariableTarget]::User)
[System.Environment]::SetEnvironmentVariable('GITHUB_TOKEN', '<your_personal_access_token>', [System.EnvironmentVariableTarget]::User)# Build and start the container
cd src
docker compose up --build
# OR run in detached mode (background)
docker compose up -d --build
# View logs
docker compose logs -f
# Stop the container
docker compose down- Swagger UI (HTTPS): https://localhost:1851/swagger
- Swagger UI (HTTP): http://localhost:1751/swagger
- Health Check: https://localhost:1851/health
- Prometheus Metrics: http://localhost:1861/metrics
For PoC purposes, this application uses an OAuth2 simulator provided by the local infrastructure.