A full-stack web application that leverages NASA's open APIs to provide access to Astronomy Picture of the Day (APOD) and Mars Rover photos through a user-friendly interface and RESTful services.
This project is an advanced Spring Boot application that demonstrates integration with NASA's public APIs while implementing modern web development practices including security, database persistence, and responsive UI design.
- Astronomy Picture of the Day (APOD): View and manage NASA's daily astronomy images
- Mars Rover Photos: Browse photos from Mars rovers with filtering by rover, camera, and date
- Dual Interface: Both web UI (using Thymeleaf) and REST API access
- Security: JWT-based authentication with role-based access control
- Database Storage: Persistent storage of APOD entries
- API Documentation: Comprehensive OpenAPI/Swagger documentation
- Exception Handling: Robust error handling for a better user experience
- Spring Boot 3 and Spring Framework 6
- Spring Security with JWT and OAuth2 resource server
- Spring Data JPA for database operations
- MySQL database for persistence
- OpenAPI/Swagger for API documentation
- Thymeleaf for server-side templating
- Bootstrap for responsive UI design
- HTML5 and CSS3 for modern web standards
- Docker for containerization
- AWS Elastic Beanstalk for cloud hosting
- Java 17+
- Maven 3.8+
- MySQL 8.0+
- NASA API Key (get one at https://api.nasa.gov/)
-
Clone the repository:
git clone https://github.com/your-username/nasa-api-implementation.git cd nasa-api-implementation -
Configure the database and API key in
application.properties -
Build and run the application:
mvn spring-boot:run
-
Access the application:
- Web UI: http://localhost:5000/nasa/home-page
- Swagger Documentation: http://localhost:5000/swaggerdoc.html
For detailed setup instructions, see the Setup Guide.
The application provides the following RESTful endpoints:
GET /api/apod: Fetch the current Astronomy Picture of the DayGET /api/apods: Fetch all stored APOD entriesGET /api/apod/{id}: Fetch a specific APOD by IDPUT /api/apod/{id}: Update an APOD entry (Admin role required)DELETE /api/apod/{id}: Delete an APOD entry (Admin role required)
GET /api/rover/{roverName}/{earthDate}/{roverCamera}: Fetch Mars Rover photos based on criteria
POST /authenticate: Generate a JWT token for API access
This application implements a comprehensive security model:
- Form-based authentication for web interface
- JWT authentication for REST API
- Role-based access control:
EMPLOYEErole: Can view APOD and Mars Rover photosADMINrole: Can additionally manage APOD entries (update, delete)
- SecurityConfiguration with URL-based security rules
- Method-level security with
@PreAuthorizeannotations
The project follows a layered architecture pattern:
- Controller Layer: Handles incoming HTTP requests (MVC and REST)
- Service Layer: Contains business logic and interacts with external APIs
- Repository Layer: Manages database operations
- Model Layer: Defines entity and data transfer objects
- Security Layer: Manages authentication and authorization
- Exception Handling: Provides global exception handling
For a detailed explanation of project structure, see the Contributing Guide.
docker build -t nasa-api-implementation .
docker run -p 5000:5000 nasa-api-implementationThe application is configured for easy deployment to AWS Elastic Beanstalk. See the Setup Guide for details.
Contributions are welcome! Please see our Contributing Guide for details on how to get started.
This project is licensed under the MIT License - see the LICENSE file for details.
- NASA Open APIs for providing the data
- Spring Boot for the framework
- Bootstrap for the UI components
- All contributors who have helped improve this project
For questions or suggestions, please contact your-email@example.com.


