Skip to content

parklabo/population-simulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

71 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Population Crisis Simulator

A wake-up call dashboard visualizing the global demographic crisis through real-time birth rate simulations

๐Ÿšจ The Crisis We Face

As someone living in Japan as a Korean, I was shocked to discover that South Korea and Japan rank #1 and #8 respectively among countries with the lowest birth rates globally:

  • ๐Ÿ‡ฐ๐Ÿ‡ท South Korea: 0.72 births per woman (World's lowest)
  • ๐Ÿ‡ฏ๐Ÿ‡ต Japan: 1.26 births per woman

This isn't just an Asian problem. The demographic crisis spans across continents:

  • ๐Ÿ‡ญ๐Ÿ‡ฐ Hong Kong: 0.77
  • ๐Ÿ‡ธ๐Ÿ‡ฌ Singapore: 0.85
  • ๐Ÿ‡ฎ๐Ÿ‡น Italy: 1.20
  • ๐Ÿ‡ช๐Ÿ‡ธ Spain: 1.16
  • ๐Ÿ‡ฉ๐Ÿ‡ช Germany: 1.49

The replacement rate needed to maintain population is 2.1 births per woman.

๐Ÿ“Š Project Purpose

This project was born from a personal shock at seeing these statistics. The goal is to:

  1. Raise Awareness: Create an impactful visualization that makes the demographic crisis tangible
  2. Enable Easy Sharing: Build a dashboard that can be easily shared to spread awareness
  3. Simulate Futures: Show potential demographic outcomes based on current trends
  4. Inspire Action: Help people understand the urgency of this global challenge

๐ŸŒ Why This Matters

The demographic crisis affects:

  • Economic Sustainability: Shrinking workforce, increasing elderly care costs
  • Social Security Systems: Fewer workers supporting more retirees
  • Innovation and Growth: Declining young population impacts innovation
  • National Security: Population decline affects military and economic power
  • Cultural Continuity: Communities and traditions at risk of disappearing

๐Ÿš€ Features

Interactive 3D Globe Visualization

  • Real-time 3D Earth: Interactive globe powered by react-globe.gl with WebGL rendering
  • Country Flags Display: Visual country markers with flags on the globe for easy identification
  • Color-Coded Crisis Levels: Countries color-coded by birth rate severity (Extreme, Severe, Critical, Stable)
  • Touch & Mouse Controls: Rotate, zoom, and explore the globe with intuitive controls
  • Hover Tooltips: Instant country information on hover (population, birth rate)

Population Simulation Engine

  • 100-Year Projections: Sophisticated demographic simulation spanning a century
  • Real-time Population Dynamics: Track births, deaths, aging, and migration patterns
  • Population Pyramids: Visualize age distribution across 17 age groups
  • Key Metrics Tracking:
    • Dependency ratio (working-age vs dependents)
    • Median age progression
    • Natural growth rate
    • Birth/death rate evolution
  • Milestone Detection: Automatic detection of population halving and peak years

Country Rankings & Analytics

  • Global Rankings: Real-time sortable list of all countries by birth rate
  • Crisis Indicators:
    • ๐Ÿ”ด EXTREME: Birth rate < 1.0
    • ๐ŸŸ  SEVERE: Birth rate 1.0-1.5
    • ๐ŸŸก CRITICAL: Birth rate 1.5-2.1
    • ๐ŸŸข STABLE: Birth rate > 2.1
  • Detailed Country Profiles: Population, life expectancy, and demographic trends

Future Colony Simulations

  • Mars Colony Planning: Explore colonization scenarios and population sustainability on Mars
  • Moon Defense Game: StarCraft-style RTS game for lunar base defense (desktop only)
  • Celestial Bodies: Interactive moon and mars elements in 3D space

Mobile-First Design

  • Fully Responsive: Optimized for all screen sizes from mobile to 4K displays
  • Performance Mode: Automatic optimization for mobile devices
  • Touch Gestures: Swipe, pinch-to-zoom, and tap controls
  • Mobile Navigation: Bottom navigation bar for easy access on smartphones
  • Progressive Enhancement: Core functionality works on all devices

Visual Effects

  • Animated Starfield: Dynamic background with moving stars
  • Atmospheric Effects: Earth atmosphere with realistic glow
  • Smooth Transitions: Framer Motion animations throughout the UI
  • Gradient Overlays: Modern glassmorphism design

๐Ÿ› ๏ธ Technology Stack

  • Next.js 15: React framework with App Router
  • React 19: Latest React with concurrent features
  • TypeScript: Full type safety across the application
  • Tailwind CSS: Utility-first responsive design
  • react-globe.gl: WebGL-powered 3D globe visualization
  • Recharts: Responsive charting library for data visualization
  • Framer Motion: Smooth animations and transitions
  • react-countup: Animated number counters

๐ŸŽฏ Mission

To create a powerful, accessible tool that helps people understand the demographic crisis we're facing. By making these abstract numbers visual and personal, we hope to inspire conversations, policy changes, and individual decisions that can help address this global challenge.

๐Ÿ“ˆ Getting Started

Prerequisites

  • Node.js 18.x or later
  • npm or yarn package manager

Installation

# Clone the repository
git clone https://github.com/parklabo/population-simulator.git
cd population-simulator

# Install dependencies
npm install

# Run development server
npm run dev

Open http://localhost:3000 to see the simulator in action.

Available Scripts

# Development
npm run dev          # Start development server with hot reload

# Production
npm run build        # Build for production
npm run start        # Start production server

# Code Quality
npm run lint         # Run ESLint
npm run lint:fix     # Fix ESLint errors automatically
npm run type-check   # Run TypeScript type checking

# Analysis
npm run analyze      # Analyze bundle size

Project Structure

population-simulator/
โ”œโ”€โ”€ app/                    # Next.js App Router pages
โ”‚   โ”œโ”€โ”€ page.tsx           # Main application page
โ”‚   โ”œโ”€โ”€ layout.tsx         # Root layout with metadata
โ”‚   โ””โ”€โ”€ not-found.tsx      # 404 page
โ”œโ”€โ”€ components/            # React components
โ”‚   โ”œโ”€โ”€ SimulatorModal.tsx # Population simulation modal
โ”‚   โ”œโ”€โ”€ MarsColonyModal.tsx # Mars colonization simulator
โ”‚   โ”œโ”€โ”€ MarsRTSGame.tsx    # Moon defense game
โ”‚   โ”œโ”€โ”€ GlobeFlagMode.tsx  # Flag rendering logic
โ”‚   โ”œโ”€โ”€ MobileNav.tsx      # Mobile navigation
โ”‚   โ”œโ”€โ”€ MobileCountrySelector.tsx
โ”‚   โ”œโ”€โ”€ StarField.tsx      # Animated background
โ”‚   โ”œโ”€โ”€ CelestialBodies.tsx # Moon & Mars elements
โ”‚   โ””โ”€โ”€ Footer.tsx         # App footer
โ”œโ”€โ”€ lib/                   # Core logic and data
โ”‚   โ”œโ”€โ”€ population-simulator.ts # Simulation engine
โ”‚   โ””โ”€โ”€ world-data.ts      # Country demographic data
โ”œโ”€โ”€ docs/                  # Documentation
โ”‚   โ””โ”€โ”€ MOBILE_DESIGN.md   # Mobile optimization specs
โ””โ”€โ”€ public/               # Static assets

How to Use

  1. Explore the Globe: Rotate and zoom the 3D Earth to explore different countries
  2. View Country Rankings: Check the left sidebar (desktop) to see countries ranked by birth rate
  3. Select a Country: Click on a country flag or name to view detailed information
  4. Run Simulation: Click "Run Simulation" to see 100-year population projections
  5. Mobile Navigation: Use bottom navigation on mobile to switch between Earth, Moon, and Mars views
  6. Mars Colony: Click the Mars icon to explore Mars colonization scenarios
  7. Moon Defense: Click the Moon icon on desktop to play the lunar defense game

๐Ÿค Contributing

This is an open-source project aimed at raising awareness about the global demographic crisis. We welcome contributions from:

  • Developers: Code improvements, bug fixes, new features
  • Demographers: Data accuracy, simulation model improvements
  • Designers: UI/UX enhancements, accessibility improvements
  • Translators: Internationalization and localization
  • Data Scientists: Advanced analytics and visualization

How to Contribute

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

Please ensure:

  • Code follows TypeScript and ESLint standards
  • All type checks pass (npm run type-check)
  • Mobile responsiveness is maintained
  • Documentation is updated as needed

๐Ÿ“Š Data Sources

  • Population Data: United Nations Population Division (2024)
  • Birth Rates: World Bank Development Indicators
  • Life Expectancy: WHO Global Health Observatory
  • Demographic Projections: Based on current trends and standard demographic models

Note: Data is for educational and awareness purposes. Actual demographic futures depend on many complex factors.

๐ŸŒ Browser Support

  • Chrome/Edge: โœ… Full support (recommended)
  • Firefox: โœ… Full support
  • Safari: โœ… Full support (iOS 12+)
  • Samsung Internet: โœ… Mobile optimized

WebGL support required for 3D globe visualization.

๐Ÿ“ License

MIT License - Free to use and share to spread awareness.

See LICENSE file for details.

๐Ÿ™ Acknowledgments

  • Built with urgency and hope for our collective future
  • Inspired by the demographic challenges facing South Korea, Japan, and nations worldwide
  • Thanks to all contributors working to raise awareness about this global issue

Remember: Every conversation about this crisis matters. Share this tool, discuss the issue, and be part of the solution.

Live Demo: Visit the Population Simulator

Made with ๐Ÿ’™ by concerned global citizens

About

Visualize demographic futures with real-time birth rate simulations

Resources

License

Stars

3 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors