GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com β€” GitHub - Zapwap123/eCommerceLab: A lightweight and scalable Node.js REST API for analyzing eCommerce data, including customer insights such as top-spending customers. Built with Express.js and MySQL, and deployed on AWS using EC2 and RDS.

BranchesTags
Open more actions menu

Latest commit

 

History

8 Commits
8 Commits

Folders and files

NameName
Last commit message
Last commit date
config
config
 
 
eCommerceLabPictures
eCommerceLabPictures
 
 
routes
routes
 
 
.gitignore
.gitignore
 
 
README.md
README.md
 
 
docker-compose.yml
docker-compose.yml
 
 
ecommerce_init.sql
ecommerce_init.sql
 
 
ecosystem.config.js
ecosystem.config.js
 
 
index.js
index.js
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 

Repository files navigation

eCommerceLab API

This is Node.js REST API that connects to an Amazon RDS Aurora MySQL database, hosted on an Ubuntu-based EC2 instance. The app uses Express.js for routing and PM2 for production process management.


Features

  • REST API built with Node.js + Express.js
  • Database: Amazon RDS (Aurora MySQL)
  • Secure configuration using .env
  • EC2 (Ubuntu 22.04+) host
  • Managed with PM2

Architecture

Client  β†’  EC2 (Node.js App)  β†’  RDS (Aurora MySQL)

πŸ”— Live App / API Endpoints

Base URL: http://<your-ec2-ip>:3000 or Mine: http://54.217.181.120:3000

Endpoint Description
/ Root route – confirms API is live
/api/topCustomer Get the top customer(s) by Spending
/api/monthlySalesReport Get the monthly sales report
/api/productsNeverOrdered List products that were never ordered
/api/countryAverageOrderValue Get average order value by country
/api/frequentBuyers Get customers with frequent purchases

Note: Replace <your-ec2-ip> with your actual EC2 public IP or public DNS hostname.


1. AWS RDS (Aurora MySQL) Setup

  1. Go to AWS RDS > Create Database
  2. Choose:
    • Engine: Amazon Aurora
    • Edition: Aurora MySQL-Compatible
    • Capacity: Provisioned
    • DB cluster identifier: zeth-ecommercedb
    • Master username: admin
    • Password: your secure password
  3. Connectivity settings:
    • Make it publicly accessible
    • Choose/select a VPC and security group that allows access from EC2
  4. After creation, note the endpoint URL and port (3306)

2. EC2 (Ubuntu) Setup

  1. Launch an EC2 instance (Ubuntu 22.04 or similar)
  2. Allow inbound traffic on:
    • SSH (22) for access
    • HTTP (80) if needed
    • Custom TCP 3000 for API (or use NGINX)
  3. SSH into instance:
ssh -i your-key.pem ubuntu@your-ec2-public-ip

3. Install Required Tools on EC2

sudo apt update && sudo apt upgrade -y
sudo apt install -y git nodejs npm mysql-client
sudo npm install -g pm2

4. Clone the Repository

git clone https://github.com/your-username/eCommerceLab.git
cd eCommerceLab

Or Clone mine:

git clone https://github.com/Zapwap123/eCommerceLab.git
cd eCommerceLab

5. Create .env File

touch .env
nano .env

Example content:

DB_HOST=your-rds-endpoint.amazonaws.com
DB_USER=admin
DB_PASS=yourpassword
DB_NAME=ecommerce

6. Initialize the Database (from EC2)

If you have a SQL script (ecommerce_init.sql):

mysql -h your-rds-endpoint.amazonaws.com -u admin -p < ecommerce_init.sql

To import into specific DB:

mysql -h your-rds-endpoint.amazonaws.com -u admin -p ecommerce < ecommerce_init.sql

7. Install App Dependencies

npm install

8. Run the App with PM2

pm2 start index.js --name ecommerce-api
pm2 save
pm2 startup

9. Test the API

curl http://your-ec2-public-ip:3000/

Project Structure

eCommerceLab/
β”œβ”€β”€ config/
β”‚   └── db.js
β”œβ”€β”€ routes/
β”‚   └── customers.js
β”œβ”€β”€ ecommerce_init.sql
β”œβ”€β”€ .env
β”œβ”€β”€ index.js
β”œβ”€β”€ package.json
└── README.md

PM2 Management

pm2 list
pm2 logs ecommerce-api
pm2 restart ecommerce-api
pm2 delete ecommerce-api

Security Notes

  • Don’t commit your .env file β€” ensure .gitignore includes it
  • Use a strong password for your RDS admin
  • Limit inbound access to RDS using security group rules

About

A lightweight and scalable Node.js REST API for analyzing eCommerce data, including customer insights such as top-spending customers. Built with Express.js and MySQL, and deployed on AWS using EC2 and RDS.

Topics

awsdockerec2-instancejavascriptmysqlnodejspm2rds-mysql

Resources

Readme
Activity

Stars

0 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 β€” GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800Γ—600. No cookies required.