React-Poem-Finder-App
Quick Start
git clone https://github.com/jivaniyash/react-poem-finder-app.git
cd react-poem-finder-app
npm install
npm run dev
Table of Contents
Overview
This Project is built using React + Vite Application. It helps users to find & search poems quickly by typing keywords in the search bar.
Check out Project at CloudFront Link.
Check out the demo at GitHub
Features
- Overlays - are used to show/hide the metadata of the poem
- Search Bar - to filter the Poems by title/content, sorted by Ascending Order & by title first (Searchable across EN & GU languages)
- Pagination - to change the display of poems in a single page & Page Navigation at the bottom of the Screen
- Language - toggle to change the default global language and poem-level toggle
- Highlighter - to show the query search in the poem
Getting Started
Prerequisites
- git
- Node.js (18 or later)
- npm
- Vite (
npm install -g vite
) - AWS Account (with sufficient permissions to create & add files to an S3 Bucket)
Installation
-
Clone the Repository
git clone https://github.com/jivaniyash/react-poem-finder-app.git
-
Navigate to the project directory:
cd react-poem-finder-app
-
Install dependencies
npm install
-
Test on Local Machine
npm run dev
This will start the App @
http://localhost:5173
. You can remove the configuration -host: true
from the server parameter to disable access from other users on the same network -
Build the App
npm run build
This will generate a new
dist
directory at the root level. -
Preview Production Build Locally
npm run preview
This will start the App @
http://localhost:4173
Usage
There are two options to deploy the React app: either using an S3 website endpoint or CloudFront, with the connection secured.
Deploy App in AWS S3 Bucket and access via S3 public link
- Create an S3 Bucket with the uncheck Block all public access option to allow Public Access
- Once Bucket is created, navigate to the Properties tab & Enable Static website hosting
- Specify the default page of the website -
index.html
- Upload all the contents from the
dist
directory to the S3 Bucket - Open the Bucket website endpoint -
http://bucket-name.s3-website-region.amazonaws.com/
Deploy App in AWS S3 Bucket and access via AWS CloudFront
- Create an S3 Bucket with the
Block all public access option
- To configure a secure HTTPS connection, create a CloudFront distribution, configuring the domain from the S3 Bucket
- Select Origin access control(OAC) settings & create OAC to allow Bucket access for CloudFront
- Set
Redirect HTTP to HTTPS
& optional caching and domain settings - Set the root object as
index.html
- Copy & Paste the Policy of the OAC to the S3 Bucket
- Open the CloudFront Website Endpoint - https://id.cloudfront.net/
Deployment
- AWS Deployment using deploy.yml
- Create Access keys & Access Token from IAM User Console
- Open GitHub Repository Settings -> Under Security -> secrets and variables -> Actions -> Repository secrets
- Add
AWS_ACCESS_KEY_ID
- Add
AWS_SECRET_ACCESS_KEY
- Add
S3_BUCKET_NAME
- Add
CLOUDFRONT_DISTRIBUTION_ID
# if App is deployed to CloudFront for removing cache - Change GitHub Repository's
Code and automation
Settings -> Branches - Add a Branch protection rule to allow the deploy.yml file to run when new changes are pulled from a feature branch using Pull Requests.
Steps for Fresh Start
-
Run the following commands for a fresh start of the Project
npm create vite@latest my-project -- --template react cd my-project npm install npm run dev
Customize the directory and files to add/alter/remove the files for a particular use case
Check out more at my GitHub Repository
Top comments (0)