.NET API (Coderz REST API)
URL: http://109.199.120.120:5050 Technology: ASP.NET Core Database: PostgreSQL (coderz-db, port 5433) The .NET API is the primary backend service of the Coderz Stack. It serves as the main REST API, backed by PostgreSQL, with full Prometheus metrics exposure, structured logging to ELK, and load testing coverage via k6.Endpoints
| Method | Path | Description |
|---|---|---|
GET | /api/items | List all items (supports ?page=N) |
GET | /api/items/{id} | Get a single item by ID |
POST | /api/items | Create a new item |
PUT | /api/items/{id} | Update an item |
DELETE | /api/items/{id} | Delete an item |
GET | /metrics | Prometheus metrics endpoint |
GET | /health | Health check endpoint |
Metrics Exposed to Prometheus
The .NET API uses theprometheus-net library to expose:
Grafana Dashboard: .NET API Full Stack
| Panel | What It Shows |
|---|---|
| Request Rate | Requests per second, by endpoint |
| Error Rate | 4xx and 5xx responses per minute |
| Response Time | P50, P95, P99 latency percentiles |
| Active Requests | Currently in-flight requests |
| PostgreSQL Queries | Query count and duration |
| Live Request Log | Live Loki log stream of every request |
Structured Log Format
Every request logs a structured JSON entry:k6 Load Test Scenarios
| Scenario | Description |
|---|---|
dotnet-items | Paginated GET /api/items — simulates read traffic |
dotnet-crud | GET + POST + PUT cycle — simulates full CRUD |
dotnet-mixed | All endpoints mixed — simulates realistic traffic |
dotnet-stress | Step ramp-up to find breaking point |
Database Connection
The .NET API connects to PostgreSQL with:- Host:
coderz-db(Docker internal) - Port:
5433 - Database:
coderapi - User:
coderapi - Password:
coderapi_2024