This project is an e-commerce website implementation using Spring Framework, Spring MVC, Hibernate for database management, and Thymeleaf for the frontend. The application supports both customer and admin functionalities, including user registration, item management, shopping cart, order processing, and integration with payment services. The application uses JWT for authentication, ensuring a stateless session management approach.
-
User Registration and Email Verification
- Customers can register on the website and must verify their accounts to activate their accounts.
- Customers can't register if the email or phone number already exists in the system.
- Before email verification, the customer account is deactivated. After verification, it becomes activated.
- Passwords must be strong, with a minimum of 8 characters, including at least one uppercase letter, one lowercase letter, one special character, and one number.
-
Account Suspension and Reactivation
- After three incorrect password attempts, a customer's account is locked.
- Customers must enter their email to receive a reactivation email with a new password reset link.
-
Item Search and Filter
- Logged-in customers can search for items by name and view a list of matching items.
- Items can be filtered by category or price (high to low or low to high) and by most sold.
-
Shopping Cart Management
- Customers can add, update, and delete items in their shopping cart.
- The cart retains items even after session expiration or logging out and back in.
-
Order Preview and Submission
- Customers can preview their final order, check out, and submit it for delivery.
-
Order History
- Customers can view their order history, sorted by date, with item details such as name, image, category, price, and rating.
-
Payment Integration
- Customers can pay using their credit card, integrated with a payment gateway through RESTful web services.
-
Admin Management
- Admins can log in and manage other admins by adding, updating, and deleting admin accounts.
- Admins can search for other admins by their name.
- Super admins cannot be deleted and can only be inserted manually in the database.
-
Item Management
- Admins can add, update, delete, and list all items available on the e-commerce website.
-
Card Validation Service
- A RESTful API that validates card details including number, PIN, and expiration date.
-
Payment Processing Service
- Another RESTful API that processes payments by validating the card's balance and completing the transaction.
- Frontend: Thymeleaf
- Backend: Spring, Spring MVC, Hibernate
- Database: MySQL
- Authentication: JWT (JSON Web Token)
- Payment Services: RESTful APIs, Feign Client for integration
- Data Transfer: All requests are handled using DTOs (Data Transfer Objects) with validations applied on the DTOs.
-
Clone the Repository
git clone https://github.com/yourusername/e-commerce-website.git cd e-commerce-website -
Database Setup
- Ensure MySQL is installed and running.
- Create a database named
ecommerce. - Configure the database connection in
src/main/resources/application.properties.
-
Build and Run the Application
./mvnw clean install ./mvnw spring-boot:run
-
Access the Application
- Open a browser and navigate to
http://localhost:8080.
- Open a browser and navigate to
- Register an account and verify via email.
- Log in and search for items.
- Add items to the shopping cart.
- Filter items by price (high to low, low to high) or by most sold.
- Proceed to checkout and choose a payment method.
- Complete payment and view order history.
- Log in with admin credentials.
- Manage admin accounts, including searching for admins by name.
- Manage items on the website.
The project includes two RESTful APIs for card validation and payment processing:
-
Card Validation Service
- Endpoint:
/api/validate-card - Method: POST
- Request Body:
{ "cardNumber": "xxxx-xxxx-xxxx-xxxx", "pin": "1234", "expirationDate": "MM/YY" } - Response:
{ "valid": true/false, "message": "validation message" }
- Endpoint:
-
Payment Processing Service
- Endpoint:
/api/process-payment - Method: POST
- Request Body:
{ "cardNumber": "xxxx-xxxx-xxxx-xxxx", "amount": 100.00 } - Response:
{ "success": true/false, "message": "payment message" }
- Endpoint:
- Fork the repository.
- Create a new branch for your feature or bugfix.
- Commit your changes with descriptive messages.
- Push your branch and create a pull request.