An internal dashboard that answers the team's top five questions at a glance, loads fast, and animates without layout shift.
Recommended stack
- Next.js (server components) - app. Aggregate on the server, ship rendered numbers, hydrate only the charts.
- Recharts - charts. Composable React charts that handle responsive containers well.
- Postgres RPCs (security definer) - aggregation. One round-trip returning a jsonb rollup beats N client queries every time.
- framer-motion - micro-motion. Opacity/transform entrances only - animation must never reflow layout.
Build steps
- Interview for the five questions the dashboard must answer; design one panel per question, nothing else.
- Write one RPC returning the whole rollup as jsonb (totals, series, tops) - aggregate in SQL, not JS.
- Fix every chart container's height up front; render skeletons in the same boxes while loading.
- Animate entrances with opacity/translate only; respect prefers-reduced-motion.
- Add a date-range switcher that re-fetches the single RPC; keep state in the URL.
Watch out for
- Charts in auto-height containers - every load jitters the page.
- Fetching raw rows to the client and aggregating in JS.
- Twelve panels nobody reads burying the five that matter.
Definition of done
- Zero cumulative layout shift while data loads
- Date-range change updates every panel in one request
- The team's five questions answered without clicking