Skip to content

A full-stack COVID-19 tracker built using React and Node.js, fetching real-time global and country-wise statistics

Notifications You must be signed in to change notification settings

angelabera/CoviTrack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

18 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌍 CoviTrack - Real-Time COVID-19 Data Explorer

A modern, interactive web application for exploring real-time COVID-19 statistics from over 200 countries worldwide. Built with React, Express, and styled with premium glassmorphism UI components.

πŸ”— Live Features:

  • Real-time COVID-19 data fetching from global sources
  • Search and explore data by country
  • Interactive, modern UI with smooth animations
  • Responsive design for all devices
  • Professional loading states and animations

πŸ“‹ Table of Contents


✨ Features

Core Features

  • ⚑ Real-Time Data β€” Live COVID-19 statistics updated continuously
  • 🌏 Global Coverage β€” Data for 200+ countries and regions
  • πŸ” Country Search β€” Search any country and view detailed statistics
  • πŸ“Š Interactive Dashboard β€” Beautiful data visualization with charts and cards
  • 🎨 Modern UI β€” Glassmorphism design with smooth animations
  • πŸ“± Responsive Design β€” Works seamlessly on desktop, tablet, and mobile
  • βš™οΈ Loading States β€” Beautiful animated loading screen with blurred hero background
  • 🎯 Interactive Elements β€” Hover effects, animations, and smooth transitions

Data Points

  • Total Cases
  • Active Cases
  • Recovered Cases
  • Deaths

πŸ› οΈ Tech Stack

Frontend

  • React ^19.2.0 β€” UI library
  • Vite ^7.2.4 β€” Build tool and dev server
  • CSS3 β€” Custom styling with glassmorphism, gradients, and animations

Backend

  • Node.js β€” Runtime environment
  • Express ^5.2.1 β€” Web framework
  • Axios ^1.13.4 β€” HTTP client for API calls
  • CORS ^2.8.6 β€” Cross-origin request handling
  • dotenv ^17.2.3 β€” Environment variable management

External APIs

  • COVID-193 RapidAPI β€” Real-time COVID-19 statistics

πŸ“ Project Structure

covitrack/
β”œβ”€β”€ backend/
β”‚   └── server.js              # Express server & API routes
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ Hero.jsx           # Hero section with animations
β”‚   β”‚   β”œβ”€β”€ CountrySection.jsx # Country data search & display
β”‚   β”‚   β”œβ”€β”€ CountryCard.jsx    # COVID stats card component
β”‚   β”‚   β”œβ”€β”€ InsightsSection.jsx # Global insights & info
β”‚   β”‚   β”œβ”€β”€ Footer.jsx         # Site footer with credits
β”‚   β”‚   └── LoadingScreen.jsx  # Animated loading overlay
β”‚   β”œβ”€β”€ styles/
β”‚   β”‚   β”œβ”€β”€ hero-earth.css     # Hero section styles
β”‚   β”‚   β”œβ”€β”€ country-section.css # Search section styles
β”‚   β”‚   β”œβ”€β”€ country-card.css   # Stats card styles
β”‚   β”‚   β”œβ”€β”€ insights-section.css # Insights section styles
β”‚   β”‚   β”œβ”€β”€ footer.css         # Footer styles
β”‚   β”‚   └── loading.css        # Loading screen styles
β”‚   β”œβ”€β”€ App.jsx                # Main app component
β”‚   β”œβ”€β”€ index.css              # Global styles & scrollbar
β”‚   └── main.jsx               # React entry point
β”œβ”€β”€ public/                    # Static assets
β”œβ”€β”€ package.json              # Project dependencies
β”œβ”€β”€ vite.config.js           # Vite configuration
└── README.md                # This file

πŸš€ Installation & Setup

Prerequisites

  • Node.js (v16 or higher)
  • npm or yarn package manager
  • RapidAPI account with COVID-193 API access

Step 1: Clone the Repository

git clone https://github.com/yourusername/covitrack.git
cd covitrack

Step 2: Install Dependencies

# Install all dependencies
npm install

Step 3: Set Up Environment Variables

Create a .env file in the root directory:

RAPID_API_KEY=your_rapidapi_key_here

To get your RapidAPI key:

  1. Sign up at RapidAPI
  2. Subscribe to the COVID-193 API
  3. Copy your API key and paste it in the .env file

Step 4: Verify Setup

# Check if all dependencies are installed
npm list

🎯 Running the Application

Development Mode

Terminal 1 - Start Backend Server:

cd backend
npm install express axios cors dotenv
node server.js

Backend will run on http://localhost:5000

Terminal 2 - Start Frontend Dev Server:

npm run dev

Frontend will run on http://localhost:5173 (or similar)

Build for Production

Frontend:

npm run build

Creates optimized build in dist/ directory

Backend:

node backend/server.js

