A modular eCommerce system built using microservices architecture. Each service is independently deployable, scalable, and responsible for a single domain. The platform includes services for user management, product catalog, order handling, and payment processing.
project-root/
├── user-service/
├── product-service/
├── order-service/
├── payment-service/
├── docker-compose.yml
└── README.md
- Description: Handles user registration, login, token management, and role assignments. Acts as the identity provider for the platform.
- Models:
BaseModel: id (auto-generated), deleted (boolean)User: name, email, hashed password, isVerified, one-to-many withUserRoleToken: data (string), expiryAt (long), many-to-one withUserUserRole: value (string), many-to-one withUser(via user_id)
- Endpoints:
POST /registerPOST /loginGET /me
- Responsibilities: Authentication, authorization, token validation
- Description: Manages product catalog including categories and product information.
- Models:
BaseEntity: id (auto-generated)Category: titleProduct: title, description, price, quantity, many-to-one withCategory
- Endpoints:
GET /products/{id}GET /productsPUT /products/{id}POST /productsGET /products/search
- Security: All endpoints require a valid token from the UserService
- Responsibilities: Catalog management, product search, category mapping
- Description: Handles order placement and manages the lifecycle of an order.
- Models:
Order: id, userId, productIds, status, createdAtOrderItem: productId, quantity, price, orderId
- Endpoints:
POST /orders- Create new orderGET /orders/{id}- View order by IDGET /orders- List orders by user
- Security: Requires valid token from UserService
- Responsibilities: Order creation, item grouping, tracking status
- Description: Handles payment processing via Razorpay SDK.
- Models:
Payment: id, orderId, amount, paymentStatus, transactionId
- Endpoints:
POST /payments/create-order- Initiate a Razorpay orderPOST /payments/verify- Verify a completed Razorpay payment
- Integration: Uses Razorpay SDK with keys configured via environment variables
- Security: Requires valid token and order validation before payment processing
- Responsibilities: Payment initiation, confirmation, and linking to orders
-
Make sure Docker and Docker Compose are installed.
-
Clone the repository and run:
docker-compose up --build
-
Each service will run on its own port:
- User Service: http://localhost:8001
- Product Service: http://localhost:8002
- Order Service: http://localhost:8003
- Payment Service: http://localhost:8004
-
Access logs or debug using standard Docker logs command:
docker-compose logs -f
- Each request to Product, Order, and Payment services must include a valid token header:
Token: <access_token>
- The token is issued by the User Service upon successful login or registration.
- If a token is invalid or expired, services will return HTTP 401 Unauthorized.
- Fully modular and independent microservices
- Centralized user authentication
- Product search and category filtering
- Secure order creation and tracking
- Razorpay integration for secure payments
- Token-based service-to-service authentication
- Dockerized for easy development and deployment