CrateMind API Documentation

API references for CrateMind Microservices. This project demonstrates high-performance order management, inventory control, packing, and delivery coordination using event-driven architectures.

Order Service URL: http://localhost:8081 Inventory Service URL: http://localhost:8082

Endpoints Quick Index

POST /orders

Create a new order (Current Implementation)

Creates a new order containing a customer ID and a list of items to be processed by the microservices backend.

Request Body

Field Type Required Description
customerId string Yes * Unique identifier of the customer placing the order. Example: "cust-12345"
items array Yes * List of order items containing product ID and quantity.
JSON Payload Schema
{
  "customerId": "cust-12345",
  "items": [
    {
      "productId": "9",
      "quantity": 2
    }
  ]
}

Responses

Order created successfully. Returns the UUID of the newly generated order.

Response Body (UUID string)
"123e4567-e89b-12d3-a456-426614174000"
POST /api/v1/orders Bearer Authentication

Place Order (v1 Planned)

Endpoint defined in locust load tests. Expects idempotency key and JWT authentication. Utilizes distributed locking and caching mechanisms.

Request Body

Field Type Required Description
userId integer Yes * Numeric user identifier. Example: 1234
items array Yes * List of order items.
idempotencyKey string Yes * Idempotency key to prevent duplicate processing. Example: "idemp-key-1234-567890"
JSON Payload Schema
{
  "userId": 1234,
  "items": [
    {
      "productId": "1",
      "quantity": 3
    },
    {
      "productId": "11",
      "quantity": 1
    }
  ],
  "idempotencyKey": "idemp-key-1234-567890"
}

Responses

Order successfully placed.

Data conflict or Optimistic lock failure under high load.

Response Body
"Data conflict / Optimistic lock failure under load"
GET /api/v1/inventory Bearer Authentication

View Inventory (v1 Planned)

Endpoint defined in locust load tests to fetch current inventory status across all catalog items.

Responses

Successfully fetched trending catalog inventory details.

Response Body (Array<InventoryItem>)
[
  {
    "productId": "1",
    "quantity": 100,
    "reservedQty": 10
  },
  {
    "productId": "2",
    "quantity": 45,
    "reservedQty": 0
  }
]