DEV Community

Lakshya Singh Chauhan
Lakshya Singh Chauhan

Posted on • Originally published at lakshyasinghchauhan.com on

Building an India COVID-19 Tracker with HTML, CSS, JavaScript

This project was built while vibing code with ChatGPT , which made the whole process a lot more fun and collaborative. ๐Ÿ˜„


๐Ÿ”ง Tools & Technologies

  • HTML5 โ€“ Structure of the site
  • CSS3 โ€“ Styling and responsive layout
  • JavaScript โ€“ Dynamic data fetching
  • disease.sh API โ€“ Free and public COVID-19 API

๐ŸŽจ Features

  • ๐ŸŒ— Dark Mode toggle with local storage persistence
  • ๐Ÿ“ฑ Responsive Design for mobile devices
  • ๐Ÿ”„ Real-time Data pulled from the disease.sh API

๐Ÿ“ File Structure

covid-tracker/
โ”œโ”€โ”€ index.html
โ”œโ”€โ”€ style.css
โ”œโ”€โ”€ script.js
Enter fullscreen mode Exit fullscreen mode

๐ŸŒ API Integration

We used the disease.sh API to get real-time COVID-19 data:

fetch('https://disease.sh/v3/covid-19/countries/India')
Enter fullscreen mode Exit fullscreen mode

We extracted:

  • active cases
  • recovered cases
  • deaths

๐Ÿ’ก Dark Mode

Dark mode was implemented by toggling a class on the body and saving user preference with localStorage:

localStorage.setItem('theme', 'dark');
Enter fullscreen mode Exit fullscreen mode

๐Ÿ“ฑ Responsive Design

With max-width containers and flexible layout using CSS, the site looks great on phones and desktops alike.


โœ… Final Touches

  • Tooltip toggle icon for better UX
  • Aesthetic improvements and color contrast for light/dark modes
  • All functionality is fully client-side , no backend needed

๐Ÿš€ Live Preview & Source Code

Want to see it live or fork the project?

๐Ÿ”— GitHub Repository


๐Ÿ™Œ Conclusion

Creating your own COVID-19 tracker helps you learn modern web technologies while building something practical. We combined real-time data, themes, and accessibility โ€“ all in one clean project.

Whether youโ€™re a student or a frontend enthusiast, this project is a great showcase for your portfolio.


Stay safe and keep coding! ๐Ÿ‡ฎ๐Ÿ‡ณ


Feel free to comment or share your version of the tracker!

Top comments (0)