A full-stack web-based shopping system built with Spring Boot and modern web technologies. This application provides a complete e-commerce experience with user authentication, product browsing, shopping cart functionality, and order management.
-
User Management
- User registration and login
- Session management
- User profile display
-
Product Management
- Browse products by category
- Search functionality
- Product details with images
- Stock management
-
Shopping Cart
- Add/remove items
- Update quantities
- Real-time price calculation
- Stock validation
-
Order System
- Create orders from cart
- View order history
- Cancel pending orders
- Order status tracking
- Java 17
- Spring Boot 3.2.3
- Spring Data JPA
- Hibernate
- MySQL Database
- Maven
- HTML5
- CSS3 (Bootstrap 5.3.0)
- JavaScript (ES6+)
- Thymeleaf Template Engine
Before running the application, ensure you have the following installed:
- Java 17 or higher
- Maven
- MySQL Server
- Git (for cloning the repository)
-
Clone the Repository
git clone https://github.com/CarolineYXW/JAVA-Shopping-System cd JAVA-Shopping-System -
Database Setup
- Create a MySQL database named
shopping_system - The application will automatically create the necessary tables on startup
- Create a MySQL database named
-
Configure Database Connection
- Open
src/main/resources/application.properties - Update the database connection properties if needed:
spring.datasource.url=jdbc:mysql://localhost:3306/shopping_system spring.datasource.username=your_username spring.datasource.password=your_password
- Open
-
Build and Run
cd server ./mvnw clean spring-boot:runThe application will start on
http://localhost:8080
The system comes with two default users for testing:
- Username:
user1, Password:password1 - Username:
user2, Password:password2
server/
├── src/
│ ├── main/
│ │ ├── java/
│ │ │ └── com/pudding/final_project/
│ │ │ ├── controller/ # REST and web controllers
│ │ │ ├── model/ # Entity classes
│ │ │ ├── repository/ # Data access layer
│ │ │ ├── service/ # Business logic
│ │ │ └── config/ # Configuration classes
│ │ └── resources/
│ │ ├── static/ # Static resources (CSS, JS, images)
│ │ ├── templates/ # Thymeleaf templates
│ │ └── application.properties
│ └── test/ # Test files
└── pom.xml # Maven configuration
POST /api/auth/login- User loginPOST /api/auth/register- User registration
GET /api/items- Get all productsGET /api/items/category/{category}- Get products by categoryGET /api/items/{id}- Get product details
GET /api/cart/{userId}- Get user's cartPOST /api/cart/add- Add item to cartPOST /api/cart/update- Update cart item quantityDELETE /api/cart/remove/{userId}/{itemId}- Remove item from cart
POST /api/orders/create/{userId}- Create new orderGET /api/orders/user/{userId}- Get user's ordersPOST /api/orders/cancel/{orderId}- Cancel order