# rahul-02825/stocksyncservices architecture

> Architecture diagram of the GitHub repository rahul-02825/stocksyncservices, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rahul-02825/stocksyncservices
- Repository: https://github.com/rahul-02825/stocksyncservices

## Overview

StockSyncServices is a three-service inventory platform: users register and authenticate, managers create warehouses, suppliers create profiles and products, and managers approve supplier capacity requests. Supplier stock changes are published asynchronously and upserted into approved warehouses; managers can then retrieve synced stock. The README documents the cross-service event flow; sampled controllers and services confirm the main calls and stock handling. User-event linkage implementation and database wiring are not fully shown, so those relationships rely on README documentation.

Main entry points: [`warehouse-service/src/warehouse/warehouse.controller.ts`](https://github.com/rahul-02825/stocksyncservices/blob/main/warehouse-service/src/warehouse/warehouse.controller.ts) (Warehouse API and event handler), [`warehouse-service/src/warehouse/warehouse.service.ts`](https://github.com/rahul-02825/stocksyncservices/blob/main/warehouse-service/src/warehouse/warehouse.service.ts) (Warehouse workflow and stock sync), [`supplier-service/src/suppliers/suppliers.service.ts`](https://github.com/rahul-02825/stocksyncservices/blob/main/supplier-service/src/suppliers/suppliers.service.ts) (Supplier profiles and products), [`user-service/src/auth/auth.controller.ts`](https://github.com/rahul-02825/stocksyncservices/blob/main/user-service/src/auth/auth.controller.ts) (Auth API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Identity service"]
  node_user_api["Auth API<br/>[auth.controller.ts]"]
  node_auth_logic["Authentication<br/>[auth.service.ts]"]
  node_user_model["User model<br/>[user.schema.ts]"]
  node_user_db[("User database")]
  node_user_events["User event handler"]
  node_user_profiles["User profile updates<br/>[users.service.ts]"]
end

subgraph group_supplier["Supplier service"]
  node_supplier_api["Supplier API"]
  node_supplier_logic["Supplier profiles and products"]
  node_supplier_models["Supplier and product models"]
  node_supplier_db[("Supplier database")]
end

subgraph group_warehouse["Warehouse service"]
  node_warehouse_api["Warehouse API and event handler"]
  node_warehouse_logic["Warehouse workflow and stock sync"]
  node_warehouse_models["Warehouse and stock models"]
  node_warehouse_db[("Warehouse database")]
end

subgraph group_integration["Event integration"]
  node_rabbitmq["RabbitMQ"]
end

node_client(("Client"))

node_client -->|"HTTP requests"| node_user_api
node_client -->|"HTTP requests"| node_supplier_api
node_client -->|"HTTP requests"| node_warehouse_api
node_user_api -->|"calls"| node_auth_logic
node_auth_logic -->|"uses schema"| node_user_model
node_auth_logic -->|"reads and writes"| node_user_db
node_user_api -->|"returns JWT"| node_client
node_supplier_api -->|"calls"| node_supplier_logic
node_supplier_logic -->|"uses models"| node_supplier_models
node_supplier_logic -->|"reads and writes"| node_supplier_db
node_supplier_logic -->|"publishes events"| node_rabbitmq
node_rabbitmq -->|"delivers profile event"| node_user_events
node_user_events -->|"calls handlers"| node_user_profiles
node_user_profiles -->|"updates user"| node_user_db
node_supplier_api -->|"returns profile and products"| node_client
node_warehouse_api -->|"calls"| node_warehouse_logic
node_warehouse_logic -->|"uses models"| node_warehouse_models
node_warehouse_logic -->|"reads and writes"| node_warehouse_db
node_warehouse_logic -->|"publishes event"| node_rabbitmq
node_rabbitmq -->|"delivers warehouse event"| node_user_events
node_rabbitmq -->|"delivers stock event"| node_warehouse_api
node_warehouse_api -->|"dispatches stock event"| node_warehouse_logic
node_warehouse_api -->|"returns synced stock"| node_client

click node_user_api "https://github.com/rahul-02825/stocksyncservices/blob/main/user-service/src/auth/auth.controller.ts"
click node_auth_logic "https://github.com/rahul-02825/stocksyncservices/blob/main/user-service/src/auth/auth.service.ts"
click node_user_model "https://github.com/rahul-02825/stocksyncservices/blob/main/user-service/src/auth/schemas.ts/user.schema.ts"
click node_user_events "https://github.com/rahul-02825/stocksyncservices/blob/main/user-service/src/users/users.controller.ts"
click node_user_profiles "https://github.com/rahul-02825/stocksyncservices/blob/main/user-service/src/users/users.service.ts"
click node_supplier_api "https://github.com/rahul-02825/stocksyncservices/blob/main/supplier-service/src/suppliers/suppliers.controller.ts"
click node_supplier_logic "https://github.com/rahul-02825/stocksyncservices/blob/main/supplier-service/src/suppliers/suppliers.service.ts"
click node_supplier_models "https://github.com/rahul-02825/stocksyncservices/tree/main/supplier-service/src/suppliers/entities"
click node_warehouse_api "https://github.com/rahul-02825/stocksyncservices/blob/main/warehouse-service/src/warehouse/warehouse.controller.ts"
click node_warehouse_logic "https://github.com/rahul-02825/stocksyncservices/blob/main/warehouse-service/src/warehouse/warehouse.service.ts"
click node_warehouse_models "https://github.com/rahul-02825/stocksyncservices/tree/main/warehouse-service/src/warehouse/entities"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_user_api,node_auth_logic,node_user_model,node_user_db,node_user_events,node_user_profiles,node_client toneBlue
class node_supplier_api,node_supplier_logic,node_supplier_models,node_supplier_db toneAmber
class node_warehouse_api,node_warehouse_logic,node_warehouse_models,node_warehouse_db toneMint
class node_rabbitmq toneRose
```

## Components

### Identity service

- [Auth API](https://github.com/rahul-02825/stocksyncservices/blob/main/user-service/src/auth/auth.controller.ts): `user-service/src/auth/auth.controller.ts`
- [Authentication](https://github.com/rahul-02825/stocksyncservices/blob/main/user-service/src/auth/auth.service.ts): `user-service/src/auth/auth.service.ts`
- [User model](https://github.com/rahul-02825/stocksyncservices/blob/main/user-service/src/auth/schemas.ts/user.schema.ts): `user-service/src/auth/schemas.ts/user.schema.ts`
- **User database**
- [User event handler](https://github.com/rahul-02825/stocksyncservices/blob/main/user-service/src/users/users.controller.ts): `user-service/src/users/users.controller.ts`
- [User profile updates](https://github.com/rahul-02825/stocksyncservices/blob/main/user-service/src/users/users.service.ts): `user-service/src/users/users.service.ts`

### Supplier service

- [Supplier API](https://github.com/rahul-02825/stocksyncservices/blob/main/supplier-service/src/suppliers/suppliers.controller.ts): `supplier-service/src/suppliers/suppliers.controller.ts`
- [Supplier profiles and products](https://github.com/rahul-02825/stocksyncservices/blob/main/supplier-service/src/suppliers/suppliers.service.ts): `supplier-service/src/suppliers/suppliers.service.ts`
- [Supplier and product models](https://github.com/rahul-02825/stocksyncservices/tree/main/supplier-service/src/suppliers/entities): `supplier-service/src/suppliers/entities`
- **Supplier database**

### Warehouse service

- [Warehouse API and event handler](https://github.com/rahul-02825/stocksyncservices/blob/main/warehouse-service/src/warehouse/warehouse.controller.ts): `warehouse-service/src/warehouse/warehouse.controller.ts`
- [Warehouse workflow and stock sync](https://github.com/rahul-02825/stocksyncservices/blob/main/warehouse-service/src/warehouse/warehouse.service.ts): `warehouse-service/src/warehouse/warehouse.service.ts`
- [Warehouse and stock models](https://github.com/rahul-02825/stocksyncservices/tree/main/warehouse-service/src/warehouse/entities): `warehouse-service/src/warehouse/entities`
- **Warehouse database**

### Event integration

- **RabbitMQ**

### Other components

- **Client**

## Connections

- Client → Auth API: HTTP requests (evidence: `README.md`)
- Client → Supplier API: HTTP requests (evidence: `README.md`)
- Client → Warehouse API and event handler: HTTP requests (evidence: `README.md`)
- Auth API → Authentication: calls (evidence: `user-service/src/auth/auth.controller.ts`)
- Authentication → User model: uses schema (evidence: `user-service/src/auth/auth.service.ts`)
- Authentication → User database: reads and writes (evidence: `user-service/src/auth/auth.service.ts`)
- Auth API → Client: returns JWT (evidence: `README.md`)
- Supplier API → Supplier profiles and products: calls (evidence: `supplier-service/src/suppliers/suppliers.controller.ts`)
- Supplier profiles and products → Supplier and product models: uses models (evidence: `supplier-service/src/suppliers/suppliers.service.ts`)
- Supplier profiles and products → Supplier database: reads and writes (evidence: `supplier-service/src/suppliers/suppliers.service.ts`)
- Supplier profiles and products → RabbitMQ: publishes events (evidence: `supplier-service/src/suppliers/suppliers.service.ts`)
- RabbitMQ → User event handler: delivers profile event (evidence: `README.md`)
- User event handler → User profile updates: calls handlers (evidence: `user-service/src/users/users.controller.ts`)
- User profile updates → User database: updates user (evidence: `README.md`)
- Supplier API → Client: returns profile and products (evidence: `supplier-service/src/suppliers/suppliers.controller.ts`)
- Warehouse API and event handler → Warehouse workflow and stock sync: calls (evidence: `warehouse-service/src/warehouse/warehouse.controller.ts`)
- Warehouse workflow and stock sync → Warehouse and stock models: uses models (evidence: `warehouse-service/src/warehouse/warehouse.service.ts`)
- Warehouse workflow and stock sync → Warehouse database: reads and writes (evidence: `warehouse-service/src/warehouse/warehouse.service.ts`)
- Warehouse workflow and stock sync → RabbitMQ: publishes event (evidence: `warehouse-service/src/warehouse/warehouse.service.ts`)
- RabbitMQ → User event handler: delivers warehouse event (evidence: `README.md`)
- RabbitMQ → Warehouse API and event handler: delivers stock event (evidence: `README.md`)
- Warehouse API and event handler → Warehouse workflow and stock sync: dispatches stock event (evidence: `warehouse-service/src/warehouse/warehouse.controller.ts`)
- Warehouse API and event handler → Client: returns synced stock (evidence: `warehouse-service/src/warehouse/warehouse.controller.ts`)
