Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .github/assets/gifs/DockStatAPI-startup.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/assets/logos/square.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions apps/api/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ DOCKSTAT_LOGGER_ONLY_SHOW=""
DOCKSTAT_LOGGER_IGNORE_MESSAGES="Logger Status: active"
DOCKSTAT_LOGGER_FULL_FILE_PATH=false
DOCKSTAT_API_PORT="3030"
DOCKSTAT_LOGGER_LEVEL="INFO"
2 changes: 2 additions & 0 deletions apps/api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ updatedAt: 2026-01-01T15:02:00.500Z
urlId: gVYlljv3Fs
---

![DockStatAPI Animation](https://raw.githubusercontent.com/Its4Nik/DockStat/refs/heads/DockStatAPI-readme-update/.github/assets/gifs/DockStatAPI-startup.gif)

> The DockStatAPI is implemented with Elysia and exposed under the prefix `/api/v2`. The canonical route definitions are in `apps/api/src/routes/` with schemas in `apps/api/src/models/`.

## Base URL
Expand Down
10 changes: 5 additions & 5 deletions apps/dockstat/src/lib/actions/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
id: 57802308-6a42-4d47-82b6-bc553ae10e9c
title: "Frontend: actions"
title: "Frontend: Actions"
collectionId: b4a5e48f-f103-480b-9f50-8f53f515cab9
parentDocumentId: a81b5d89-a300-47ac-8ffa-a3b851645978
updatedAt: 2026-01-01T14:27:30.440Z
updatedAt: 2026-01-01T20:40:03.579Z
urlId: 0tWEK43tNb
---

Expand Down Expand Up @@ -34,9 +34,9 @@ export async function updateProfile(input: UpdateProfileInput) {
})

if (error) {
throw new Error(extractEdenError({ data, error }))
throw new Error(String(error.value))
}

return data
}
```
Expand Down Expand Up @@ -90,4 +90,4 @@ export function ProfileForm() {
* Always `throw` on API errors (React Query will surface it in `mutation.error`)
* Keep **UI concerns out** of actions (no toasts, no routing, no cache invalidation here)
* Keep input types close to the action
* Return only what the caller needs (don't over-return)
* Return only what the caller needs (don't over-return)
6 changes: 3 additions & 3 deletions apps/dockstat/src/lib/queries/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
id: da3758e1-2d46-4dd5-85c5-eb9d19ee2054
title: "Frontend: queries"
title: "Frontend: Queries"
collectionId: b4a5e48f-f103-480b-9f50-8f53f515cab9
parentDocumentId: a81b5d89-a300-47ac-8ffa-a3b851645978
updatedAt: 2026-01-01T15:02:36.975Z
updatedAt: 2026-01-01T20:40:14.966Z
urlId: wadWIa69wa
---

Expand Down Expand Up @@ -68,4 +68,4 @@ export function Status() {
* Always `throw` on API errors (don't return `{ error }`)
* Return the smallest useful `data` shape
* No UI logic here (no toasts, no redirects)
* Keep `queryKey`s in the component (or optionally export helpers if you standardize keys later)
* Keep `queryKey`s in the component (or optionally export helpers if you standardize keys later)
4 changes: 2 additions & 2 deletions apps/dockstat/src/lib/websocketEffects/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ id: aab7cefb-b84b-4be9-8840-a873b69c6850
title: "Frontend: Websockets"
collectionId: b4a5e48f-f103-480b-9f50-8f53f515cab9
parentDocumentId: a81b5d89-a300-47ac-8ffa-a3b851645978
updatedAt: 2026-01-01T14:28:14.767Z
updatedAt: 2026-01-01T20:39:33.079Z
urlId: vcQwuQaPn0
---

Expand Down Expand Up @@ -78,4 +78,4 @@ new Elysia()

* One effect = one socket.
* Always return a cleanup function so the socket is closed on unmount.
* Keep the effect **pure**: no UI, no toasts, only state synchronization.
* Keep the effect **pure**: no UI, no toasts, only state synchronization.
91 changes: 53 additions & 38 deletions apps/docs/dockstat/api-reference/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ Returns the overall DockerClientManager status, including worker pool metrics.

### Hosts `/docker/hosts`

| Method | Path | Description |
| ------ | ------------------ | --------------------------------- |
| GET | `/hosts/` | List all hosts |
| GET | `/hosts/:clientId` | Get metrics for a specific client |
| POST | `/hosts/add` | Add a new host |
| POST | `/hosts/update` | Update an existing host |
| Method | Path | Description |
|----|----|----|
| GET | `/hosts/` | List all hosts |
| GET | `/hosts/:clientId` | Get metrics for a specific client |
| POST | `/hosts/add` | Add a new host |
| POST | `/hosts/update` | Update an existing host |

**POST** `**/hosts/add**` **body:**

Expand Down Expand Up @@ -119,13 +119,13 @@ Returns the overall DockerClientManager status, including worker pool metrics.

### Client `/docker/client`

| Method | Path | Description |
| ------ | ------------------------------ | ----------------------------- |
| POST | `/client/register` | Register a new Docker client |
| DELETE | `/client/delete` | Remove a client |
| GET | `/client/all/:stored` | List all clients |
| POST | `/client/monitoring/:id/start` | Start monitoring for a client |
| POST | `/client/monitoring/:id/stop` | Stop monitoring for a client |
| Method | Path | Description |
|----|----|----|
| POST | `/client/register` | Register a new Docker client |
| DELETE | `/client/delete` | Remove a client |
| GET | `/client/all/:stored` | List all clients |
| POST | `/client/monitoring/:id/start` | Start monitoring for a client |
| POST | `/client/monitoring/:id/stop` | Stop monitoring for a client |

**POST** `**/client/register**` **body:**

Expand All @@ -148,18 +148,18 @@ Returns the overall DockerClientManager status, including worker pool metrics.

### Containers `/docker/containers`

| Method | Path | Description |
| ------ | --------------------------- | ------------------------------- |
| GET | `/containers/all/:clientId` | Get all containers for a client |
| Method | Path | Description |
|----|----|----|
| GET | `/containers/all/:clientId` | Get all containers for a client |

**Response:** Array of container objects with stats.

### Manager `/docker/manager`

| Method | Path | Description |
| ------ | --------------------------- | --------------------------------- |
| GET | `/manager/pool-stats` | Get worker pool statistics |
| POST | `/manager/init-all-clients` | Initialize all registered clients |
| Method | Path | Description |
|----|----|----|
| GET | `/manager/pool-stats` | Get worker pool statistics |
| POST | `/manager/init-all-clients` | Initialize all registered clients |

## Metrics Routes `/api/v2/metrics`

Expand All @@ -169,10 +169,10 @@ Returns Prometheus-formatted metrics for the API and database.

**Response 200:** Prometheus text format with:

- HTTP request counters
- Request duration histograms
- Database size and table metrics
- Memory usage statistics
* HTTP request counters
* Request duration histograms
* Database size and table metrics
* Memory usage statistics

## Plugin Routes `/api/v2/plugins`

Expand All @@ -199,16 +199,16 @@ sequenceDiagram
API-->>Client: 200 OK
```

