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.
- 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
Base URL: http://localhost:3000
GET /population
- Current world population statisticsGET /health
- Global health and disease dataGET /environment
- Environmental impact metricsGET /energy
- Energy consumption and reservesGET /food
- Food security and nutrition dataGET /water
- Water usage and accessibilityGET /government-economy
- Economic and government spendingGET /society-media
- Technology and media statistics
- Node.js (v14 or higher)
- MySQL database
- Python (for Worldometer data scraping)
-
Clone the repository
git clone https://github.com/nolancacheux/worldometer-real-time-api cd worldometer-real-time-api
-
Install dependencies
cd nestjs-project npm install
-
Database Setup
- Create a MySQL database
- Run the SQL setup scripts:
mysql -u your_username -p your_database < sql_etapes.sql
-
Configure Database Connection
- Update database credentials in
nestjs-project/src/app.module.ts
- Update database credentials in
-
Start the Application
npm run start:dev
The API will be available at http://localhost:3000
npm run start
- Start the applicationnpm run start:dev
- Start in development mode with hot reloadnpm run build
- Build for productionnpm run test
- Run unit testsnpm run lint
- Lint the codebase
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
- Fork the repository
- Create a feature branch (
git checkout -b feature/new-feature
) - Commit your changes (
git commit -am 'Add new feature'
) - Push to the branch (
git push origin feature/new-feature
) - Open a Pull Request
Please ensure your code follows the existing style conventions and includes appropriate tests.
This project is licensed under the MIT License - see the LICENSE file for details.
- Data sourced from Worldometer
- Built with NestJS
- Database: MySQL with TypeORM