- Development:
http://localhost:5000 - Production:
https://your-railway-app.railway.app
No authentication required for basic endpoints. NASA API key needed for real data integration.
POST /api/simulation/start-gameRequest Body:
{
"level": 1
}Response:
{
"success": true,
"game_data": {
"level": 1,
"asteroid": {
"name": "Threat-1",
"diameter": 0.01,
"velocity": 15.2,
"mass": 1.2e12,
"position": [0, 0, 3]
},
"time_remaining": 300,
"difficulty": "Easy"
}
}GET /api/simulation/game-statusResponse:
{
"success": true,
"status": {
"state": "playing",
"level": 1,
"score": 0,
"time_remaining": 285.5,
"asteroid": {
"name": "Threat-1",
"diameter": 0.01,
"velocity": 15.2,
"mass": 1.2e12,
"position": [0, 0, 3]
}
}
}POST /api/simulation/updateRequest Body:
{
"delta_time": 0.016
}Response:
{
"success": true,
"update": {
"state": "playing",
"time_remaining": 285.5,
"score": 0,
"asteroid_position": [0, 0, 2.95]
}
}POST /api/simulation/pausePOST /api/simulation/resumePOST /api/simulation/resetPOST /api/simulation/simulate-impactRequest Body:
{
"impact_angle": 45.0
}Response:
{
"success": true,
"impact_data": {
"energy_joules": 1.2e15,
"tnt_equivalent": 0.3,
"crater_diameter": 2.5,
"devastation_radius": {
"blast_radius": 1.8,
"thermal_radius": 4.5,
"seismic_radius": 0.9,
"total_radius": 4.5
},
"environmental_effects": {
"tsunami_risk": "High",
"seismic_magnitude": 6.2,
"atmospheric_dust": 300,
"climate_impact": "Moderate"
},
"asteroid_data": {
"name": "Threat-1",
"diameter": 0.5,
"velocity": 15.2,
"mass": 1.2e12
}
}
}POST /api/simulation/attempt-deflectionRequest Body:
{
"strategy": "kinetic",
"deflection_force": 1.0
}Response:
{
"success": true,
"deflection_result": {
"deflection_success": true,
"deflection_percentage": 0.85,
"new_miss_distance": 850.0,
"time_to_impact": 30.0,
"strategy_used": "kinetic",
"score_bonus": 850
}
}GET /api/simulation/asteroid-dataResponse:
{
"success": true,
"asteroid": {
"name": "Threat-1",
"diameter": 0.5,
"velocity": 15.2,
"mass": 1.2e12,
"density": 3000,
"position": [0, 0, 3],
"orbital_elements": {
"semi_major_axis": 1.5,
"eccentricity": 0.3,
"inclination": 15.0,
"argument_of_perihelion": 0.0,
"longitude_of_ascending_node": 0.0
}
}
}POST /api/simulation/physics-calculationsRequest Body:
{
"diameter": 0.5,
"velocity": 15.2,
"density": 3000,
"impact_angle": 45.0
}Response:
{
"success": true,
"physics_data": {
"mass": 1.2e12,
"energy_joules": 1.2e15,
"tnt_equivalent": 0.3,
"crater_diameter": 2.5,
"devastation_radius": {
"blast_radius": 1.8,
"thermal_radius": 4.5,
"seismic_radius": 0.9,
"total_radius": 4.5
},
"input_parameters": {
"diameter": 0.5,
"velocity": 15.2,
"density": 3000,
"impact_angle": 45.0
}
}
}GET /api/simulation/deflection-strategiesResponse:
{
"success": true,
"strategies": {
"kinetic_impactor": {
"name": "Kinetic Impactor",
"description": "High-speed impact to change asteroid trajectory",
"effectiveness": "High for small-medium asteroids",
"time_required": "Months to years",
"cost": "Medium",
"risk": "Low"
},
"gravity_tractor": {
"name": "Gravity Tractor",
"description": "Use gravitational force to gradually deflect asteroid",
"effectiveness": "High for large asteroids",
"time_required": "Years",
"cost": "High",
"risk": "Low"
},
"laser_ablation": {
"name": "Laser Ablation",
"description": "Use focused laser to vaporize surface material",
"effectiveness": "High for small asteroids",
"time_required": "Months to years",
"cost": "Very High",
"risk": "Medium"
}
}
}GET /api/asteroidsResponse:
{
"asteroids": [
{
"id": 1,
"name": "Impactor-2025",
"diameter": 0.5,
"velocity": 15.2
},
{
"id": 2,
"name": "Test Asteroid",
"diameter": 1.2,
"velocity": 12.8
}
]
}GET /healthResponse:
{
"status": "healthy",
"service": "Asteroid Impact Simulator"
}menu- Main menuplaying- Game in progresspaused- Game pausedgame_over- Game endedvictory- Mission successful
kinetic- Kinetic Impactorgravity- Gravity Tractorlaser- Laser Ablation
{
"success": false,
"error": "Invalid strategy: unknown"
}{
"error": "Not found"
}{
"error": "Internal server error"
}- Default: 100 requests per minute
- Burst: 10 requests per second
- Timeout: 30 seconds per request
// 1. Start new game
const startResponse = await fetch('/api/simulation/start-game', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ level: 1 })
});
// 2. Get game status
const statusResponse = await fetch('/api/simulation/game-status');
const status = await statusResponse.json();
// 3. Attempt deflection
const deflectionResponse = await fetch('/api/simulation/attempt-deflection', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
strategy: 'kinetic',
deflection_force: 1.0
})
});
// 4. Update game state
const updateResponse = await fetch('/api/simulation/update', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ delta_time: 0.016 })
});- Response Time: < 100ms for most endpoints
- Concurrent Users: Supports 100+ simultaneous users
- Memory Usage: ~50MB base, +10MB per active game
- CPU Usage: Optimized for 60 FPS physics simulation
- CORS: Enabled for all origins
- Input Validation: All parameters validated
- Rate Limiting: Prevents abuse
- Error Handling: Secure error messages
For API support or questions:
- GitHub Issues: EarthsFirewall/EarthsFirewall
- Documentation: docs/
- NASA Space Apps: spaceappschallenge.org