This project implements a microservice-based order management system for an e-commerce platform, focusing on best practices in software engineering, including API design, testing, and microservices architecture. The system consists of two primary services: the Order Service and the Inventory Service.
- Framework: NestJS
- Language: TypeScript
- Database: PostgreSQL or MongoDB (your choice)
- Testing: Jest
- Containerization: Docker
- Optional Caching: Redis
Handles order creation, updates, and status management.
REST Endpoints:
POST /api/orders- Create a new orderGET /api/orders/:id- Retrieve order detailsGET /api/orders- List orders with paginationPATCH /api/orders/:id/status- Update order status
Order Object Structure:
- Order ID
- Customer Information: name, email, shipping address
- Order Items: product ID, quantity, price
- Total Amount
- Status: PENDING, CONFIRMED, SHIPPED, DELIVERED
- Timestamps: created, updated
Manages product inventory and availability.
REST Endpoints:
GET /api/inventory/:productId- Get product availabilityPOST /api/inventory/check- Bulk check product availabilityPATCH /api/inventory/:productId- Update inventory
- Synchronous Communication: Implemented using HTTP/REST.
- Asynchronous Communication: Using events (Redis pub/sub or RabbitMQ).
Comprehensive testing strategy included:
- Unit Tests: For services and controllers.
- Integration Tests: For API endpoints.
- End-to-End Tests: For critical workflows.
- Docker
- Docker-compose
-
Clone the repository:
https://github.com/Larrykatuva/Technical-Test.git
-
Give execute permissions to scripts:
chmod +x scripts/databases.sh
-
Run the application using Docker:
docker-compose up -d
-
To seed products data:
http://localhost:3000/inventory/seed