| Method | Path | Description |
| ------ | ----------------------- | ---------------------------------------- |
| GET | `/plugins/all` | List all installed plugins |
| GET | `/plugins/hooks` | Get available hook handlers |
| GET | `/plugins/status` | Get plugin system status |
| POST | `/plugins/install` | Install a plugin |
| POST | `/plugins/activate` | Activate plugins by ID |
| POST | `/plugins/delete` | Delete a plugin |
| GET | `/plugins/routes` | List plugin-provided routes |
| ALL | `/plugins/:id/routes/*` | Proxy requests to plugin Elysia instance |
| Method | Path | Description |
|----|----|----|
| GET | `/plugins/all` | List all installed plugins |
| GET | `/plugins/hooks` | Get available hook handlers |
| GET | `/plugins/status` | Get plugin system status |
| POST | `/plugins/install` | Install a plugin |
| POST | `/plugins/activate` | Activate plugins by ID |
| POST | `/plugins/delete` | Delete a plugin |
| GET | `/plugins/routes` | List plugin-provided routes |
| ALL | `/plugins/:id/routes/*` | Proxy requests to plugin Elysia instance |

**POST** `**/plugins/install**` **body:**

Expand Down Expand Up @@ -242,10 +242,10 @@ sequenceDiagram

## Database Routes `/api/v2/db`

| Method | Path | Description |
| ------ | ------------ | ------------------------- |
| GET | `/db/config` | Get current configuration |
| POST | `/db/config` | Update configuration |
| Method | Path | Description |
|----|----|----|
| GET | `/db/config` | Get current configuration |
| POST | `/db/config` | Update configuration |

**POST** `**/db/config**` **body:** Configuration object matching `DockStatConfigTable` schema from `@dockstat/typings`.

Expand Down Expand Up @@ -281,3 +281,18 @@ All routes use a global error handler that returns structured errors:
## Authentication

The current API implementation does not enforce authentication at the route level. For production deployments, add an authentication layer via reverse proxy or Elysia middleware.

## Source Files

| File | Description |
|----|----|
| `apps/api/src/index.ts` | API entry point |
| `apps/api/src/routes/docker/index.ts` | Docker route aggregator |
| `apps/api/src/routes/docker/hosts.ts` | Host management routes |
| `apps/api/src/routes/docker/client.ts` | Client management routes |
| `apps/api/src/routes/docker/container.ts` | Container routes |
| `apps/api/src/routes/docker/manager.ts` | Manager routes |
| `apps/api/src/routes/plugins/index.ts` | Plugin routes |
| `apps/api/src/routes/db.ts` | Database configuration routes |
| `apps/api/src/routes/metrics/prometheus.ts` | Metrics endpoint |
| `apps/api/src/models/*.ts` | Request/response schemas |
Loading
Loading