A self-hosted REST API built with ASP.NET Core 8 for monitoring and managing any Docker-based homelab. No hardcoded services — define what to monitor in a JSON file without touching any code.
- Plugin-based monitor system: HTTP health-check and Docker container status included. Easily extensible with custom monitors.
- JWT Bearer authentication to protect all endpoints.
- Swagger UI available in development mode.
- 100% external config:
services.jsondefines what to monitor in your homelab. - Docker-ready: single
docker compose upand you're running.
git clone https://github.com/yourusername/homecore-api.git
cd homecore-apiCreate your secrets file:
cp .env.example .env
# Edit .env with your JWT_KEY and ADMIN_PASSWORDCreate your services config:
mkdir -p config
cp HomeCore.API/config/services.example.json config/services.json
# Edit config/services.json with your servicesdocker compose up -dAPI available at http://localhost:5000.
curl -X POST http://localhost:5000/api/auth/login \
-H "Content-Type: application/json" \
-d '{ "userName": "admin", "password": "your-password" }'Response:
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expiresAt": "2025-01-15T11:00:00Z"
}Use the token in the Authorization: Bearer <token> header for all other endpoints.
Edit config/services.json to define what to monitor:
{
"services": [
{
"name": "Jellyfin",
"type": "http_healthcheck",
"url": "http://jellyfin:8096/health"
},
{
"name": "qBittorrent",
"type": "http_healthcheck",
"url": "http://qbittorrent:8080"
},
{
"name": "Nextcloud",
"type": "docker_container",
"containerName": "nextcloud"
}
]
}| Type | Description | Required field |
|---|---|---|
http_healthcheck |
GET request to URL, healthy if 2xx | url |
docker_container |
Container state via Docker Engine API | containerName |
| Method | Route | Description |
|---|---|---|
POST |
/api/auth/login |
Get JWT token |
GET |
/api/services |
Status of services defined in services.json |
GET |
/api/containers |
List Docker containers (?all=true includes stopped) |
GET |
/api/containers/{id}/stats |
CPU, RAM and network of a container |
GET |
/api/system/metrics |
Host CPU%, RAM% and disk usage |
GET |
/api/system/uptime |
Host uptime |
| Variable | Default | Description |
|---|---|---|
Jwt__Key |
(required) | Secret key for signing JWT tokens |
Jwt__ExpirationMinutes |
60 |
Token lifetime in minutes |
Admin__UserName |
admin |
Admin username |
Admin__Password |
(required) | Admin password |
Docker__Uri |
unix:///var/run/docker.sock |
Docker Engine URI |
ServicesConfigPath |
config/services.json |
Path to services config file |
Plex + Home Assistant + Portainer:
{
"services": [
{ "name": "Plex", "type": "http_healthcheck", "url": "http://plex:32400/identity" },
{ "name": "Home Assistant", "type": "http_healthcheck", "url": "http://homeassistant:8123" },
{ "name": "Portainer", "type": "docker_container", "containerName": "portainer" }
]
}*Full arr stack:
{
"services": [
{ "name": "Sonarr", "type": "http_healthcheck", "url": "http://sonarr:8989/ping" },
{ "name": "Radarr", "type": "http_healthcheck", "url": "http://radarr:7878/ping" },
{ "name": "Prowlarr", "type": "http_healthcheck", "url": "http://prowlarr:9696/ping" },
{ "name": "Bazarr", "type": "docker_container", "containerName": "bazarr" }
]
}| Component | Technology |
|---|---|
| Framework | ASP.NET Core 8 |
| Authentication | JWT Bearer (HS256) |
| Persistence | Dapper + SQLite |
| Docker integration | Docker.DotNet |
| Documentation | Swashbuckle (Swagger UI) |
| Testing | xUnit + Moq |
| Deployment | Docker + Docker Hub |
HomeCore.Entities/ → Shared entities and DTOs HomeCore.DAL/ → Repositories, Dapper, SQLite HomeCore.BLL/ → Services, business logic, monitor plugin system HomeCore.API/ → Controllers, ASP.NET Core configuration HomeCore.Tests/ → Unit tests (xUnit + Moq)
MIT