πŸ“¦ Deployment

  • Frontend (Vercel): Deployed on Vercel. Add your Vercel project URL here (e.g. https://your-project.vercel.app). Ensure the Vercel project has the VITE_API_URL environment variable set to your backend URL.
  • Backend (Render): Deployed on Render β€” https://covitrack.onrender.com.

Note: The frontend reads the backend base URL from the VITE_API_URL environment variable. In production, set VITE_API_URL in your Vercel project to https://covitrack.onrender.com (or your Render service URL).


πŸ“‘ API Documentation

Backend Endpoints

1. Health Check

GET /

  • Description: Verify backend is running
  • Response:
    Backend is running βœ…
    

2. COVID-19 Statistics

GET /covid?country=CountryName

Parameters:

  • country (query, optional) β€” Country name (default: "India")
    • Example: ?country=United States, ?country=Japan

Response Success (200):

{
  "country": "India",
  "totalCases": 44543210,
  "activeCases": 1234567,
  "recovered": 42000000,
  "deaths": 524200
}

Response Error (404):

{
  "error": "Country not found"
}

Response Error (500):

{
  "error": "Failed to fetch COVID data"
}

Example Requests:

# Get India stats (default)
curl http://localhost:5000/covid

# Get specific country
curl http://localhost:5000/covid?country=Japan

# Get US stats
curl http://localhost:5000/covid?country=United%20States

🎨 Website Components

1. Hero Section

  • Animated background with gradient effects
  • Eye-catching title: "CoviTrack"
  • Subtitle: "Explore real-time COVID-19 data from anywhere on Earth"
  • Interactive "Explore Now" button with smooth scroll
  • Scroll indicator animation

2. Loading Screen

  • Full-screen overlay with fixed positioning
  • Blurred hero background image
  • Dark semi-transparent overlay for contrast
  • Animated loading circles with bouncing animation
  • Subtle pulsing title and status dots
  • Responsive on all screen sizes

3. Country Section

  • Beautiful dark gradient background with Unsplash image
  • Interactive search bar with glassmorphism effect
  • Input field for country name search
  • Search button with gradient and hover effects
  • Country data card displaying:
    • Country name with "Live" badge
    • 4-column stats grid (responsive)
    • Total Cases, Active, Recovered, Deaths
    • Color-coded stat cards with side accent bars
    • Animated borders on top
    • Real-time update indicator

4. Insights Section

  • Dark purple gradient background with floating gradient orbs
  • Animated grid pattern overlay for depth
  • Three insight cards with:
    • Global Coverage info (200+ countries)
    • Real-Time Updates info
    • Data Interpretation info
  • Interactive cards with hover effects and glow
  • Floating animated icons in each card
  • Responsive grid layout

5. Footer

  • Premium dark aesthetic with glassmorphism
  • Three-column layout:
    • Left: CoviTrack branding
    • Center: Three feature cards with floating icons
      • ⚑ Real-time data
      • 🌍 200+ countries
      • πŸ”„ Live updates
    • Right: Made with β™₯ by Angela Bera credit
  • Interactive hover effects on feature cards
  • Animated heartbeat effect
  • Gradient accent line at bottom
  • Copyright notice
  • Responsive stacked layout on mobile

🌟 UI Highlights

Design Features

  • Glassmorphism β€” Frosted glass effect with backdrop blur
  • Smooth Animations β€” All transitions are buttery smooth
  • Gradient Backgrounds β€” Modern multi-layer gradients
  • Glow Effects β€” Subtle shadows and glows for depth
  • Color Palette:
    • Primary: Cyan (#38bdf8), Purple (#8b5cf6)
    • Accent: Green (Scrollbar), Red (Heart)
    • Dark theme: Navy/Dark Blue backgrounds

Interactive Elements

  • Animated Scrollbar β€” Sea-green glowing scrollbar with hover effects
  • Search Bar β€” Glassmorphic input with focus states
  • Buttons β€” Gradient backgrounds with transform hover effects
  • Cards β€” Lift animation on hover with glow
  • Loading Animation β€” Bouncing circles with pulsing effects
  • Hero Title β€” Clickable with animation trigger

Responsive Design

  • Mobile-first approach
  • Breakpoints: 768px, 900px, 1100px
  • Flexible grid layouts
  • Touch-friendly interactive elements
  • Optimized typography sizes

πŸ”§ Customization

Change API Source

Edit backend/server.js:

const response = await axios.get(
  "https://covid-193.p.rapidapi.com/statistics", // Change this URL
  {
    headers: {
      "X-RapidAPI-Key": process.env.RAPID_API_KEY,
      "X-RapidAPI-Host": "covid-193.p.rapidapi.com",
    },
  }
);

Modify Colors

Edit color values in CSS files:

  • Primary gradient: #38bdf8 to #8b5cf6
  • Scrollbar: #20c997 to #10b981
  • Backgrounds: Adjust gradient stops

Update Backgrounds

  • Country Section: Edit URL in src/styles/country-section.css
  • Insights Section: Edit URL in src/styles/insights-section.css

πŸ“Έ Features Showcase

Real-Time Data

  • Live COVID-19 statistics for any country
  • Automatically refreshes data on app load
  • Case-insensitive country search

Beautiful UI/UX

  • Smooth page transitions
  • Animated loading states
  • Interactive hover effects
  • Professional color scheme
  • Optimized typography

Performance

  • Fast API responses (with caching potential)
  • Optimized React components
  • Vite's lightning-fast HMR (Hot Module Replacement)
  • Minimal bundle size

πŸ› Troubleshooting

Backend won't start

# Check Node.js version
node --version

# Make sure dependencies are installed
cd backend
npm install

# Check if port 5000 is in use
# Change PORT in server.js if needed

API Key error

  • Verify .env file exists in root directory
  • Check API key is correctly copied
  • Ensure API key is valid and has access to COVID-193 endpoint

CORS errors

  • Backend has CORS enabled by default
  • If issues persist, check cors() in server.js

Frontend not connecting to backend

  • Ensure backend is running on http://localhost:5000
  • Check browser console for network errors
  • Verify no firewall blocking requests

πŸ“š Resources


πŸ‘€ Author

Made with ❀️ by Angela Bera


About

A full-stack COVID-19 tracker built using React and Node.js, fetching real-time global and country-wise statistics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published