A dedicated API backend for the nSelf Admin UI. Aggregates metrics from Postgres, Hasura, and Prometheus into a single set of endpoints covering system health, active sessions, storage breakdown, audit logs, and real-time dashboard data. Used by the nself-admin companion app.
Set your license key with nself license set nself_pro_... before installing. Installed automatically when you run nself admin start with a pro license.
nself license set nself_pro_...
nself plugin install admin-api
nself build
nself start| Env Var | Required | Description |
|---|---|---|
DATABASE_URL | Yes | PostgreSQL connection string |
ADMIN_API_PLUGIN_PORT | No | HTTP port (default: 3212) |
PROMETHEUS_URL | No | Prometheus base URL for metrics scraping |
ADMIN_API_CACHE_TTL | No | Cache TTL for aggregated metrics in seconds (default: 30) |
ADMIN_API_WS_ENABLED | No | Enable WebSocket for real-time dashboard updates (default: false) |
CORS_ALLOWED_ORIGIN | No | Allowed CORS origin for the admin UI (default: http://localhost:3021) |
curl http://127.0.0.1:3212/metrics \
-H "Authorization: Bearer $NSELF_API_KEY"curl http://127.0.0.1:3212/stats \
-H "Authorization: Bearer $NSELF_API_KEY"curl "http://127.0.0.1:3212/audit?limit=50&action=login" \
-H "Authorization: Bearer $NSELF_API_KEY"source_account_id| Endpoint | Method | Description |
|---|---|---|
/metrics | GET | Current system metrics snapshot |
/metrics/history | GET | Historical metrics over time |
/metrics/snapshot | POST | Force an immediate metrics snapshot |
/stats | GET | Active sessions, user counts, request rates |
/health | GET | Plugin health check |
/health/services | GET | Health status of all nSelf services |
/logs | GET | Recent system log entries |
/audit | GET, POST | Read or write audit log entries |
/dashboard | GET, PUT | Read or save dashboard configuration |
nself plugin remove admin-apiCategory: Infrastructure | Tier: Pro | Port: 3212 | Last Updated: April 2026 | Plugin Version 1.1.1