I'll create a comprehensive SaaS analytics dashboard with all the requested features. Let me start by exploring the project structure and then build it out.
Now let me install recharts for the charting library and lucide-react for icons:
Now let me build all the components. I'll start with the data generation utilities, then the components, and finally the main App.
Now let me create the theme context for dark mode:
Now the KPI card component:
Now the chart components:
Now the data table component:
Now the filter bar component:
Now create a sessions/conversion chart for additional variety:
Now let me create the main App component:
Now update the index.html title and add dark mode class support:
Now update the CSS to include dark mode support and some custom styles:
Now let's build the project to check for errors:
The project builds successfully. Let me review the dashboard to make sure everything is well integrated and polish a few details:
Everything looks good. The build succeeded. Let me verify all files are in place:
All components are in place. Here's a summary of what was built:
MetricFlow — SaaS Analytics Dashboard
Architecture
- 14 source files organized into
components/, context/, data/, and utils/ directories
- Built with React 19 + TypeScript + Vite + Tailwind CSS 4 + Recharts + Lucide Icons + date-fns
Features Implemented
🎯 KPI Summary Cards (6 cards)
- Monthly Recurring Revenue, Total Customers, Conversion Rate, Churn Rate, Total Revenue, Active Users
- Each card shows the metric value, percentage change with color-coded trend indicator (green ↑ / red ↓), and a sparkline mini-chart
- Responsive grid: 1 col on mobile → 2 on sm → 3 on lg → 6 on xl
📊 Charts (5 charts with hover tooltips & smooth animations)
- Revenue vs Expenses — Area chart with gradient fills and dashed expense line
- Customer Growth — Grouped bar chart (new vs churned customers)
- MRR & Active Users — Dual-axis line chart with dashed secondary line
- Sessions & Conversion — Composed chart (bars + line overlay)
- Plan Distribution & Revenue Sources — Two donut charts with legends
📋 Sortable & Filterable Data Table
- 50 realistic customer records with company names, plans, MRR, status badges, LTV, health score bars, last active dates
- Click any column header to sort (ascending/descending toggle)
- Search bar for text filtering across name, email, and ID
- Status dropdown filter (All/Active/Trial/Churned)
- Pagination with page controls
- Responsive columns that hide on smaller screens
🔧 Global Filters
- Date Range Picker: 7 days, 30 days, 90 days, 12 months — changes time granularity (daily → weekly → monthly)
- Segment Filter: All Plans, Starter, Professional, Enterprise
- Both filters update ALL views (KPIs, charts, and table) reactively via
useMemo
🌓 Dark Mode Toggle
- Full dark mode with carefully tuned colors for backgrounds, borders, text, badges, charts, and tooltips
- Smooth CSS transitions when toggling
- Auto-detects system preference on load
📱 Fully Responsive
- Mobile-first grid layouts that adapt from 1-column to multi-column
- Sticky filter bar with backdrop blur
- Horizontally scrollable table on small screens
- Wrap-friendly filter controls
✨ Visual Polish
- Rounded-2xl cards with subtle borders and hover lift effects
- Gradient logo and accent colors (indigo/purple/pink palette)
- Live indicator pulse animation
- Custom styled scrollbars and select dropdowns
- Clean typography hierarchy with tracking and weight variations
Files built: src/data/generateData.ts, src/context/ThemeContext.tsx, src/components/KPICard.tsx, src/components/RevenueChart.tsx, src/components/CustomersBarChart.tsx, src/components/DonutChart.tsx, src/components/MRRLineChart.tsx, src/components/DataTable.tsx, src/components/FilterBar.tsx, src/components/SessionsChart.tsx, src/App.tsx, index.html, src/index.css