This project is a React-based e-commerce application deployed using AWS services. It leverages AWS CDK for infrastructure management and provides a set of scripts to facilitate development, testing, and deployment.
To get started with this project, follow these steps:
Before deploying this application, you need to configure your AWS credentials. Make sure you have:
- AWS CLI installed (
npm install -g aws-cdk) - An AWS account
- Access Key ID and Secret Access Key with appropriate permissions
- Run AWS configure command:
aws configure
AWS Access Key ID [None]: YOUR_ACCESS_KEY [[1]](https://docs.aws.amazon.com/prescriptive-guidance/latest/modernization-net-applications-security/iam-development.html)
AWS Secret Access Key [None]: YOUR_SECRET_KEY [[2]](https://docs.aws.amazon.com/toolkit-for-visual-studio/latest/user-guide/deployment-beanstalk-specify-credentials.html)
Default region name [None]: us-east-1
Default output format [None]: json
# Verify configuration
aws configure list
# Configure named profiles (optional)
aws configure --profile dev
aws configure --profile prod
# Use specific profile
aws configure list --profile devBefore deploying CDK applications for the first time in an AWS environment (account/region), you need to bootstrap the environment:
cdk bootstrap-
Deploy the project using AWS CDK:
npm run cdk:deploy
-
Destroy the deployed resources using AWS CDK:
npm run cdk:destroy
Make sure you have the following installed on your machine:
- Node.js (version 14.0.0 or higher)
- npm (version 6 or higher)
- AWS CLI (configured with appropriate credentials)
- AWS CDK (version 2.178.2 or higher)
Before you begin, ensure your environment is set up correctly:
-
Configure AWS CLI:
aws configure
Follow the prompts to set up your AWS credentials.
-
Install AWS CDK globally:
npm install -g aws-cdk
-
Bootstrap your AWS environment:
cdk bootstrap
- Clone the repository:
git clone https://github.com/your-username/nodejs-aws-shop-react.git
- Navigate to the project directory:
cd nodejs-aws-shop-react - Install the dependencies:
npm install --legacy-peer-deps
To run the project, you can use the following scripts:
-
Start the project in development mode:
npm run start
-
Build the project:
npm run build
-
Preview the production build:
npm run preview
-
Run tests:
npm run test -
Run tests with UI:
npm run test:ui
-
Run tests with coverage:
npm run test:coverage
-
Lint the code:
npm run lint
-
Format code with Prettier:
npm run prettier
-
Deploy the application using AWS CDK:
npm run cdk:deploy
-
Destroy the deployed AWS resources:
npm run cdk:destroy
Now you are ready to start developing with the React-shop-cloudfront project!