Explore the cosmos through NASA's lens! Cosmic Lens is a responsive web application built using HTML, JavaScript, and Tailwind CSS. It allows users to interact with two of NASA's fascinating APIs: Mars Rover Photos and Astronomy Picture of the Day (APOD). With a clean UI, modern design, and responsive layout, it brings the wonders of space closer to you.
Check out the live site here: Cosmic Lens Live
-
π Mars Rover Photos
- View images captured by Curiosity, Spirit, or Opportunity rovers.
- Filter by a specific Earth date.
-
π Astronomy Picture of the Day (APOD)
- Automatically fetches the latest NASA-curated image or video.
- Displays the title and a brief explanation.
-
π Responsive Design
- Fully optimized layout for all screen sizes.
- Mobile-first experience with a hamburger menu for navigation.
-
π Interactive UI
- Centered forms, responsive image grid, hover underline effects, and elegant transitions.
-
β No External CSS Files
- Styling is managed using Tailwind CSS via CDN and inline
<style>for custom animations.
- Styling is managed using Tailwind CSS via CDN and inline
- Endpoint:
https://api.nasa.gov/mars-photos/api/v1/rovers/{rover}/photos - Parameters:
earth_date,api_key
- Endpoint:
https://api.nasa.gov/planetary/apod - Parameters:
api_key
- User selects a rover and Earth date.
- Clicks the "Send" button.
- Fetches and displays photos in a responsive gallery.
- Alerts user if no photos are found.
- Loads the daily image or video, its title, and description on page load.
- Shares project and rover background information.
- Fixed, transparent navbar with backdrop blur.
- Hover underline effects.
- Mobile hamburger menu for responsive navigation.
- Transparent, backdrop-blurred footer.
- Hover underline on copyright.
CosmicLens/
βββ index.html # Mars Rover Photos page
βββ check.js # JS for Mars Rover API
βββ apod.html # APOD page
βββ apod.js # JS for APOD API
βββ about.html # Static About page
βββ README.md # Documentation
- Modern browser (Chrome, Firefox, Edge, etc.)
- Active internet connection
- A valid NASA API key
- Clone the repo:
git clone https://github.com/PranavHendre02/Cosmic-Lens.git- Open
index.htmlin a web browser. - Use navbar links to access other pages (
apod.html,about.html).
- Mars Rover Photos: Choose rover, date, and click "Send" to view images.
- APOD: Automatically displays the latest astronomy media and description.
- Responsive Menu: Tap the hamburger icon on small screens for navigation links.
Used for structuring content on all pages (index.html, apod.html, about.html).
Handles API calls, DOM manipulation, and dynamic content loading.
check.js- Fetches and renders Mars Rover images based on selected date and rover.apod.js- Loads the daily APOD with title and description.
Used via CDN for utility-first styling.
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">Custom inline styles enhance hover effects and transitions.
Example Tailwind HTML structure:
<div class="bg-black text-white p-4">
<h1 class="text-3xl font-bold underline">CosmicLens</h1>
</div>- Responsive: Adjusts from 1 to 4-column layout based on screen size.
- Browser Support: Backdrop-filter requires modern browsers.
- API Rate Limit: 1000 requests/hour (per API key).
- Extensible: Add rover date validation, date range filters, or use more NASA APIs.
- NASA APIs for image data.
- Tailwind CSS for modern UI.
- Icons8 for logo design.
For educational use only. Compliant with NASA's API terms.
