A full-stack web application that visualizes near-Earth asteroid orbits, simulates impact scenarios, and explores mitigation strategies. Built for Hackathon 2025.
Near-Earth Asteroid "Impactor-2025" may threaten Earth. This tool helps scientists and the public understand:
- Orbital mechanics and asteroid trajectories
- Impact consequences including crater size, blast zones, and seismic effects
- Mitigation strategies like kinetic impactors and gravity tractors
- Fetches live Near-Earth Object (NEO) data
- Real-time asteroid size, velocity, and trajectory information
- Filters potentially hazardous asteroids
- Impact energy calculation:
E = 0.5 * m * v┬▓ - Crater size and depth estimation
- Blast radius zones (fireball, total destruction, severe/moderate damage)
- Seismic effects (Richter magnitude)
- TNT equivalent energy comparison
- Interactive Three.js visualization
- Shows asteroid orbit around the Sun
- Earth position and relative distances
- Animated asteroid approach
- Real-time deflection effects
- Interactive Leaflet.js map
- Click to set custom impact locations
- Crater visualization
- Color-coded damage zones
- Thermal radiation radius
- Seismic impact areas
- Kinetic Impactor: High-speed spacecraft collision
- Gravity Tractor: Slow gravitational deflection
- Nuclear Deflection: Last-resort option
- Real-time effectiveness calculations
- Dynamic orbit path updates
- Django 4.2 - Web framework
- Django REST Framework - API endpoints
- Requests - NASA API integration
- CORS Headers - Cross-origin support
- React 18.2 - UI framework
- Three.js - 3D visualization
- @react-three/fiber - React Three.js renderer
- @react-three/drei - Three.js helpers
- Leaflet.js - Interactive maps
- React-Leaflet - React Leaflet bindings
- Axios - HTTP client
- Python 3.8 or higher
- Node.js 14 or higher
- npm or yarn
- Git
- Navigate to backend directory:
cd backend- Create virtual environment:
python -m venv venv- Activate virtual environment:
- Windows:
venv\Scripts\activate
- macOS/Linux:
source venv/bin/activate
- Install dependencies:
pip install -r requirements.txt- Run migrations:
python manage.py migrate- Start Django server:
python manage.py runserverBackend will run on: http://localhost:8000
- Navigate to frontend directory:
cd frontend- Install dependencies:
npm install- Start React development server:
npm startFrontend will run on: http://localhost:3000
Ready to deploy your app to the world? We've created comprehensive guides:
-
DEPLOYMENT_GUIDE.md - Complete step-by-step deployment guide
- Deploy backend on Render (free)
- Deploy frontend on Vercel (free)
- Environment variables setup
- CORS configuration
- Troubleshooting tips
-
DEPLOY_CHECKLIST.md - Quick 10-minute deployment checklist
- Pre-deployment checks
- Step-by-step tasks
- Testing procedures
-
ENV_VARIABLES.md - Environment variables reference
- All required variables
- How to generate SECRET_KEY
- Security best practices
-
ALTERNATIVE_HOSTING.md - Other free hosting options
- Netlify + Railway
- GitHub Pages + PythonAnywhere
- Cloudflare Pages + Fly.io
- Comparison table
Recommended: Vercel (Frontend) + Render (Backend)
- Total Cost: $0 (FREE!)
- Setup Time: ~10 minutes
- No Credit Card Required
# 1. Push to GitHub
git add .
git commit -m "Ready for deployment"
git push origin main
# 2. Deploy frontend: vercel.com
# 3. Deploy backend: render.com
# 4. Done! 🎉See DEPLOYMENT_GUIDE.md for detailed instructions.
asteroid-impact-simulator/
Γö£ΓöÇΓöÇ backend/ # Django backend
Γöé Γö£ΓöÇΓöÇ api/ # API application
Γöé Γöé Γö£ΓöÇΓöÇ nasa_api.py # NASA NEO API integration
Γöé Γöé Γö£ΓöÇΓöÇ physics.py # Physics calculation engine
Γöé Γöé Γö£ΓöÇΓöÇ views.py # API endpoints
Γöé Γöé ΓööΓöÇΓöÇ urls.py # URL routing
Γöé Γö£ΓöÇΓöÇ backend/ # Django settings
Γöé Γöé Γö£ΓöÇΓöÇ settings.py # Configuration
Γöé Γöé ΓööΓöÇΓöÇ urls.py # Main URL config
Γöé Γö£ΓöÇΓöÇ manage.py # Django management
Γöé ΓööΓöÇΓöÇ requirements.txt # Python dependencies
Γöé
Γö£ΓöÇΓöÇ frontend/ # React frontend
Γöé Γö£ΓöÇΓöÇ public/ # Static files
Γöé Γöé ΓööΓöÇΓöÇ index.html # HTML template
Γöé Γö£ΓöÇΓöÇ src/
Γöé Γöé Γö£ΓöÇΓöÇ components/ # React components
Γöé Γöé Γöé Γö£ΓöÇΓöÇ Orbit3D.js # 3D orbit visualization
Γöé Γöé Γöé Γö£ΓöÇΓöÇ ImpactMap.js # Interactive impact map
Γöé Γöé Γöé ΓööΓöÇΓöÇ MitigationUI.js # Deflection simulator
Γöé Γöé Γö£ΓöÇΓöÇ App.js # Main app component
Γöé Γöé Γö£ΓöÇΓöÇ App.css # App styles
Γöé Γöé ΓööΓöÇΓöÇ index.js # Entry point
Γöé ΓööΓöÇΓöÇ package.json # Node dependencies
Γöé
ΓööΓöÇΓöÇ README.md # This file
GET /api/asteroids- Fetch NEO feed- Query params:
start_date,end_date,hazardous_only
- Query params:
GET /api/asteroids/<id>- Get specific asteroid details
-
POST /api/simulate-impact- Calculate impact effects{ "diameter_km": 1.0, "velocity_kmps": 20, "impact_lat": 40.7128, "impact_lon": -74.0060, "impact_angle": 45 } -
POST /api/impact-from-asteroid- Calculate impact from NASA asteroid{ "asteroid_id": "3542519", "impact_lat": 40.7128, "impact_lon": -74.0060 }
POST /api/simulate-deflection- Simulate deflection methods{ "original_velocity_kmps": 20, "method": "kinetic_impactor", "params": { "impactor_mass_kg": 500, "impactor_velocity_kmps": 10, "asteroid_mass_kg": 1e12 } }
GET /api/health- API health status
The NASA API key is configured in backend/backend/settings.py:
NASA_API_KEY = 'cXvyJSY51LQk5ElMYRGqUNotCpXn2fncclaKhnFm'Get your own key at: https://api.nasa.gov
| Person | Responsibility | Files |
|---|---|---|
| Person 1 | NASA API Integration | api/nasa_api.py |
| Person 2 | Physics Engine | api/physics.py |
| Person 3 | 3D Orbit Visualization | components/Orbit3D.js |
| Person 4 | Impact Map | components/ImpactMap.js |
| Person 5 | Mitigation Simulator | components/MitigationUI.js |
cd backend
python manage.py testcd frontend
npm test- NASA Center for Near-Earth Object Studies (CNEOS)
- Impact crater scaling laws
- Nuclear weapon effects calculations
- DART mission (Double Asteroid Redirection Test)
- Leaflet marker icons require manual import fix in development
- Some NASA API responses may be slow during peak times
- Ocean impact effects are simplified (no tsunami simulation yet)
- Tsunami simulation for ocean impacts
- Multiple asteroid tracking
- Historical impact database
- VR/AR visualization support
- Social media sharing
- PDF report generation
- Multi-language support
This project is created for educational and hackathon purposes.
- NASA for providing the Near-Earth Object API
- The DART mission team for inspiring asteroid deflection research
- Three.js and Leaflet.js communities for amazing visualization tools
For questions or collaboration:
- GitHub Issues: Create an issue
- Email: your.email@example.com
Built with ❤️ for Hackathon 2025
Protecting Earth, one simulation at a time 🌍✨