> ## Documentation Index
> Fetch the complete documentation index at: https://engineering.clinikally.work/llms.txt
> Use this file to discover all available pages before exploring further.

# Commerce and consultation flows

> Evidence-based request and event paths for Clinikally transactions.

## Marketplace checkout

```mermaid theme={null}
sequenceDiagram
  participant C as Client
  participant V as Vector
  participant M as Medusa
  participant P as Mint
  participant G as Payment gateway
  participant O as Orderbox
  participant E as Estimo
  participant S as Storehouse
  participant N as Notify

  C->>V: Create/update checkout, address, promotion
  V->>M: Cart and commerce operations
  V->>P: Payment gRPC/API request
  P->>G: Create or process payment
  G-->>P: Gateway callback/webhook
  P-->>V: Payment outcome callback
  P->>O: Downstream order notification
  O->>E: Allocation/ETA lookup
  O->>S: Inventory reservation
  O-->>N: Order-related event
  N-->>C: Email, SMS, WhatsApp, or activity notification
```

### Direct evidence

* Vector router composition: `vector/app/api/v1/routes.py`.
* Vector checkout/payment orchestration: `vector/app/service/cart_orchestration_service.py`, `payment_service.py`, and `medusa_service.py`.
* Vector integration inventory: `vector/README.md` documents Medusa, Mint gRPC, Redis, SQS, SNS, short URLs, and Google Maps.
* Mint starts HTTP routers plus embedded gRPC: `mint/app/main.py`.
* Mint documents callbacks to Vector, Dermadesk, Orderbox, and Konsilo: `mint/README.md`.
* Medusa cart completion and cart-to-order paths: `medusa-store/src/api/store/carts/[cart_id]/complete-v2/route.ts` and `order/route.ts`.
* Orderbox integration clients: `orderbox/app/clients/estimo_client.py` and `reservation_client.py`.
* Storehouse reservation services: `storehouse/app/service/redis_reservation_service.py` and `reservation_service.py`.

<Warning>
  The end-to-end sequence shown after payment is a high-confidence integration inference based on direct downstream clients and documented callbacks. Trace IDs, runtime configuration, and actual queue payloads should be used to confirm any incident-specific path.
</Warning>

## Product discovery

1. Atlas publishes catalog-oriented APIs from `atlas/app/api/v1/endpoints/` and derives commerce data through Medusa service modules.
2. Compass exposes search/recommendation APIs at `compass/app/api/v1/endpoints/` and `app/api/v2/endpoints/`; its clients include Atlas, Medusa, Redis, and Netcore.
3. Tetris calls Strapi and Compass services to build CMS/recommendation responses: `tetris/app/services/strapi_client.py`, `recs_service.py`, and `fill_service.py`.

## Consultation transaction

1. Dermadesk owns booking, slot, consult-cart/order/payment, and prescription HTTP APIs in `dermadesk/app/api/v1/`.
2. Dermadesk verifies Mint and Konsilo gRPC readiness in `dermadesk/app/main.py`.
3. Konsilo exposes HTTP and gRPC from `konsilo-be/src/main.ts`, and owns clinical domain modules under `konsilo-be/src/`.
4. Mint's documented downstream callbacks include both Dermadesk and Konsilo.

## Inventory and fulfilment

Storehouse receives inventory/product/order events, performs Redis-backed atomic reservations, persists inventory/audit data, and synchronizes platforms. This is evidenced by `storehouse/app/main.py`, `worker_main.py`, `redis_reservation_service.py`, and `cross_platform_inventory_sync.py`. Estimo reads warehouse availability and applies geographic/delivery-mode rules from `estimo/app/service/delivery_service.py` and `pincode_service.py`. Orderbox owns ERP payloads, shipment, and return service code under `orderbox/app/service/v3/`.
