Skip to content

zahidesad/E-commerce-website

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

E-commerce Website

This is a comprehensive e-commerce website project developed as part of an internship. The project utilizes a variety of modern technologies and frameworks to provide a robust online shopping experience.

Table of Contents

  • Features
  • Technologies Used
  • Setup and Installation
  • Database Schema
  • Project Structure
  • Usage
  • Contributing
  • License

Features

  • User registration and login
  • Product listing with categories
  • Search functionality
  • Shopping cart
  • Order placement
  • Admin panel for product management
  • Spring Security for authentication and authorization
  • TC Kimlik No (Turkish National ID) validation during registration

Technologies Used

  • Java: Core programming language
  • Spring Framework: Including Spring MVC, Spring Security, and Spring Data JPA
  • Hibernate: ORM tool for database interaction
  • MySQL: Relational database management system
  • JSP: JavaServer Pages for dynamic web content
  • Bootstrap: Frontend framework for responsive design
  • jQuery: JavaScript library for dynamic content
  • Tomcat: Java servlet container

Setup and Installation

Prerequisites

  • Java Development Kit (JDK) 8 or higher
  • Apache Maven
  • MySQL Server
  • Apache Tomcat

Steps

  1. Clone the repository git clone https://github.com/yourusername/ecommerce-website.git cd ecommerce-website

  2. Open a file called application.properties in the src/main/resources directory and fill in the following information according to your needs.

    #View Resolver settings
    spring.mvc.view.prefix=/WEB-INF/view/
    spring.mvc.view.suffix=.jsp
    
    #Server settings
    server.port=8080
    
    #Database settings
    spring.datasource.url=jdbc:mysql://localhost:3306/e-commerce-website
    spring.datasource.username=your_database_username
    spring.datasource.password=your_database_password
    spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
    
    #Hibernate settings
    spring.jpa.hibernate.ddl-auto=update
    spring.jpa.show-sql=true
    spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
    spring.jpa.open-in-view=true
    
    #E-mail verification
    spring.mail.host=smtp.gmail.com
    spring.mail.port=587
    spring.mail.username=your_email_address
    spring.mail.password=your_email_app_password
    spring.mail.properties.mail.smtp.auth=true
    spring.mail.properties.mail.smtp.starttls.enable=true
    spring.mail.properties.mail.debug=true
  3. Configure the database

    • Create a MySQL database named e-commerce-website.
    • Update the application.properties file with your MySQL username and password.
  4. Build the project

    • mvn clean install
  5. Deploy to Tomcat

    • Copy the generated WAR file from target/ecommerce-website.war to the webapps directory of your Tomcat server.
  6. Start the Tomcat server

Database Design:

Staj Projesi Database Tasarımı Güncellenmiş

Database Creation Commands:

1)  CREATE TABLE users (
    id INT AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(100),
    surname VARCHAR(255);
    tc_number BIGINT;
    birth_year INT;
    email VARCHAR(100) UNIQUE,
    mobile_number VARCHAR(15),
    security_question VARCHAR(200),
    answer VARCHAR(200),
    password VARCHAR(100),
    role VARCHAR(50),
    enabled TINYINT(1) DEFAULT 0
    verification_code VARCHAR(64)
);
2) CREATE TABLE address (
    id INT AUTO_INCREMENT PRIMARY KEY,
    user_id INT,
    address VARCHAR(500),
    city VARCHAR(100),
    state VARCHAR(100),
    country VARCHAR(100),
    FOREIGN KEY (user_id) REFERENCES users(id)
);
3)  CREATE TABLE category (
    id INT AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(200)
);
4)  CREATE TABLE category_relationship (
    parent_category_id INT,
    child_category_id INT,
    PRIMARY KEY (parent_category_id, child_category_id),
    FOREIGN KEY (parent_category_id) REFERENCES category(id),
    FOREIGN KEY (child_category_id) REFERENCES category(id)
);
5)  CREATE TABLE product (
    id INT AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(500),
    active VARCHAR(10)
    photo_data LONGBLOB
    photo_name VARCHAR(255)
);
6)  CREATE TABLE product_category (
    product_id INT,
    category_id INT,
    PRIMARY KEY (product_id, category_id),
    FOREIGN KEY (product_id) REFERENCES product(id),
    FOREIGN KEY (category_id) REFERENCES category(id)
);
7)  CREATE TABLE price (
    id INT AUTO_INCREMENT PRIMARY KEY,
    product_id INT,
    price INT,
    start_date DATE,
    end_date DATE,
    FOREIGN KEY (product_id) REFERENCES product(id)
);
8)  CREATE TABLE stock (
    id INT AUTO_INCREMENT PRIMARY KEY,
    product_id INT,
    quantity INT,
    FOREIGN KEY (product_id) REFERENCES product(id)
);
9)  CREATE TABLE cart (
    id INT AUTO_INCREMENT PRIMARY KEY,
    user_id INT,
    FOREIGN KEY (user_id) REFERENCES users(id)
);
10) CREATE TABLE cart_item (
    id INT AUTO_INCREMENT PRIMARY KEY,
    cart_id INT,
    product_id INT,
    quantity INT,
    price INT,
    total INT,
    FOREIGN KEY (cart_id) REFERENCES cart(id),
    FOREIGN KEY (product_id) REFERENCES product(id)
);
11) CREATE TABLE orders (
    id INT AUTO_INCREMENT PRIMARY KEY,
    user_id INT,
    order_date DATE,
    delivery_date DATE,
    payment_method VARCHAR(100),
    transaction_id VARCHAR(100),
    status VARCHAR(100),
    address_id INT
    FOREIGN KEY (user_id) REFERENCES users(id)
    FOREIGN KEY (address_id) REFERENCES address(id)
);
12) CREATE TABLE order_item (
    id INT AUTO_INCREMENT PRIMARY KEY,
    order_id INT,
    product_id INT,
    quantity INT,
    price INT,
    total INT,
    FOREIGN KEY (order_id) REFERENCES orders(id),
    FOREIGN KEY (product_id) REFERENCES product(id)
);

Usage

  1. User Registration: Users can register by providing their details including TC Kimlik No for validation.
  2. Login: Registered users can log in using their email and password.
  3. Product Browsing: Users can browse products by category.
  4. Search: Users can search for products using the search bar.
  5. Add to Cart: Users can add products to their cart and proceed to checkout.
  6. Admin Panel: Admin can manage products and categories.

Screens

Note: This is a backend project, so I didn't pay much attention to the frontend part.

General Screens

  1. Login Screen image

  2. Register Screen image

  3. Forgot Password Screen image

User's Screens

  1. Home Screen image

  2. Cart Screen image

  3. Proceed To Order Screen (I blacked out the address part because it is my own address.) image

  4. My Orders Screen image

  5. My Order Details Screen (I blacked out the address part because it is my own address.) image

  6. My Addresses Screen (I blacked out the address part because it is my own address.) image

  7. Add New Address Screen image

  8. Edit My Address Screen (I blacked out the address part because it is my own address.) image

Admin's Screens

  1. Home Screen image

  2. Add New Product Screen image

  3. All Product & Edit Products Screen image

  4. Edit Product Screen image

  5. Add New Price Screen image

  6. Add New Category Screen image

  7. Manage Category Relationship Screen image

  8. Orders Screen image

  9. View Order Details Screen image