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.
- Features
- Technologies Used
- Setup and Installation
- Database Schema
- Project Structure
- Usage
- Contributing
- License
- 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
- 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
- Java Development Kit (JDK) 8 or higher
- Apache Maven
- MySQL Server
- Apache Tomcat
-
Clone the repository git clone https://github.com/yourusername/ecommerce-website.git cd ecommerce-website
-
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
-
Configure the database
- Create a MySQL database named e-commerce-website.
- Update the application.properties file with your MySQL username and password.
-
Build the project
- mvn clean install
-
Deploy to Tomcat
- Copy the generated WAR file from target/ecommerce-website.war to the webapps directory of your Tomcat server.
-
Start the Tomcat server
- Access the application at http://localhost:8080/ecommerce-website
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)
);
- User Registration: Users can register by providing their details including TC Kimlik No for validation.
- Login: Registered users can log in using their email and password.
- Product Browsing: Users can browse products by category.
- Search: Users can search for products using the search bar.
- Add to Cart: Users can add products to their cart and proceed to checkout.
- Admin Panel: Admin can manage products and categories.
Note: This is a backend project, so I didn't pay much attention to the frontend part.
-
Proceed To Order Screen (I blacked out the address part because it is my own address.)
-
My Order Details Screen (I blacked out the address part because it is my own address.)
-
My Addresses Screen (I blacked out the address part because it is my own address.)
-
Edit My Address Screen (I blacked out the address part because it is my own address.)