Dashboard Stats API
GET /api/stats
Section titled “GET /api/stats”Requires Authorization: Bearer <token> and ADMIN or MANAGER role.
Returns aggregated dashboard metrics derived from the users table.
{ "cards": { "totalUsers": 12, "adminCount": 2, "managerCount": 3, "memberCount": 7, "recentSignups": 4, "signupChangePct": 33.3 }, "usersByRole": [ { "label": "Admin", "value": 2 }, { "label": "Manager", "value": 3 }, { "label": "Member", "value": 7 } ], "userGrowth": [ { "label": "Mar '26", "value": 2 }, { "label": "Apr '26", "value": 5 } ], "systemStatus": [ { "id": "users", "metric": "Registered users", "value": "12", "status": "active" }, { "id": "api", "metric": "API health", "value": "OK", "status": "active" } ]}Field notes
Section titled “Field notes”| Field | Description |
|---|---|
cards.recentSignups | Users created in the last 7 days |
cards.signupChangePct | Week-over-week signup change; null when prior week had zero signups |
userGrowth | Monthly signup counts for the last 6 months |
systemStatus | Summary rows for the dashboard status table |
The frontend consumes this endpoint via typed Hono RPC:
const res = await apiClient.api.stats.$get();