This project is a Microservices-based Ecommerce Backend API built using Spring Boot and *Spring Security. The backend manages product listings, sellers, customers, orders, and integrates *Razorpay for payment processing. All services communicate using REST APIs, and PostgreSQL is used for data management.
- π User authentication and authorization with Spring Security.
- ποΈ CRUD operations for products, sellers, customers, and orders.
- ποΈ Microservices architecture for better scalability and maintainability.
- π³ Integration with Razorpay for secure transaction handling.
- π¦ PostgreSQL for database management.
- π Secure API endpoints.
This project follows a Microservices Architecture:
- Product Service: Manages product details.
- Seller Service: Handles seller operations.
- Customer Service: Handles user data and customer operations.
- Order Service: Manages order details and processes transactions.
Each microservice has its own database schema and communicates with other services through REST APIs.
- Java 11+
- Maven
- PostgreSQL
- Razorpay API key
- Docker (optional for containerization)
-
Clone the repository: bash git clone https://github.com/Sucho6996/EcommerceBackend.git cd EcommerceBackend
-
Set up PostgreSQL:
- Create a separate database for each microservice: product_db, seller_db, customer_db, order_db.
- Update the application.properties file of each microservice with your PostgreSQL configurations.
-
Build and run each microservice: bash
cd product-service mvn clean install mvn spring-boot:run
cd ../seller-service mvn clean install mvn spring-boot:run
cd ../customer-service mvn clean install mvn spring-boot:run
cd ../order-service mvn clean install mvn spring-boot:run
-
Build Docker images: bash docker build -t product-service ./product-service docker build -t seller-service ./seller-service docker build -t customer-service ./customer-service docker build -t order-service ./order-service
-
Run Docker containers: bash docker run -d -p 8081:8081 product-service docker run -d -p 8082:8082 seller-service docker run -d -p 8083:8083 customer-service docker run -d -p 8084:8084 order-service
Each microservice is accessible via different ports:
- Product Service: http://localhost:8081
- Seller Service: http://localhost:8082
- Customer Service: http://localhost:8083
- Order Service: http://localhost:8084
GET /findAll
: Retrieve all products.POST /add
: Create a new product.GET /find/{id}
: Retrieve a product by ID.GET /search/{keyword}
: Retrieve products based on a keyword search.GET /image/{id}
: Retrieve a product image by ID.PUT /modify
: Update a product by ID.DELETE /delete/{id}
: Delete a product by ID.
GET /sellers
: Retrieve all sellersPOST /sellers
: Create a new sellerGET /sellers/{id}
: Retrieve a seller by IDPUT /sellers/{id}
: Update a seller by IDDELETE /sellers/{id}
: Delete a seller by ID
POST /signin
: Register a new user.POST /login
: Authenticate a user and return a JWT token.GET /findAll
: Retrieve all products.GET /find/{id}
: Retrieve a product by ID.GET /search/{keyword}
: Retrieve products based on a keyword search.GET /order
: Place an order with parameters for product ID, seller name, price, and phone number.GET /cart
: Add a product to the cart with parameters for product ID, seller name, price, and phone number.GET /view/{id}
: Retrieve user details by user ID (phone number).GET /orders/{id}
: Retrieve all orders for a user by user ID (phone number).GET /carts/{id}
: Retrieve all cart items for a user by user ID (phone number).GET /order/{id}
: Retrieve order details by order ID.GET /cart/{id}
: Retrieve cart details by cart ID.POST /save
: Save user details.
GET /view/orders/{id}
: Retrieve all orders for a user by user ID.GET /view/carts/{id}
: Retrieve all cart items for a user by user ID.GET /view/orderDetails/{id}
: Retrieve order details by order ID.GET /view/cartDetails/{id}
: Retrieve cart details by cart ID.POST /create/order
: Create a new order with product details (integrated with Razorpay for payment).POST /paymentCallback
: Update order status based on the payment response (callback from Razorpay).POST /save/cart
: Add a product to the cart with product details.GET /user/{phNo}
: Retrieve user details by phone number.GET /seller/{sellername}
: Retrieve seller details by seller name.GET /product/{pId}
: Retrieve product details by product ID.
Contributions are welcome! Please follow these steps:
-
Fork the repository π΄
-
Create a feature branch π bash git checkout -b feature-branch
-
Commit your changes πΎ bash git commit -m 'Add new feature'
-
Push to the branch π€ bash git push origin feature-branch
-
Open a pull request π¬
This project is licensed under the MIT License. See the LICENSE file for details.