E-Commerce Mini Store is a full-stack web application leveraging Spring Boot, Java, JWT, and MySQL, designed with a scalable microservices architecture. It provides a complete platform for product management, cart handling, order checkout, and user authentication with roles (CUSTOMER and MANAGER).
-
π€ User Authentication
- Register and login functionality
- Role-based access (CUSTOMER and MANAGER)
- JWT-based stateless authentication
-
ποΈ Product Mangement
- Managers can add, update, and delete products
- Customers and Managers can view all available products
-
π Cart System
- Add, update, and remove items from cart
- Customers can checkout orders
| Category | Technologies |
|---|---|
| Backend | |
| Database | |
| Security | |
| Frontend | |
| Microservices |
.idea/
βββ .gitignore
βββ compiler.xml
βββ encodings.xml
βββ jarRepositories.xml
βββ misc.xml
βββ vcs.xml
api-gateway/
βββ .mvn/
βββ wrapper/
βββ maven-wrapper.properties
βββ src/
βββ main/
βββ java/
βββ com/
βββ example/
βββ api_gateway/
βββ config/
βββ CircuitBreakerConfig.java
βββ GatewayConfig.java
βββ fallback/
βββ FallbackController.java
βββ ApiGatewayApplication.java
βββ resources/
βββ application.properties
βββ test/
βββ java/
βββ com/
βββ example/
βββ api_gateway/
βββ ApiGatewayApplicationTests.java
βββ .gitattributes
βββ .gitignore
βββ mvnw
βββ mvnw.cmd
βββ pom.xml
E-commerceMiniStore/
βββ .mvn/
βββ wrapper/
βββ maven-wrapper.properties
βββ src/
βββ main/
βββ java/
βββ com/
βββ example/
βββ E_commerceMiniStore/
βββ config/
βββ PasswordConfig.java
βββ controller/
βββ AuthController.java
βββ CartItemController.java
βββ OrderController.java
βββ ProductController.java
βββ ViewController.java
βββ entity/
βββ CartItem.java
βββ Order.java
βββ Product.java
βββ Role.java
βββ User.java
βββ repository/
βββ CartItemRepository.java
βββ OrderRepository.java
βββ ProductRepository.java
βββ UserRepository.java
βββ security/
βββ JwtAuthenticationFilter.java
βββ JwtService.java
βββ SecurityConfig.java
βββ service/
βββ CartItemService.java
βββ OrderService.java
βββ ProductService.java
βββ UserService.java
βββ ECommerceMiniStoreApplication.java
βββ resources/
βββ META-INF/
βββ additional-spring-configuration-metadata.json
βββ static/
βββ Login.html
βββ navbar.js
βββ QR.jpeg
βββ Register.html
βββ templates/
βββ cart.html
βββ dashboard.html
βββ inventory.html
βββ login.html
βββ payment.html
βββ products.html
βββ register.html
βββ application.properties
βββ test/
βββ java/
βββ com/
βββ example/
βββ E_commerceMiniStore/
βββ ECommerceMiniStoreApplicationTests.java
βββ .gitattributes
βββ .gitignore
βββ mvnw
βββ mvnw.cmd
βββ pom.xml
service-discovery/
βββ .mvn/
βββ wrapper/
βββ maven-wrapper.properties
βββ src/
βββ main/
βββ java/
βββ ServiceDiscoveryApplication.java
βββ resources/
βββ application.properties
βββ test/
βββ java/
βββ com/
βββ example/
βββ service_discovery/
βββ ServiceDiscoveryApplicationTests.java
βββ .gitattributes
βββ .gitignore
βββ mvnw
βββ mvnw.cmd
βββ pom.xml
LICENSE
README.md
- Java 21
- Maven
- MySQL
- Postman (for API testing)
-
Clone the Repository:
git clone https://github.com/Anmol283/E-commerceMiniStore cd E-Commerce-MiniStore -
Configure Database: Update
application.propertieswith yourMySQLcredentials:spring.datasource.url=jdbc:mysql://localhost:3306/ecommerce_db spring.datasource.username=root spring.datasource.password=your_password spring.jpa.hibernate.ddl-auto=update jwt.secret=YourSecretKey jwt.expirationMs=3600000
-
Build and run the application:
mvn clean install mvn spring-boot:run
- POST
/api/auth/registerβ Register new user - POST
/api/auth/loginβ Login and get JWT
- GET
/api/productsβ Get all products (any role) - POST
/api/productsβ Add product (MANAGER only) - PUT
/api/products/{id}β Update product (MANAGER only) - DELETE
/api/products/{id}β Delete product (MANAGER only)
- GET
/api/cart?userId={id}β Get cart items (CUSTOMER only) - POST
/api/cart/addβ Add item to cart (CUSTOMER only) - PUT
/api/cart/{id}β Update cart item (CUSTOMER only) - DELETE
/api/cart/{id}β Remove cart item (CUSTOMER only)
- GET
/api/orders/my?userId={id}β Get user orders (CUSTOMER only) - POST
/api/orders/checkout?userId={id}β Checkout cart (CUSTOMER only)
- JWT-based stateless authentication
- Role-based access
(CUSTOMER and MANAGER) - Password hashing with BCrypt
- Protected API routes using Spring Security
- Routing: All requests go through the API Gateway before reaching microservices
- Load Balancing: Can distribute traffic between service instances
- Fallbacks: Resilience4j circuit breakers ensure safe fallback responses if a service is down
- Resilience4j Circuit Breaker: Protects services from cascading failures
- Fallback Mechanisms: If a microservice fails, the gateway provides default/fallback responses
- Timeouts & Retry Policies: Ensures API responsiveness even during service downtime
- Fork the repository
- Create a new branch (
git checkout -b feature-branch) - Make your changes and commit (
git commit -m "Add feature") - Push to the branch (
git push origin feature-branch) - Create a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
β Star this repository if you find it useful! β
