← All @molecule/* packages · App templates
@molecule/app-status-dashboardCore interface · status-dashboard · App (browser) · v1.0.1 · Apache-2.0
Status page dashboard interface
npm install @molecule/app-status-dashboard@molecule/app-status-dashboard is the status-dashboard core interface on the app (browser) side: the API your app calls, with no vendor inside.
Choose the implementation by bonding one of its 1 provider: @molecule/app-status-dashboard-http.
import { requireProvider, setProvider } from '@molecule/app-status-dashboard'
import { provider } from '@molecule/app-status-dashboard-http'
setProvider(provider) // once, at startup (bonds.ts)
const dashboard = requireProvider()
const config = { apiBaseUrl: '', pollIntervalMs: 30_000 } // '' = same origin
const status = await dashboard.fetchStatus(config)
const stop = dashboard.startPolling(config, (s) => render(s))
// on unmount:
stop()Providers (1): @molecule/app-status-dashboard-http
Works with: @molecule/app-bond, @molecule/app-i18n
Auto-generated, AI-first package reference for the molecule.dev ecosystem. It is written to be read by coding agents as much as by people, and is generated from this package's source — edit
src/index.tsJSDoc, not this file.
Status dashboard core interface for molecule.dev.
Framework-agnostic contract for status pages / uptime dashboards: fetching
system status, incidents, and per-service uptime windows, plus polling with
change callbacks. Bond a provider (e.g. @molecule/app-status-dashboard-http,
which reads a status REST API) at startup, then call {@link requireProvider}
anywhere.
import { requireProvider, setProvider } from '@molecule/app-status-dashboard'
import { provider } from '@molecule/app-status-dashboard-http'
setProvider(provider) // once, at startup (bonds.ts)
const dashboard = requireProvider()
const config = { apiBaseUrl: '', pollIntervalMs: 30_000 } // '' = same origin
const status = await dashboard.fetchStatus(config)
const stop = dashboard.startPolling(config, (s) => render(s))
// on unmount:
stop()
core
npm install @molecule/app-status-dashboard @molecule/app-bond @molecule/app-i18n
ServiceUptimeUptime data for a service.
interface ServiceUptime {
serviceId: string
serviceName: string
windows: UptimeWindow[]
}
StatusDashboardConfigConfiguration for the status dashboard.
interface StatusDashboardConfig {
/** Base URL for the status API. Defaults to '' (same origin). */
apiBaseUrl?: string
/** Polling interval in milliseconds. Defaults to 30000. */
pollIntervalMs?: number
/** Custom headers for API requests. */
headers?: Record<string, string>
/** Site name for branding. */
siteName?: string
}
StatusDashboardProviderStatus dashboard provider interface.
interface StatusDashboardProvider {
readonly name: string
/** Fetches the current system status. */
fetchStatus(config: StatusDashboardConfig): Promise<SystemStatus>
/** Fetches recent incidents. */
fetchIncidents(
config: StatusDashboardConfig,
options?: { status?: IncidentStatus; limit?: number },
): Promise<StatusIncident[]>
/** Fetches uptime data for all services. */
fetchUptime(config: StatusDashboardConfig, serviceId?: string): Promise<ServiceUptime[]>
/** Starts polling for status updates. Returns a stop function. */
startPolling(config: StatusDashboardConfig, onUpdate: (status: SystemStatus) => void): () => void
/** Stops all active polling. */
stopPolling(): void
}
StatusDashboardStateReactive state for the status dashboard.
interface StatusDashboardState {
systemStatus: SystemStatus | null
incidents: StatusIncident[]
uptimeData: ServiceUptime[]
isLoading: boolean
error: string | null
lastFetched: string | null
}
StatusIncidentAn incident associated with a service.
interface StatusIncident {
id: string
serviceId: string
serviceName?: string
title: string
description?: string
severity: IncidentSeverity
status: IncidentStatus
startedAt: string
resolvedAt?: string
createdAt: string
updatedAt: string
}
StatusServiceA monitored service with current status.
interface StatusService {
id: string
name: string
url: string
groupName?: string
status: ServiceStatus
latencyMs?: number
lastCheckedAt?: string
}
SystemStatusOverall system status summary.
interface SystemStatus {
status: ServiceStatus
services: StatusService[]
activeIncidents: StatusIncident[]
lastUpdated: string
}
UptimeWindowUptime statistics for a time window.
interface UptimeWindow {
window: '1h' | '24h' | '7d' | '30d' | '90d'
uptimePct: number
totalChecks: number
upChecks: number
avgLatencyMs: number
}
IncidentSeverityIncident severity level.
type IncidentSeverity = 'minor' | 'major' | 'critical'
IncidentStatusIncident resolution status.
type IncidentStatus = 'investigating' | 'identified' | 'monitoring' | 'resolved'
ServiceStatusService operational status.
type ServiceStatus = 'operational' | 'degraded' | 'down' | 'unknown'
getProvider()Retrieves the bonded status dashboard provider, or null if none is bonded.
function getProvider(): StatusDashboardProvider | null
Returns: The bonded status dashboard provider, or null.
hasProvider()Checks whether a status dashboard provider is currently bonded.
function hasProvider(): boolean
Returns: true if a status dashboard provider is bonded.
requireProvider()Retrieves the bonded status dashboard provider, throwing if none is configured.
function requireProvider(): StatusDashboardProvider
Returns: The bonded status dashboard provider.
setProvider(provider)Registers a status dashboard provider as the active singleton.
function setProvider(provider: StatusDashboardProvider): void
provider — The status dashboard provider implementation to bond.| Provider | Package |
|---|---|
| HTTP | @molecule/app-status-dashboard-http |
Peer dependencies:
@molecule/app-bond ^1.0.1@molecule/app-i18n ^1.0.1@molecule/app-bond
@molecule/app-i18n
This is the read-side UI contract only. Your API must serve the
status/incident/uptime endpoints it reads (e.g.
@molecule/api-resource-status-page provides them along with the
monitoring checks). Without a server counterpart there is nothing to fetch.
Stop what you start: {@link StatusDashboardProvider.startPolling}
returns a stop function — call it on unmount/navigation or polls pile up.
stopPolling() kills ALL active polls; use the returned function to stop
just one.
Leave apiBaseUrl relative (default '' = same origin) so the app's HTTP
proxy / environment config decides the host — don't hardcode an absolute
URL into components.
Integration checklist — drive the real status page in the live preview (no mocks), adapt each item to this app's actual screens, and check every box off one by one. A box you can't check is an integration bug to fix — not a skip:
fetchStatus renders as its own
tile/row showing the service name and a status indicator, grouped by
groupName when present — no service silently missing from the page.ServiceStatus: an
operational service shows the up/green treatment, down shows the
down/red treatment, and degraded/unknown each show their own distinct
state — never one uniform color regardless of status.down in the data and the banner flips to down/degraded on the
next fetch — it never stays green while a tile is red.142 ms and each UptimeWindow as a percentage (e.g. 99.98%) for
the selected window (1h/24h/7d/30d/90d) — not 0, NaN, or a placeholder.startPolling
running, change the underlying status and confirm the affected tile AND the
overall banner update on the next poll; navigating away calls the returned
stop function so polls don't pile up.fetchStatus is in flight, and a fetch error surfaces a visible message
(from state.error) — never a blank page or a stale dashboard shown as
fresh.Translation strings are provided by @molecule/app-locales-status-dashboard.