Skip to content

A NestJS-powered REST API that continuously fetches and serves real-time global statistics from Worldometer. Provides structured endpoints for population, health, environment, energy, food, water, government, and social media data with automatic updates every 5 seconds.

Notifications You must be signed in to change notification settings

nolancacheux/worldometer-real-time-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Worldometer Real-Time Data API

A RESTful API service that fetches and serves real-time global statistics from Worldometer, providing live data on population, health, environment, energy, and more through clean, structured endpoints.

Features

  • Real-time Data Collection: Automatically fetches fresh data from Worldometer every 5 seconds
  • Comprehensive Statistics: Track 8 major categories of global data:
    • Population (births, deaths, growth)
    • Health (diseases, mortality, lifestyle)
    • Environment (CO2, deforestation, pollution)
    • Energy (consumption, renewable vs non-renewable)
    • Food & Nutrition (hunger, obesity, malnutrition)
    • Water (usage, accessibility, water-related deaths)
    • Government & Economy (spending, production)
    • Society & Media (technology, internet, social media)
  • RESTful API: Clean endpoints for each data category
  • Database Storage: Persistent storage with timestamp tracking
  • Built with NestJS: Modern, scalable Node.js framework

API Endpoints

Base URL: http://localhost:3000

  • GET /population - Current world population statistics
  • GET /health - Global health and disease data
  • GET /environment - Environmental impact metrics
  • GET /energy - Energy consumption and reserves
  • GET /food - Food security and nutrition data
  • GET /water - Water usage and accessibility
  • GET /government-economy - Economic and government spending
  • GET /society-media - Technology and media statistics

Quick Start

Prerequisites

  • Node.js (v14 or higher)
  • MySQL database
  • Python (for Worldometer data scraping)

Installation

  1. Clone the repository

    git clone https://github.com/nolancacheux/worldometer-real-time-api
    cd worldometer-real-time-api
  2. Install dependencies

    cd nestjs-project
    npm install
  3. Database Setup

    • Create a MySQL database
    • Run the SQL setup scripts:
      mysql -u your_username -p your_database < sql_etapes.sql
  4. Configure Database Connection

    • Update database credentials in nestjs-project/src/app.module.ts
  5. Start the Application

    npm run start:dev

The API will be available at http://localhost:3000

Development

Available Scripts

  • npm run start - Start the application
  • npm run start:dev - Start in development mode with hot reload
  • npm run build - Build for production
  • npm run test - Run unit tests
  • npm run lint - Lint the codebase

Project Structure

nestjs-project/
├── src/
│   ├── controllers/     # API route handlers
│   ├── services/        # Business logic and data fetching
│   ├── entities/        # Database models
│   └── main.ts         # Application entry point
├── test/               # Test files
└── sql_etapes.sql     # Database setup

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/new-feature)
  3. Commit your changes (git commit -am 'Add new feature')
  4. Push to the branch (git push origin feature/new-feature)
  5. Open a Pull Request

Please ensure your code follows the existing style conventions and includes appropriate tests.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

About

A NestJS-powered REST API that continuously fetches and serves real-time global statistics from Worldometer. Provides structured endpoints for population, health, environment, energy, food, water, government, and social media data with automatic updates every 5 seconds.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •