A lightweight web app built with Astro that displays real-time astronomical data using NASA's API. Explore space imagery, asteroid information, and other cosmic data in a clean, modern interface.
- Astronomy Picture of the Day (APOD)
- Near-Earth Asteroid data
- Fast, responsive Astro-powered UI
- Minimalist and mobile-friendly design
- Astro - Static site generator
- JavaScript - Logic and API interactions
- CSS - Styling and responsive design
- pnpm - Package manager
- Netlify - Deployment and hosting
- NASA Open APIs - Astronomical data source
- Your NASA API key (via
import.meta.env.NASA_API_KEY) - Default demo key:
DEMO_KEY(rate limited)
🌠 Astronomy Picture of the Day (APOD)
- Endpoint: /planetary/apod
- Method: GET
| Parameter | Type | Description |
|---|---|---|
API_KEY |
string |
Required. Your NASA API key |
count |
number |
Number of APOD images to return (default: 1) |
thumbs |
boolean |
Return thumbnail URL for videos (default: false) |
const res = await fetch(
`https://api.nasa.gov/planetary/apod?api_key=${API_KEY}&count=4&thumbs=true`
);
const apods = await res.json();Returns an array of APOD objects with image/video data, titles, explanations, and dates.
To run this project, you will need to add the following environment variables to your .env file
NASA_API_KEY
Clone the project
git clone https://github.com/Willpower0304/Nasa_API_Astro.gitGo to the project directory
cd Nasa_API_AstroInstall dependencies
pnpm installSet up environment variables
NASA_API_KEY=your_api_key_hereStart the server
pnpm run devOpen your browser Navigate to http://localhost:4321 to view the application
If you want to deploy this project on Netlify install the dependencies if not just ignore this part.
Install dependencies
pnpm add @astrojs/netlify@^6.5.9This project is configured for easy deployment on Netlify:
Start the server
pnpm run buildThe build output will be in the dist/ folder, ready for deployment. go to https://app.netlify.com/drop to deploy the proyect on netlify.
If you have any feedback, please reach out to us at espinozaw657@gmail.com