← Back to Docs
Recipe

Dashboard insights generator

Build a real-time analytics pipeline that queries Meridian telemetry, aggregates session metrics, and renders summary cards on your dashboard. This recipe covers the full loop — from raw event ingestion to polished UI.

Prerequisites

  • Meridian project with telemetry enabled
  • API key with read:events scope
  • Node.js 18+ and a React dashboard shell

Step 1 — Query recent sessions

Use the Meridian Events API to pull the last 24 hours of session starts. Filter by event type and group by license key.

GET /v1/events?type=session.start&range=24h
Authorization: Bearer <api_key>

Step 2 — Aggregate metrics

On the client, reduce the response into daily active users, average session length, and peak concurrency. Store the result in a lightweight state atom.

const metrics = events.reduce((acc, e) => {
  acc.dau.add(e.license);
  acc.totalDuration += e.duration;
  return acc;
}, { dau: new Set(), totalDuration: 0 });

Step 3 — Render insight cards

Map each aggregated metric to a card component. Use Tailwind gradients to highlight trend direction.

DAU

Avg Session

Peak Concurrent

Next steps

Add a refresh interval with setInterval or wire up a WebSocket for live updates. Explore the Events API reference for additional filters.