How srijan-petwal/mission-control works
Project type and purpose
• This is a full-stack web application (“NASA Mission Control”) for scheduling and tracking mock space launches.
• Frontend: React SPA (create-react-app) served in development via npm start and in production as static assets.
• Backend: Node.js + Express REST API, persisting data in MongoDB Atlas via Mongoose, with PM2 clustering for performance.
File structure
• Top-level splits into client/ (React) and server/ (Express+MongoDB).
• client/src/ contains React components, pages, and custom hooks.
• server/src/ follows an MVC-style layout:
• models/ (Mongoose schemas + in-memory fallback)
• routes/ (Routers + Controllers for /planets and /launches)
• app.js bootstraps middleware, JSON parsing, CORS, static file serving
• server.js launches the Express app (and in production serves React’s build).
• Data ingestion: server/data/kepler-data.csv is loaded on startup to populate planets collection.
• PM2 cluster configuration (not in files but described in README) forks multiple Node instances.
Key insights from the README
• RESTful endpoints for CRUD on launches and GET on planets.
• MongoDB Atlas persistence via Mongoose models.
• PM2 cluster mode for multi-core scaling.
• React Router handles /launch, /upcoming, /history.
Main components and interactions
a. Frontend (React SPA)
• Deployed as static files under client/public or served by Express in production.
• Consumes backend REST API over HTTPS (GET/POST/DELETE).
• Uses custom hooks (usePlanets, useLaunches) to fetch data.
b. Backend (Node.js + Express)
• Exposes /planets and /launches endpoints via controllers & routers.
• Uses Mongoose models (planets.mongo.js, launches.mongo.js) to interact with MongoDB Atlas.
• On startup, reads kepler-data.csv to seed the planets collection.
• PM2 spawns multiple Node instances to handle concurrent requests.
c. Database (MongoDB Atlas)
• Two main collections: planets and launches.
• Connection via MONGO_URL (in .env).
d. External services
• NASA Kepler Exoplanet Archive (source of CSV data).
Architectural patterns & design principles
• Separation of concerns: clear split between presentation (React), API (Express), data (MongoDB).
• MVC‐style backend: models, controllers, routers.
• API-first design: documented REST endpoints.
• Scalability via PM2 clustering.
• Data seeding on startup for exoplanet dataset.