A modern, interactive dashboard for tracking multiple global diseases including COVID-19, Influenza, Mpox, Malaria, and Dengue. Built with React 19, TypeScript, and real-time data integration.
Production URL: https://global-disease-tracker-ws0794eak-pranoybasus-projects.vercel.app
View the live application deployed on Vercel with automatic HTTPS, CDN distribution, and global edge network.
- COVID-19: Real-time data from disease.sh API
- Influenza: Mock data with realistic patterns
- Mpox: Simulated outbreak tracking
- Malaria: Endemic disease monitoring
- Dengue: Seasonal outbreak data
- πΊοΈ Interactive Leaflet Map with disease-specific markers
- π Real-time Statistics with animated stat cards
- π¨ Disease-Specific Color Schemes for visual clarity
- π Smooth Animations using Framer Motion
- π± Responsive Design for mobile, tablet, and desktop
- Momentum Tracking: 24-hour, 3-day, and 7-day case trends
- Population Normalization: Per-million population metrics
- Projected Cases: AI-powered case projections
- Multiple Map Styles: Light, color, and dark themes
- Logarithmic/Linear Scaling: Flexible data visualization
- Collapsible Control Panel: Clean, organized interface
- Detailed Statistics Pages: In-depth analysis with charts and tables
- Multi-Format Export: Export data as PDF, PNG, CSV, or JSON
- Advanced Filtering: Search, sort, and filter country data
- Interactive Charts: Bar, line, and area charts with Recharts
- Shareable URLs: Copy links to specific disease metrics
| Category | Technology | Version | Purpose |
|---|---|---|---|
| Framework | React | 19 | UI library with concurrent features |
| Language | TypeScript | 5.9 | Type-safe development |
| Build Tool | Vite | 7.1 | Fast HMR and optimized builds |
| Styling | Tailwind CSS | v4 | Utility-first CSS with custom theme |
| UI Components | Shadcn/ui | Latest | Accessible Radix UI components |
| State Management | Zustand | 5.0 | Client state with localStorage |
| Server State | TanStack Query | 5.90 | Data fetching and caching |
| Animations | Framer Motion | 12.23 | Declarative animations |
| Maps | Leaflet + React-Leaflet | 1.9.4 / 5.0.0 | Interactive mapping |
| HTTP Client | Axios | 1.13 | API requests with retry logic |
| Routing | React Router | 7.9 | Client-side routing |
| Charts | Recharts | 2.15 | Composable charting library |
| PDF Export | jsPDF | 2.5 | PDF document generation |
| Image Export | html2canvas | 1.4 | DOM to canvas conversion |
| Notifications | Sonner | 1.7 | Toast notifications |
| Testing | Vitest | 4.0.6 | Unit testing framework |
| Icons | Lucide React | 0.552.0 | Beautiful icon library |
global-disease-tracker/
βββ src/
β βββ components/ # React components
β β βββ ui/ # Shadcn UI components
β β β βββ card.tsx
β β β βββ select.tsx
β β β βββ toggle.tsx
β β β βββ slider.tsx
β β β βββ skeleton.tsx
β β β βββ button.tsx
β β β βββ input.tsx
β β β βββ table.tsx
β β β βββ dialog.tsx
β β β βββ tabs.tsx
β β βββ DiseaseMap.tsx # Interactive Leaflet map
β β βββ DiseaseStatsCard.tsx # Animated statistics cards
β β βββ DiseaseSelector.tsx # Disease selection dropdown
β β βββ CollapsibleControlPanel.tsx # Collapsible sidebar
β β βββ CountryDataTable.tsx # Sortable data table
β β βββ CountryComparisonChart.tsx # Bar/Line/Area charts
β β βββ MetricDistributionChart.tsx # Pie/Donut charts
β β βββ ExportModal.tsx # Multi-format export dialog
β β βββ ErrorBoundary.tsx # Error handling component
β β
β βββ pages/ # Route pages
β β βββ DetailedStatsPage.tsx # Detailed statistics view
β β
β βββ config/ # Configuration files
β β βββ diseases.ts # Disease metadata and color schemes
β β βββ routes.tsx # React Router configuration
β β
β βββ services/ # Business logic and APIs
β β βββ api/
β β β βββ diseaseApi.ts # Unified disease API (Adapter Pattern)
β β β βββ covidApi.ts # COVID-19 API integration
β β β βββ apiClient.ts # Axios client with retry logic
β β β βββ queryClient.ts # TanStack Query configuration
β β β
β β βββ algorithms/
β β β βββ momentumCalculations.ts # Trend calculations
β β β βββ containmentScore.ts # Disease metrics
β β β βββ __tests__/ # Algorithm tests
β β β
β β βββ mockData/
β β βββ influenzaMockData.ts
β β βββ mpoxMockData.ts
β β βββ malariaMockData.ts
β β βββ dengueMockData.ts
β β
β βββ store/ # State management
β β βββ appStore.ts # Zustand store with persistence
β β
β βββ types/ # TypeScript definitions
β β βββ index.ts # Shared type definitions
β β
β βββ test/ # Test utilities
β β βββ setup.ts # Vitest configuration
β β
β βββ App.tsx # Main application component
β βββ main.tsx # Application entry point
β βββ index.css # Global styles and Tailwind imports
β
βββ public/ # Static assets
βββ docs/ # Documentation
β βββ API_INTEGRATION.md # API integration guide
β βββ DISEASE_DATA_SOURCES.md # Data source documentation
β
βββ package.json
βββ tsconfig.json # TypeScript configuration
βββ vite.config.ts # Vite configuration
βββ tailwind.config.js # Tailwind CSS configuration
βββ postcss.config.js # PostCSS configuration
βββ vitest.config.ts # Vitest test configuration
The application uses an adapter pattern to abstract data sources, allowing seamless switching between real APIs and mock data:
// Unified API interface
export function useDiseaseData(disease: Disease) {
return useQuery({
queryKey: ['disease', disease],
queryFn: async () => {
// Adapter selects appropriate data source
if (disease === 'covid19') {
return await fetchCovidData(); // Real API
} else {
return generateMockData(disease); // Mock data
}
}
});
}Benefits:
- Easy to add new diseases
- Simple migration from mock to real data
- Consistent data structure across all diseases
- Testable with mock data
Reusable, composable components for maintainability:
<DiseaseStatsCard
title="Total Cases"
value={globalStats?.cases || 0}
icon={Activity}
disease={selectedDisease}
/>Disease configurations use const assertions for type safety:
export const diseaseConfigs = {
covid19: {
name: 'COVID-19',
colors: { primary: 'rgb(239, 68, 68)', ... },
icon: Activity,
// ...
}
} as const;
export type Disease = keyof typeof diseaseConfigs;- Zustand: Client state (disease selection, preferences) with localStorage persistence
- TanStack Query: Server state (API data) with automatic caching and revalidation
- React State: Component-local UI state (form controls, toggles)
Graceful error handling at multiple levels:
- Top-level boundary in
main.tsx - Component-level boundaries around critical sections (map, charts)
- Custom fallback UIs that maintain layout integrity
- Node.js 18+ and npm/yarn
- Modern browser with ES2022 support
# Clone the repository
git clone https://github.com/yourusername/global-disease-tracker.git
cd global-disease-tracker
# Install dependencies
npm install
# Start development server
npm run devThe application will be available at http://localhost:5173
# Create optimized production build
npm run build
# Preview production build
npm run previewThe homepage (/) displays:
- Interactive world map with disease markers
- Global statistics cards (Total Cases, Deaths, Recovered, Active)
- Top 10 affected countries
- Disease selector and control panel
Click any statistic card to navigate to detailed analysis:
- Route pattern:
/stats/:disease/:metric - Example:
/stats/covid19/total-cases - Features: Charts, tables, filters, and export options
Use the disease selector dropdown in the collapsible control panel to switch between different diseases. The entire UI updates with disease-specific colors and data.
- Display Mode: Choose between cumulative cases or momentum (24h, 3-day, 7-day trends)
- Map Style: Switch between light, color, and dark map themes
- Population Normalized: View cases per million population
- Marker Size: Adjust the size of disease markers on the map
-
Country Comparison Chart:
- View top 10 countries by metric
- Switch between Bar, Line, and Area chart types
- Responsive sizing for all devices
- Hover tooltips with detailed data
-
Metric Distribution Chart:
- Continental breakdown with Pie or Donut charts
- Percentage and absolute values
- Color-coded by continent
- Search: Filter countries by name
- Sort: Click column headers to sort ascending/descending
- Filter by Continent: Dropdown to filter specific regions
- Pagination: Navigate through large datasets (10/25/50/100 rows per page)
- Responsive: Optimized for mobile and desktop viewing
Click the "Export" button on any detailed stats page to access export options:
-
PDF Export π
- Professional document with charts and tables
- Includes metadata (disease, metric, timestamp)
- Automatically formatted and sized
- Use case: Reports, presentations, documentation
-
PNG Export πΌοΈ
- High-resolution image (2x scale)
- Captures entire page including charts
- Perfect for social media or quick sharing
- Use case: Screenshots, visual sharing
-
CSV Export π
- Spreadsheet-compatible format
- Headers: Country, Continent, Value
- Easy import into Excel, Google Sheets
- Use case: Data analysis, further processing
-
JSON Export πΎ
- Structured data format
- Includes metadata and full dataset
- Programmatic access and integration
- Use case: APIs, data pipelines, custom analysis
-
Share Link π
- Copies current page URL to clipboard
- Shareable with colleagues and teams
- Preserves disease and metric selection
- Use case: Collaboration, bookmarking
Files are automatically named with the pattern:
{disease}-{metric}-{timestamp}.{extension}
Example: covid19-total-cases-2025-01-04.pdf
- Markers on Map: Size proportional to case count (or normalized rate)
- Stat Cards: Show total cases, deaths, recoveries, and active cases with 7-day trends
- Top 10 Countries: Ranked by active cases (descending order)
- Chart Colors: Disease-specific theming for visual consistency
# Run unit tests
npm run test
# Run tests in watch mode
npm run test:watch
# Generate coverage report
npm run test:coverageCurrent test coverage includes:
- Algorithm correctness (momentum, containment scores)
- Component rendering
- API integration logic
- API Integration Guide - How to add real disease APIs
- Disease Data Sources - Available data sources for each disease
- Update Type Definition in
src/types/index.ts - Add Configuration in
src/config/diseases.ts - Create Mock Data Generator in
src/services/mockData/ - Update API Adapter in
src/services/api/diseaseApi.ts - Add Tailwind Colors in
tailwind.config.js
See API_INTEGRATION.md for detailed instructions.
Disease-specific colors are defined in src/config/diseases.ts:
colors: {
primary: 'rgb(239, 68, 68)', // Main theme color
secondary: 'rgb(254, 202, 202)', // Accent color
bg: 'bg-red-50', // Background class
text: 'text-red-700', // Text color class
border: 'border-red-200' // Border color class
}Create a .env file for API configuration:
VITE_COVID_API_URL=https://disease.sh/v3/covid-19
VITE_ENABLE_MOCK_DATA=false
VITE_API_RETRY_ATTEMPTS=3The project uses strict TypeScript settings:
strict: trueverbatimModuleSyntax: trueerasableSyntaxOnly: true
Contributions are welcome! Please follow these guidelines:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Use TypeScript for all new code
- Follow ESLint rules (run
npm run lint) - Write tests for new features
- Use meaningful commit messages
This project is licensed under the MIT License - see the LICENSE file for details.
- disease.sh - COVID-19 data API
- Shadcn/ui - Beautiful UI components
- Leaflet - Interactive mapping library
- Tailwind CSS - Utility-first CSS framework
- TanStack Query - Powerful data synchronization
For questions or support, please open an issue on GitHub.
Built with β€οΈ using React, TypeScript, and modern web technologies