Generate interactive web dashboards fed by real-time data from multiple APIs: store sales, Google Analytics metrics, server status, business KPIs. Chart.js with automatic auto-refresh without page reload.
Create a web dashboard with Bootstrap 5.3 and Chart.js for the business:
Real-time KPIs (update every 60 seconds):
- Today's sales (£ and number of orders)
- Active website visitors (Google Analytics API)
- Server status (ping to /health endpoint)
- Critical stock (products with stock < 5)
Charts: last 30 days sales (line), sales by category this week (bars), conversion funnel
Visual alerts: red if today's sales < 50% of target; red if stock = 0
Design: dark mode, corporate blue/orange colors, responsive for monitor and tablet
async function updateDashboard() {
const [sales, analytics, server, stock] = await Promise.all([
fetch('/api/sales/today').then(r => r.json()),
fetch('/api/analytics/active').then(r => r.json()),
fetch('/api/server/health').then(r => r.json()),
fetch('/api/stock/critical').then(r => r.json())
]);
renderKPIs({ sales, analytics, server, stock });
checkAlerts({ sales, server, stock });
}
updateDashboard();
setInterval(updateDashboard, 60_000);