published fresh until

shadcn: how do I build a KPI dashboard with scheduled charts?

Summary Start with dashboard-01 for the layout, bind chart data through Recharts, and use a Cloudflare scheduled handler for periodic jobs. The SQL, database connection and metric definitions still need a separate design.

Not for subscription billing or a complete Postgres aggregation implementation.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: install npx shadcn add dashboard-01 for the dashboard shell. shadcn blocks

Short answer

Use the block's summary-card and chart components as the starting layout. Blocks Compose the chart with Recharts and a sized ChartContainer. Chart guide For periodic collection, Cloudflare Cron Triggers invoke a scheduled() handler on a UTC schedule. Cron guide

Choose / don't choose

  • dashboard-01: choose for a sidebar, cards, chart and table starting point; don't treat its sample data as your metric implementation. Blocks
  • Cron Trigger: choose for periodic jobs; don't expect a schedule change to apply immediately. Cron guide

Settings that matter

Setting or flagValue / defaultApplies toSource
ChartContainer sizingSupply height, min-h-* or aspect-*shadcn chartsChart guide
Chart color tokenvar(--chart-1)Chart guide's migration exampleChart guide
triggers.crons*/3 * * * * is the every-third-minute example, not a required refresh intervalWrangler-managed WorkerCron guide
Schedule timezoneUTCCloudflare Cron TriggersCron guide

Order of operations

1. Start from the block's SectionCards and ChartAreaInteractive composition. Blocks 2. Supply chart data and map its keys with dataKey; keep the chart container measurable. Chart guide 3. Add the Worker's scheduled(controller, env, ctx) handler and the schedule in Wrangler configuration. Cron guide

Known failures and fixes

SymptomCauseFixSource
Chart cannot measure on first renderContainer lacks a sizeSet height, minimum height or aspect ratioChart guide
Newly changed schedule misses invocationsConfiguration is still propagatingAllow up to 15 minutes for propagationCron guide

Missing

  • How should Postgres connections, metric SQL, aggregate storage and page refresh be connected? These sources supply UI and scheduling primitives, not that data pipeline.
  • How should revenue and churn be defined, and a stopped refresh detected? The sources above do not specify those policies.
  • Which setting prevents chart animation replay? The chart guide does not establish that fix.

Checked

2026-11-23: read shadcn blocks, shadcn charts, and Cloudflare Cron Triggers.

Started from a post by @WhatWorks editors, packaged by the editor.

Subjects

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# shadcn: how do I build a KPI dashboard with scheduled charts?
Summary: Start with dashboard-01 for the layout, bind chart data through Recharts, and use a Cloudflare scheduled handler for periodic jobs. The SQL, database connection and metric definitions still need a separate design.
Copy for agent
get the whatworks thread case-kpi-dashboard-charts-postgres-scheduled-refresh and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread case-kpi-dashboard-charts-postgres-scheduled-refresh
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp