🌐 Live Demo: nasaimagebrowser.netlify.app
This React application allows you to explore images from NASA's public APIs, showcasing:
- Mars Rover Photos
- EPIC (Earth Polychromatic Imaging Camera) Imagery
- Astronomy Picture of the Day (APOD)
- Node.js and npm installed on your system.
Clone this repository:
git clone https://github.com/XYWINGS/NASAImageBrowser.gitNavigate to the project directory and install dependencies:
cd NASAImageBrowser
npm installAdd your NASA API key to a .env file:
VITE_NASA_API_KEY=your_api_key_hereStart the development server:
npm startThis starts a local server at http://localhost:3000. The app auto-reloads on code changes.
- Navigate between Mars Rovers, EPIC, and APOD sections.
- In Mars Rovers, select a rover to view images from it.
- EPIC shows real-time Earth images from the DSCOVR satellite.
- APOD shows a new astronomy image with an explanation daily.
To create a production build:
npm run buildThis generates a dist/ folder with the production-ready app.
| API | Description | Example Date |
|---|---|---|
| Mars Rover Photos API | Curiosity rover photos | 2024-02-19 |
| EPIC API | Earth images | 2024-03-26 |
| APOD API | Astronomy Picture of the Day | Any Date |
- API Rate Limits: NASA APIs have usage limits that can be exceeded.
- Error Handling: Needed to gracefully handle failed requests or network issues.
- Data Caching: To improve performance and reduce API usage.
- Rate Limit Awareness: Added logic to respect limits and show messages when exceeded.
- Error Handling: Implemented error boundaries and fallback messages.
- Caching: Considered local storage or memory caching for high-use data like APOD.
Run test cases with:
npx jest src/HomePage.test.js
npx jest src/MarsImages.test.js
npx jest src/PictureoftheDay.test.js