A secure and scalable RESTful E-Commerce Backend built using Spring Boot. The application provides JWT Authentication, Role-Based Authorization (ADMIN & USER), Product Management, Category Management, Shopping Cart, Order Management, Image Upload, Pagination, Product Search, and Swagger API Documentation.
#📌 Project Overview:
This project is a backend REST API for an E-Commerce application developed using Spring Boot. It follows a layered architecture consisting of Controller, Service, Repository, and Entity layers.
The application includes secure authentication using JWT, role-based access control, product and category management, shopping cart functionality, order processing, global exception handling, validation, pagination, and search functionality.
- User Registration
- User Login
- JWT Authentication
- Role-Based Authorization (ADMIN & USER)
- BCrypt Password Encryption
- Add Product
- Update Product
- Delete Product
- View All Products
- Get Product By ID
- Product Search
- Pagination & Sorting
- Add Category
- Update Category
- Delete Category
- View Categories
- Add Product to Cart
- View Cart
- Remove Cart Item
- Clear Cart
- Place Order
- View My Orders
- View Order Details
- Cancel Order
- Image Upload
- DTO Pattern
- Bean Validation
- Global Exception Handling
- Custom Exceptions
- Swagger API Documentation
- Java 21
- Spring Boot 3.5.3
- Spring Security
- Spring Data JPA (Hibernate)
- JWT (JSON Web Token)
- MySQL
- Maven
- Postman
- Swagger UI (OpenAPI)
- Spring Tool Suite (STS)
Client (Postman / React)
│
▼
Spring Boot REST API
│
┌──────────────────┼──────────────────┐
│ │ │
Authentication Business Logic Validation │ │ │ └──────────────────┼──────────────────┘ │ Spring Data JPA │ ▼ MySQL Database
src ├── controller ├── service ├── repository ├── entity ├── dto ├── config ├── exception ├── resources └── EcommerceApplication.java
| Method | Endpoint |
|---|---|
| POST | /auth/register |
| POST | /auth/login |
| Method | Endpoint |
|---|---|
| GET | /categories |
| POST | /categories |
| PUT | /categories/{id} |
| DELETE | /categories/{id} |
| Method | Endpoint |
|---|---|
| GET | /products |
| GET | /products/{id} |
| GET | /products/search |
| GET | /products/category/{id} |
| POST | /products |
| PUT | /products/{id} |
| DELETE | /products/{id} |
| Method | Endpoint |
|---|---|
| POST | /cart/add |
| GET | /cart |
| DELETE | /cart/remove/{id} |
| DELETE | /cart/clear |
| Method | Endpoint |
|---|---|
| POST | /orders |
| GET | /orders |
| GET | /orders/{id} |
| PUT | /orders/cancel/{id} |
git clone https://github.com/YOUR_GITHUB_USERNAME/ecommerce.git
## 2️> Create Database
```sql
CREATE DATABASE ecommerce;Update the following file:
src/main/resources/application.properties
Configure:
- MySQL Username
- MySQL Password
- JWT Secret
Run:
EcommerceApplication.java
or
mvn spring-boot:runSwagger UI:
http://localhost:8080/swagger-ui/index.html
- React Frontend
- Payment Gateway Integration
- Wishlist Module
- Product Reviews & Ratings
- Email Notifications
- Docker Support
- Cloud Deployment
Divya Chaurasiya
B.Tech Computer Science Engineering
Java Backend Developer | Spring Boot | REST APIs | MySQL