This full-stack e-commerce platform is built using Angular, Spring Boot, MySQL, Okta, and Stripe, offering a comprehensive suite of features for seamless online shopping experiences.
- CRUD Operations: Perform Create, Read, Update, and Delete operations for products and orders.
- Authentication: Secure user login/logout functionality using Okta authentication services.
- Payment Processing: Integration with Stripe payment gateway for secure and reliable transaction processing.
- Dynamic Search: Filter products by category and keyword for enhanced product discovery.
- Pagination: Efficiently manage large datasets with pagination for smoother navigation.
- Shopping Cart: Add, remove, and update item quantities in the shopping cart for a seamless shopping experience.
- Secure Checkout: Secure and validated checkout form for accurate and secure order submissions.
- HTTPS Communication: Encryption of data transmission between frontend and backend for enhanced security.
- Email Receipts: Integration with Stripe for email receipts to provide customers with confirmation of their purchases.
ECommerceDemo.mp4
Before you begin, ensure you have met the following requirements:
-
Node.js and npm installed
-
Java JDK 8 or higher installed
-
MySQL Server and MySQL Workbench installed
-
Okta Developer Account
- Sign up for a free Okta Developer Account
- Create a new application in Okta and note down the
Client ID
,Client Secret
, andIssuer
URL
-
Stripe Account
- Sign up for a free Stripe Account
- Retrieve the
Publishable Key
andSecret Key
from the Stripe Dashboard
-
Clone the Repository
git clone https://github.com/aumsoni2002/PRJ666ProjectGrp6.git cd PRJ666ProjectGrp6/ecommerceFE
-
Install Dependencies
npm install
-
Environment Configuration
- Create a
src/enviornments/enviornment.ts
file in thefrontend
directory. - Add the following configuration:
eCommerceApiUrl=https://localhost:8443/api stripePublishableKey=YOUR_STRIPE_PUBLISHABLE_KEY production=false
- Create a
-
Run the Application
npm start
-
Import the Project
- Open Spring Tool Suite or your preferred IDE.
- Import the
backend
directory as an existing Maven project.
-
Database Configuration
- Open
src/main/resources/application.properties
. - Configure the MySQL database connection:
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.url=jdbc:mysql://localhost:3306/YOUR_DATABASE_NAME?useSSL=false&useUnicode=yes&characterEncoding=UTF-8&allowPublicKeyRetrieval=true&serverTimezone=UTC spring.datasource.username=root spring.datasource.password=root_password spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect spring.data.rest.base-path=/api allowed.origins=https://localhost:4200 spring.data.rest.detection-strategy=ANNOTATED okta.oauth2.client-id=YOUR_OKTA_CLIENT_ID okta.oauth2.issuer=YOUR_OKTA_ISSUER_URL ##### # HTTPS configuration ##### # Server web port server.port=8443 # Enable HTTPS support (only accept HTTPS requests) server.ssl.enabled=true # Alias that identifies the key in the key store server.ssl.key-alias=ecommerce # Keystore location server.ssl.key-store=classpath:ecommerce-keystore.p12 # Keystore password server.ssl.key-store-password=secret # Keystore format server.ssl.key-store-type=PKCS12 ##### # Payment Processing with Stripe ##### stripe.key.secret=YOUR_STRIPE_SECRET_KEY
- Open
-
Run the Application
- Run the
EcommerceApplication.java
to start the Spring Boot application.
- Run the
-
Create Database
CREATE DATABASE ecommerce_db;
-
Import Database Schema
- Navigate to
PRJ666ProjectGrp6/MySQL Database/db-scripts
and run the MySQL scripts one by one in the following order:01-create-user.sql
03-refresh-database-with-100-products.sql
04-countries-and-states.sql
05-create-order-tables.sql
06-refactor-database-to-add-unique-email.sql
- You can execute the scripts using MySQL Workbench or any MySQL command-line tool.
- Navigate to
-
Download and install Win64 OpenSSL v1.1.x Light.
-
During installation, choose the default settings.
-
Add OpenSSL to your system path:
- Open MS Windows Control Panel > System > Advanced System Settings > Environment Variables.
- Add
c:\Program Files\OpenSSL-Win64\bin;
to the beginning of thePath
variable.
-
Open a new command prompt.
-
Run:
openssl help
-
Navigate to your Angular ecommerce project directory:
cd ecommerceFE
-
Create a directory for output files:
mkdir ssl-localhost
-
Create
localhost.conf
inangular-ecommerce
with:[req] prompt = no distinguished_name = dn [dn] C = US ST = Pennsylvania L = Philadelphia O = ecommerce OU = Training CN = localhost
-
Generate key and certificate:
openssl req -x509 -out ssl-localhost\localhost.crt -keyout ssl-localhost\localhost.key -newkey rsa:2048 -nodes -sha256 -days 365 -config localhost.conf
-
Verify the generated files:
dir ssl-localhost
You should see
localhost.crt
andlocalhost.key
. -
View the certificate details:
openssl x509 -noout -text -in ssl-localhost/localhost.crt
-
Navigate to your Spring Boot ecommerce project directory:
cd ecommerceBE
-
Run the following command to generate the key and certificate:
keytool -genkeypair -alias ecommerce -keystore src/main/resources/ecommerce-keystore.p12 -keypass secret -storeType PKCS12 -storepass secret -keyalg RSA -keysize 2048 -validity 365 -dname "C=US, ST=Pennsylvania, L=Philadelphia, O=ecommerce, OU=Training Backend, CN=localhost" -ext "SAN=dns:localhost"
Argument Description -genkeypair Generates a key pair -alias Alias name of the entry -keystore Output keystore file -keypass Key password -storeType Keystore type -storepass Keystore password -keyalg Key algorithm -keysize Key bit size -validity Validity in days -dname Distinguished name -ext X.509 extension -
Verify the generated files:
keytool -list -v -alias ecommerce -keystore src/main/resources/ecommerce-keystore.p12 -storepass secret
- Edit
application.properties
and add:##### # HTTPS configuration ##### # Server web port server.port=8443 # Enable HTTPS server.ssl.enabled=true # Key alias server.ssl.key-alias=ecommerce # Keystore location server.ssl.key-store=classpath:ecommerce-keystore.p12 # Keystore password server.ssl.key-store-password=secret # Keystore format server.ssl.key-store-type=PKCS12
-
Start the Backend Server
- Navigate to the
backend
directory and run the Spring Boot application.
- Navigate to the
-
Start the Frontend Server
- Navigate to the
frontend
directory and run the Angular application.
- Navigate to the
-
Access the Application
- Open a web browser and go to
https://localhost:4200
to access the ECommerce application.
- Open a web browser and go to
Congratulations! You've configured our E-Commerce Full Stack Application!!