Skip to content

Larrykatuva/Technical-Test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Order Management Microservice

Overview

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.

Tech Stack

  • Framework: NestJS
  • Language: TypeScript
  • Database: PostgreSQL or MongoDB (your choice)
  • Testing: Jest
  • Containerization: Docker
  • Optional Caching: Redis

Microservices Architecture

1. Order Service

Handles order creation, updates, and status management.

REST Endpoints:

  • POST /api/orders - Create a new order
  • GET /api/orders/:id - Retrieve order details
  • GET /api/orders - List orders with pagination
  • PATCH /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

2. Inventory Service

Manages product inventory and availability.

REST Endpoints:

  • GET /api/inventory/:productId - Get product availability
  • POST /api/inventory/check - Bulk check product availability
  • PATCH /api/inventory/:productId - Update inventory

Communication Between Services

  • Synchronous Communication: Implemented using HTTP/REST.
  • Asynchronous Communication: Using events (Redis pub/sub or RabbitMQ).

Testing

Comprehensive testing strategy included:

  • Unit Tests: For services and controllers.
  • Integration Tests: For API endpoints.
  • End-to-End Tests: For critical workflows.

Getting Started

Prerequisites

  • Docker
  • Docker-compose

Installation

  1. Clone the repository:

    https://github.com/Larrykatuva/Technical-Test.git
    
  2. Give execute permissions to scripts:

    chmod +x scripts/databases.sh
    
  3. Run the application using Docker:

    docker-compose up -d
    
  4. To seed products data:

    http://localhost:3000/inventory/seed

About

Senior Backend Engineer Technical Test

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors