Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

12 Commits

Folders and files

Repository files navigation

NASA API Implementation

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.

NASA API Implementation Banner

Overview

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.

Key Features

  • 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

Technology Stack

Backend

  • 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

Frontend

  • Thymeleaf for server-side templating
  • Bootstrap for responsive UI design
  • HTML5 and CSS3 for modern web standards

Deployment

  • Docker for containerization
  • AWS Elastic Beanstalk for cloud hosting

Quick Start

Prerequisites

Setup

  1. Clone the repository:

    git clone https://github.com/your-username/nasa-api-implementation.git
    cd nasa-api-implementation
  2. Configure the database and API key in application.properties

  3. Build and run the application:

    mvn spring-boot:run
  4. Access the application:

For detailed setup instructions, see the Setup Guide.

Screenshots

Home Page

Home Page

APOD Display

APOD Display

Mars Rover Photos

Mars Rover Photos

API Endpoints

The application provides the following RESTful endpoints:

APOD Endpoints

  • GET /api/apod: Fetch the current Astronomy Picture of the Day
  • GET /api/apods: Fetch all stored APOD entries
  • GET /api/apod/{id}: Fetch a specific APOD by ID
  • PUT /api/apod/{id}: Update an APOD entry (Admin role required)
  • DELETE /api/apod/{id}: Delete an APOD entry (Admin role required)

Mars Rover Endpoints

  • GET /api/rover/{roverName}/{earthDate}/{roverCamera}: Fetch Mars Rover photos based on criteria

Authentication Endpoints

  • POST /authenticate: Generate a JWT token for API access

Security

This application implements a comprehensive security model:

  • Form-based authentication for web interface
  • JWT authentication for REST API
  • Role-based access control:
    • EMPLOYEE role: Can view APOD and Mars Rover photos
    • ADMIN role: Can additionally manage APOD entries (update, delete)
  • SecurityConfiguration with URL-based security rules
  • Method-level security with @PreAuthorize annotations

Project Structure

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.

Deployment

Docker

docker build -t nasa-api-implementation .
docker run -p 5000:5000 nasa-api-implementation

AWS Elastic Beanstalk

The application is configured for easy deployment to AWS Elastic Beanstalk. See the Setup Guide for details.

Contributing

Contributions are welcome! Please see our Contributing Guide for details on how to get started.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

Contact

For questions or suggestions, please contact your-email@example.com.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages