Skip to content

malakasaber/ECommerceSystem_Frontend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

E-Commerce Order Management System

Backend Repo: https://github.com/malakasaber/ECommerceSystem_Backend

Project Demo: https://drive.google.com/file/d/1yZc-7vJwi4sl1XabbeYBlKAKOP6drESl/view?usp=sharing

Microservices Architecture • Python Flask • Java JSP (Jakarta EE) • MySQL • SOA Project

This project is part of the Service-Oriented Architecture course. It demonstrates how to design and build an E-Commerce Order Management System using microservices, REST APIs, distributed databases, and a Java JSP frontend acting as an API Gateway.

The system simulates real-world architecture used in online shopping platforms.


Features

Microservices Architecture (5 Flask Services)
Java JSP Frontend (API Gateway)
RESTful Inter-Service Communication
MySQL Database Integration
Service Orchestration & Composition
Clean, scalable, distributed design

Project - Frontend - Structure

/webapp
├── index.jsp # Displays product catalog
├── checkout.jsp # Order creation form
├── confirmation.jsp # Order confirmation page
├── WEB-INF/
│ ├── web.xml
│ └── lib/
/src
└── main
    └── java
        └── org/example/ecommercesystemjsp
            ├── CheckoutServlet.java
            ├── InventoryServlet.java
            ├── OrderServlet.java
            ├── CustomerServlet.java
            ├── NotificationServlet.java
            └── PricingServlet.java       

Technology Stack

Frontend

  • Java JSP
  • Servlets (Jakarta EE)
  • Apache Tomcat 10.x

Backend (Microservices)

Each service uses:

  • Python 3.8+
  • Flask
  • Requests (inter-service communication)
  • mysql-connector-python (where required)

Database

  • MySQL 8.0
  • Multiple service-specific tables

Port Configuration

Service Port
JSP Gateway 8080
Order Service 5001
Inventory Service 5002
Pricing Service 5003
Customer Service 5004
Notification Service 5005

Microservices Breakdown

1. Order Service (Port 5001)

  • Accepts order creation requests
  • Validates input
  • Generates order ID and timestamp
  • Returns confirmation

Endpoints

  • POST /api/orders/create
  • GET /api/orders/<order_id>

2. Inventory Service (Port 5002)

  • MySQL-powered service
  • Checks product stock
  • Updates inventory
  • Fetches unit price

Endpoints

  • GET /api/inventory/check/<product_id>
  • PUT /api/inventory/update

Database Table: inventory Fields: product_id, product_name, quantity_available, unit_price, last_updated


3. Pricing Service (Port 5003)

  • Calculates final pricing
  • Fetches discounts & taxes
  • Calls Inventory Service

Endpoint

  • POST /api/pricing/calculate

Database Tables

  • pricing_rules
  • tax_rates

4. Customer Service (Port 5004)

  • Manages customer data
  • Fetches profile
  • Retrieves order history (calls Order Service)
  • Updates loyalty points

Endpoints

  • GET /api/customers/<customer_id>
  • GET /api/customers/<customer_id>/orders
  • PUT /api/customers/<customer_id>/loyalty

5. Notification Service (Port 5005)

  • Aggregates data from Customer + Inventory services
  • Logs notifications
  • Simulates email/SMS sending

Endpoint

  • POST /api/notifications/send

Database Table

  • notification_log

Frontend (Java JSP)

Required pages:

  • index.jsp → Loads product catalog from Inventory Service
  • checkout.jsp → User selects products & submits order
  • confirmation.jsp → Displays order details

Servlets handle:

  • Reading JSP form input
  • Sending JSON requests to Python services
  • Forwarding responses to JSP

Example: OrderServlet.java


Database Setup

Create database:

CREATE DATABASE ecommerce_system;
USE ecommerce_system;

Create all required tables

(from Inventory, Pricing, Customer, Notification services)

Insert sample data

  • Products
  • Pricing rules
  • Customers

Create a limited-privilege MySQL user:

CREATE USER 'ecommerce_user'@'localhost' IDENTIFIED BY 'secure_password';
GRANT SELECT, INSERT, UPDATE ON ecommerce_system.* TO 'ecommerce_user'@'localhost';
FLUSH PRIVILEGES;

Setup Instructions

Phase 1: Environment Setup

  1. Install:

    • Python 3.8+
    • MySQL 8.0
    • Java JDK 17+
    • Apache Tomcat 10
  2. Clone this repository

  3. Create database + tables

  4. Configure credentials in each microservice


Phase 2: Run the Services

1️. Create virtual environment for each service:

python -m venv env
source env/bin/activate   # Mac/Linux
env\Scripts\activate      # Windows

2️. Install dependencies:

pip install flask mysql-connector-python requests

3️. Run each service:

python app.py

Phase 3: Run JSP Frontend

  1. Open JSP project in NetBeans/IntelliJ
  2. Add Jakarta EE + Tomcat server
  3. Deploy app to Tomcat (port 8080)

Workflow Example

  1. User selects products → JSP sends POST to OrderService
  2. OrderService validates → calls PricingService
  3. PricingService → calls InventoryService & DB
  4. OrderService finalizes → returns order_id
  5. NotificationService receives order_id → calls CustomerService + InventoryService
  6. Notification logged + output simulated

Testing

  • Use Postman to test individual microservices
  • Use curl for REST endpoints
  • JSP pages test the entire workflow end-to-end

About

A part of Service Oriented Architecture Course. Microservices Architecture • Python Flask • Java JSP (Jakarta EE) • MySQL

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors