Ecom is a fully-featured e-commerce web application built using Spring Boot. It implements core e-commerce functionalities including user authentication, product management, shopping cart operations, and admin controls with role-based access.
ps : I have not made the front-end that appealing :') , but its fully functional ;)
- User registration and authentication
- Role-based access control (ADMIN and USER roles)
- User profile management
- User blacklisting system
- Product listing and details
- Product availability status
- Product CRUD operations (Admin only)
- Product search and filtering
- Add/remove items to cart
- Update item quantities
- View cart contents
- Cart persistence across sessions
- User management (view, ban/unban users)
- Product inventory management
- Access to blacklisted users
- Admin profile management
- Java 17
- Spring Boot
- Spring Security
- Spring Data JPA
- Hibernate
- BCrypt Password Encryption
- JPA/Hibernate for ORM
- Compatible with any JPA-supported database (MySQL, PostgreSQL, etc.)
- JSP (JavaServer Pages)
- HTML/CSS
- Bootstrap (assumed based on the structure)
+---src
¦ +---main
¦ ¦ +---java
¦ ¦ ¦ +---org
¦ ¦ ¦ +---keval
¦ ¦ ¦ +---ecom
¦ ¦ ¦ ¦ EcomApplication.java
¦ ¦ ¦ ¦
¦ ¦ ¦ +---config
¦ ¦ ¦ ¦ SecurityConfig.java
¦ ¦ ¦ ¦
¦ ¦ ¦ +---controller
¦ ¦ ¦ ¦ AdminController.java
¦ ¦ ¦ ¦ AuthController.java
¦ ¦ ¦ ¦ CustomerController.java
¦ ¦ ¦ ¦ ItemController.java
¦ ¦ ¦ ¦
¦ ¦ ¦ +---model
¦ ¦ ¦ ¦ Blacklist.java
¦ ¦ ¦ ¦ Cart.java
¦ ¦ ¦ ¦ Customer.java
¦ ¦ ¦ ¦ CustomerPrincipal.java
¦ ¦ ¦ ¦ Items.java
¦ ¦ ¦ ¦ Role.java
¦ ¦ ¦ ¦
¦ ¦ ¦ +---repo
¦ ¦ ¦ ¦ BlacklistRepo.java
¦ ¦ ¦ ¦ CartRepo.java
¦ ¦ ¦ ¦ CustomerRepo.java
¦ ¦ ¦ ¦ ItemRepo.java
¦ ¦ ¦ ¦
¦ ¦ ¦ +---service
¦ ¦ ¦ BlacklistService.java
¦ ¦ ¦ CartService.java
¦ ¦ ¦ CustomerService.java
¦ ¦ ¦ ItemService.java
¦ ¦ ¦
¦ ¦ +---resources
¦ ¦ ¦ ¦ application.properties
¦ ¦ ¦ ¦
¦ ¦ ¦ +---static
¦ ¦ ¦ ¦ ecom.jpg
¦ ¦ ¦ ¦
¦ ¦ ¦ +---templates
¦ ¦ +---webapp
¦ ¦ +---META-INF
¦ ¦ +---jsp
¦ ¦ addItems.jsp
¦ ¦ AdminPortal.jsp
¦ ¦ Blacklist.jsp
¦ ¦ EditAdmin.jsp
¦ ¦ EditUser.jsp
¦ ¦ error.jsp
¦ ¦ home.jsp
¦ ¦ ItemEditor.jsp
¦ ¦ login.jsp
¦ ¦ ManageItems.jsp
¦ ¦ register.jsp
¦ ¦ UserList.jsp
¦ ¦ UserPortal.jsp
¦ ¦ ViewCart.jsp
¦ ¦ ViewItems.jsp
¦ ¦
¦ +---test
¦ +---java
¦ +---org
¦ +---keval
¦ +---ecom
¦ EcomApplicationTests.java
¦
+---target
+---classes
¦ ¦ application.properties
¦ ¦
¦ +---org
¦ ¦ +---keval
¦ ¦ +---ecom
¦ ¦ ¦ EcomApplication.class
¦ ¦ ¦
¦ ¦ +---config
¦ ¦ ¦ SecurityConfig.class
¦ ¦ ¦
¦ ¦ +---controller
¦ ¦ ¦ AdminController.class
¦ ¦ ¦ AuthController.class
¦ ¦ ¦ CustomerController.class
¦ ¦ ¦ ItemController.class
¦ ¦ ¦
¦ ¦ +---model
¦ ¦ ¦ Blacklist.class
¦ ¦ ¦ Cart.class
¦ ¦ ¦ Customer.class
¦ ¦ ¦ CustomerPrincipal.class
¦ ¦ ¦ Items.class
¦ ¦ ¦ Role.class
¦ ¦ ¦
¦ ¦ +---repo
¦ ¦ ¦ BlacklistRepo.class
¦ ¦ ¦ CartRepo.class
¦ ¦ ¦ CustomerRepo.class
¦ ¦ ¦ ItemRepo.class
¦ ¦ ¦
¦ ¦ +---service
¦ ¦ BlacklistService.class
¦ ¦ CartService.class
¦ ¦ CustomerService.class
¦ ¦ ItemService.class
¦ ¦
¦ +---static
¦ ecom.jpg
¦
- Java 17 or higher
- Maven
- Your preferred IDE (IntelliJ IDEA recommended)
- MySQL or any other compatible database
- Clone the repository:
git clone [repository-url]
cd ecom
- Configure database connection in
application.properties
:
spring.datasource.url=jdbc:mysql://localhost:3306/ecom_db
spring.datasource.username=your_username
spring.datasource.password=your_password
spring.jpa.hibernate.ddl-auto=update
- Create the database:
CREATE DATABASE ecom_db;
- Build the project:
mvn clean install
- Run the application:
mvn spring-boot:run
The application will be available at http://localhost:8080
You can create an admin user by directly inserting into the database:
INSERT INTO customer (name, email, password, role)
VALUES ('Admin', 'admin@ecom.com', '[bcrypt-encoded-password]', 'ROLE_ADMIN');
Note: Use BCryptPasswordEncoder to generate the password hash.
- Register a new account
- Login with credentials
- Browse products
- Add products to cart
- Manage cart
- Update profile
- Login with admin credentials
- Manage products (add/edit/delete)
- View all users
- Ban/unban users
- View blacklisted users
- Edit admin profile
- Session management
- CSRF protection (disabled for this implementation)
- Password encryption using BCrypt
- Role-based access control
- Blacklist system for banned users
- GET
/login
- Login page - POST
/auth
- Authentication endpoint - GET
/logout
- Logout - POST
/register
- User registration - GET
/register
- Registration page
- GET
/user/portal
- User dashboard - GET
/user/cart
- View cart - POST
/user/buyItem
- Add to cart - POST
/user/adds
- Update cart quantity - POST
/user/remove
- Remove from cart - GET
/user/edit
- Edit profile page - POST
/user/edit
- Update profile
- GET
/admin/portal
- Admin dashboard - POST
/admin/addItem
- Add new product - GET
/admin/users
- View all users - GET
/admin/ban
- Ban user - GET
/admin/unban
- Unban user - GET
/admin/blacklist
- View blacklisted users - GET
/admin/manage
- Manage products - GET
/admin/editItem
- Edit product page - POST
/admin/editIt
- Update product - GET
/admin/deleteItem
- Delete product
Please follow these steps for contributing:
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request