Skip to content

Tutorial: Build a Realtime Dashboard

This tutorial builds a small dashboard that shows new records as they arrive, using webhooks to push events to a server that relays them to the browser over WebSockets.

sequenceDiagram
    participant Nimbus
    participant Server as Your Server
    participant Browser

    Nimbus->>Server: POST /webhooks/nimbus (record.created)
    Server->>Server: verify signature
    Server->>Browser: WebSocket message
    Browser->>Browser: update chart

1. Register the webhook

nimbus webhooks create \
  --url https://dashboard.example.com/webhooks/nimbus \
  --events record.created

2. Receive and verify the event

from flask import Flask, request, abort

app = Flask(__name__)

@app.post("/webhooks/nimbus")
def handle_webhook():
    signature = request.headers.get("X-Nimbus-Signature", "")
    if not verify_signature(request.data, signature, WEBHOOK_SECRET): # (1)!
        abort(401)

    event = request.get_json()
    broadcast_to_browser(event)  # push to connected WebSocket clients
    return "", 200
  1. See Webhooks → Verifying signatures for the verify_signature implementation.

3. Push to the browser

Relay each verified event to connected clients over a WebSocket and append it to your chart's dataset client-side.

Done

You now have a live feed of bucket activity. From here, consider bulk-loading historical data to seed the chart on first load — see Bulk Operations.