Cloud

Operational Dashboard

Auto-refreshing monitoring dashboard with Prometheus metrics and health status.

1 min readDocumentationEdit this page

Overview

The dashboard serves a responsive, self-contained HTML page that displays real-time service health, uptime, and Prometheus metrics. It fetches data from your existing /health and /metrics endpoints.

Usage

typescript
import { createDashboard } from '@axiljs/cloud'
 
app.get('/dashboard', createDashboard({
  title: 'My Cloud Console',
  metricsEndpoint: '/metrics',
  healthEndpoint: '/health',
  refreshMs: 5000,
}))

Options

OptionTypeDefaultDescription
titlestring'AxilJS Cloud Dashboard'Page title
metricsEndpointstring'/metrics'URL to fetch Prometheus metrics
healthEndpointstring'/health'URL to fetch health JSON
refreshMsnumber5000Auto-refresh interval (min 1000)

Security

The dashboard includes built-in security headers:

  • Content-Security-Policy — restricts script and style sources
  • X-Frame-Options: DENY — prevents clickjacking
  • X-Content-Type-Options: nosniff — prevents MIME sniffing
  • All dynamic content is HTML-escaped to prevent XSS

Production Deployment

Mount the dashboard behind authentication in production:

typescript
import { authenticate, requireRole } from '@axiljs/auth'
 
app.get(
  '/dashboard',
  authenticate(jwt),
  requireRole('admin'),
  createDashboard({ title: 'Admin Dashboard' })
)

Help improve the documentation

AxilJS is open source and documentation improvements are welcome.

AxilJS DocumentationMIT License · Built by SyntaxilitY