This repository contains the Rover Frontend, a React-based application designed to interact with the Curiosity Rover API. It includes advanced features such as:
- Integration with Amazon Cognito User Pools for user authentication.
- Amazon CloudFront for secure, low-latency HTTPS hosting of the frontend.
- CI/CD pipelines for both
developandreleasebranches.
- Cognito User Pools: Enables secure user authentication using a hosted UI.
- CloudFront Distribution: Provides HTTPS hosting and caching for the frontend, ensuring secure and fast delivery of content.
- CI/CD Pipelines: Automates deployment processes for both development and production environments.
- Node.js (v18 or later)
- AWS CLI
- SAM CLI
- Access to an AWS account with sufficient permissions
- GitHub Actions secrets for
AWS_ACCESS_KEYandAWS_SECRET_ACCESS_KEY
.
├── src/ # Source code for the React app
│ ├── components/ # React components
│ ├── App.js # Main app file
│ ├── App.test.js # Unit tests for the app
│ └── index.js # Entry point for the React app
├── sam/ # SAM templates for infrastructure
│ └── template.yaml # SAM template for the infrastructure
├── .github/workflows/ # GitHub workflows
│ ├── develop.yml # Workflow for develop branch
│ └── release.yml # Workflow for release branch
└── README.md # Project documentation
Triggered on every push to the develop branch. This pipeline performs the following steps:
- Lint: Checks the codebase using ESLint.
- Test: Runs unit tests using Jest.
- Validate: Validates the SAM template.
Triggered on every push to the release branch. This pipeline performs the following steps:
- Deploy Infrastructure: Deploys resources defined in the SAM template, including Cognito User Pools and CloudFront.
- Build: Builds the React application.
- Sync to S3: Uploads the React app to the S3 bucket for hosting.
The application integrates with Amazon Cognito User Pools for secure user authentication. The authentication flow includes:
- A hosted UI for login.
- Tokens (
idToken,accessToken, andrefreshToken) are securely handled in localStorage. - A logout button to securely end user sessions.
The frontend is hosted using Amazon CloudFront to provide:
- HTTPS Support: Ensures secure communication between the browser and the app.
- Caching: Improves performance and reduces latency for end users.
-
Install dependencies:
npm install
-
Start the development server:
npm start
-
Access the app at
http://localhost:3000.
Run all unit tests with Jest:
npm testValidate the SAM template locally:
sam validate -t ./sam/template.yaml --region <your-region>To deploy infrastructure and sync the app manually:
-
Deploy infrastructure using SAM:
sam deploy --guided
-
Build the React app:
npm run build
-
Sync the build folder to S3:
aws s3 sync ./build s3://<your-bucket-name> --delete
- Fork this repository.
- Create a feature branch.
- Submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
For questions or suggestions, please open an issue in this repository.