🛒 E-Commerce Website (Spring Boot)
This is a simple e-commerce website built using Spring Boot . It provides features for 👤 authentication, 📦 product management, 🛍️ cart functionality, and 🏷️ order & payment processing.
👤 User Registration & 🔑 Authentication (Spring Security, JWT)
🛍️ Product Management (CRUD operations for admin)
🛒 Shopping Cart & 📦 Order Management
🌐 RESTful API for integration
🗄️ Database support with MySQL / PostgreSQL
⚙️ Backend: Spring Boot, Spring Security, Hibernate, JPA
🗄️ Database: MySQL / PostgreSQL
🔑 Authentication: JWT-based authentication
📥 Clone the repository:
git clone https://github.com/yourusername/springboot-ecom.git
cd springboot-ecom
⚙️ Configure the database: Update application.properties
:
spring.datasource.url =jdbc:mysql://localhost:3306/ecomdb
spring.datasource.username =root
spring.datasource.password =yourpassword
▶️ Run the application:
🔑 Authentication Endpoints
API Name
Endpoint
Method
Purpose
🔐 Sign In
/signin
POST
Authenticate a user
✍️ Sign Up
/signup
POST
Register a new user
🚪 Sign Out
/signout
POST
Sign out the user
🔍 Current Username
/username
GET
Retrieve the username of the authenticated user
👤 User Info
/user
GET
Retrieve user information
🏪 All Sellers
/sellers
GET
Retrieve a paginated list of sellers
API Name
Endpoint
Method
Purpose
➕ Add Product
/api/admin/categories/{categoryId}/product
POST
Adds a new product to a category
📋 Get All Products
/api/public/products
GET
Retrieves all products
📂 Get Products by Category
/api/public/categories/{categoryId}/products
GET
Retrieves products by category
🔍 Get Products by Keyword
/api/public/products/keyword/{keyword}
GET
Searches products by keyword
🔄 Update Product
/api/products/{productId}
PUT
Updates an existing product
🔄 Update Product Image
/api/products/{productId}/image
PUT
Updates an existing product
❌ Delete Product
/api/products/{productId}
DELETE
Delete a product
API Name
Endpoint
Method
Purpose
➕ Add Category
/api/admin/category
POST
Add a new category
📋 Get Categories
/api/public/categories
GET
Retrieve all categories
✏️ Update Category
/api/admin/category/{categoryId}
PUT
Update a category
❌ Delete Category
/api/admin/category/{categoryId}
DELETE
Delete a category
API Name
Endpoint
Method
Purpose
➕ Add to Cart
api/carts/products/{productId}/quantity/{quantity}
POST
Add a product to cart
🛒 Get All Carts
/api/carts
GET
Retrieves List of all carts
🛒 Get Users Cart
/api/carts/users/cart
GET
Retrieves the cart of logged- in user
🔄 Update Product Quantity
/api/carts/products/{productId}/quantity/{operation}
PUT
Update cart item quantity
❌ Remove Item
/api/cart/{cartId}/products/{productId}
DELETE
Remove an item from cart
API Name
Endpoint
Method
Purpose
➕ Create Address
/api/addresses/add
POST
Add a new address
📋 Get All Addresses
/api/addresses
GET
Retrieve all addresses
📋 Get Addresses By ID
/api/addresses/{addressId}
GET
Retrieve an address by Id
📋 Get Addresses By User
/api/users/addresses
GET
Retrieve user's addresses
✏️ Update Address
/api/addresses/{addressId}
PUT
Update an address by Id
❌ Delete Address
/api/addresses/{addressId}
DELETE
Delete an address by Id
👤 User Registration & 🔑 Authentication: Users register and authenticate using JWT tokens.
🛍️ Product Browsing: Users browse available products fetched from the 🗄️ database.
🛒 Shopping Cart: Users can add products to their cart before proceeding to checkout.
💰 Checkout Process: An order is created upon checkout.
📦 Order Management: Admins can view and manage orders, updating their statuses.
🏛️ Database Schema & Relationships
👤 Users: Stores user details (🆔, ✉️ email, 🏷️ username, 🔒 password).
👑 Roles & User Roles: Defines user roles (👨💼 admin, 🛍️ customer, 🏪 seller).
📦 Products: Stores product details (🆔, 🏷️ name, 💰 price, 🔖 discount, 🖼️ image, 📊 stock, 📁 category, 🏪 seller).
📁 Categories: Stores product categories.
🛒 Carts & Cart Items: Temporary storage for products added to the cart.
📦 Orders & Order Items: Stores finalized purchases and ordered products.
💳 Payments: Tracks payment methods used for orders.
📍 Addresses & User Address: Stores user shipping addresses.
A 👤 user can have multiple 👑 roles (many-to-many).
A 👤 user can have multiple 📍 addresses (one-to-many).
A 🛒 cart belongs to a 👤 user (one-to-one).
A 🛒 cart can have multiple 🛍️ cart items (one-to-many).
An 📦 order belongs to a 👤 user (one-to-many).
An 📦 order contains multiple 📋 order items (one-to-many).
A 📦 product belongs to a 📁 category (many-to-one).
A 📦 product can have multiple 🛍️ cart items and 📋 order items (one-to-many).
(Include 📸 screenshots of the working application here)
Feel free to 🍴 fork the project and submit pull requests!
This project is licensed under the MIT License.