# anandgadge2/msme_pugarch architecture

> Architecture diagram of the GitHub repository anandgadge2/msme_pugarch, 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/anandgadge2/msme_pugarch
- Repository: https://github.com/anandgadge2/msme_pugarch

## Overview

This is a procurement marketplace for organizational buyers and sellers, with a web client and a substantial API backend. The user-facing journey spans marketplace discovery, procurement participation and bidding, award-to-order, and fulfillment activities such as invoicing and delivery. Authentication and shared persistence support those domain stages. The supplied excerpts show selected backend and frontend relationships, but no README or broad route-registration excerpts; unverified links between client and server subsystems are therefore omitted.

Main entry points: [`backend/src/modules/procurementBid/procurement-bid.routes.ts`](https://github.com/anandgadge2/msme_pugarch/blob/main/backend/src/modules/procurementBid/procurement-bid.routes.ts) (Procurement bids), [`backend/src/modules/auth/auth.controller.ts`](https://github.com/anandgadge2/msme_pugarch/blob/main/backend/src/modules/auth/auth.controller.ts) (Authentication), [`backend/src/lib/prisma.ts`](https://github.com/anandgadge2/msme_pugarch/blob/main/backend/src/lib/prisma.ts) (Application database), [`frontend/src/App.tsx`](https://github.com/anandgadge2/msme_pugarch/blob/main/frontend/src/App.tsx) (Web application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_web["Web application<br/>[App.tsx]"]
  node_auth_ui["Session handling<br/>[useAuth.tsx]"]
  node_market_ui["Marketplace screens"]
  node_market_api["Marketplace API<br/>[api.ts]"]
end

subgraph group_identity["Identity and platform"]
  node_api_server["API server<br/>[app.ts]"]
  node_auth_controller["Authentication<br/>[auth.controller.ts]"]
  node_auth_cookie["Session cookies"]
  node_token["Token service<br/>[token.service.ts]"]
  node_database[("Application database<br/>[prisma.ts]")]
  node_cache["Cache service<br/>[cache.service.ts]"]
end

subgraph group_procurement["Procurement lifecycle"]
  node_market_backend["Marketplace routes"]
  node_bid_routes["Procurement bids"]
  node_bid_service["Bid operations"]
  node_evaluation["L1 comparison"]
end

subgraph group_fulfillment["Order fulfillment"]
  node_payments["Payments<br/>[payment.service.ts]"]
  node_delivery["Delivery tracking"]
  node_fulfillment_workflow["Fulfillment workflow"]
  node_invoice["Invoice PDF"]
end

node_user(("Buyer or seller"))

node_user -->|"uses"| node_web
node_web -->|"renders"| node_market_ui
node_web -->|"uses"| node_auth_ui
node_market_ui -->|"uses"| node_market_api
node_auth_ui -->|"calls auth endpoints"| node_auth_controller
node_api_server -.->|"serves"| node_auth_controller
node_auth_controller -->|"reads and writes"| node_database
node_auth_controller -->|"issues sessions"| node_auth_cookie
node_auth_cookie -->|"issues and verifies"| node_token
node_auth_cookie -->|"stores sessions"| node_database
node_database -->|"invalidates"| node_cache
node_api_server -.->|"serves"| node_market_backend
node_market_backend -->|"imports"| node_bid_routes
node_bid_routes -->|"delegates to"| node_bid_service
node_bid_routes -->|"caches bid data"| node_cache
node_bid_routes -->|"uses workflow"| node_fulfillment_workflow
node_fulfillment_workflow -->|"updates records"| node_database
node_fulfillment_workflow -->|"generates PDF"| node_invoice

click node_web "https://github.com/anandgadge2/msme_pugarch/blob/main/frontend/src/App.tsx"
click node_auth_ui "https://github.com/anandgadge2/msme_pugarch/blob/main/frontend/src/hooks/useAuth.tsx"
click node_market_ui "https://github.com/anandgadge2/msme_pugarch/blob/main/frontend/src/features/marketplace/pages/MarketplaceServiceDetail.tsx"
click node_market_api "https://github.com/anandgadge2/msme_pugarch/blob/main/frontend/src/features/marketplace/api.ts"
click node_api_server "https://github.com/anandgadge2/msme_pugarch/blob/main/backend/src/app.ts"
click node_auth_controller "https://github.com/anandgadge2/msme_pugarch/blob/main/backend/src/modules/auth/auth.controller.ts"
click node_auth_cookie "https://github.com/anandgadge2/msme_pugarch/blob/main/backend/src/services/auth-cookie.service.ts"
click node_token "https://github.com/anandgadge2/msme_pugarch/blob/main/backend/src/services/token.service.ts"
click node_database "https://github.com/anandgadge2/msme_pugarch/blob/main/backend/src/lib/prisma.ts"
click node_cache "https://github.com/anandgadge2/msme_pugarch/blob/main/backend/src/services/cache.service.ts"
click node_market_backend "https://github.com/anandgadge2/msme_pugarch/blob/main/backend/src/routes/marketplace.routes.ts"
click node_bid_routes "https://github.com/anandgadge2/msme_pugarch/blob/main/backend/src/modules/procurementBid/procurement-bid.routes.ts"
click node_bid_service "https://github.com/anandgadge2/msme_pugarch/blob/main/backend/src/modules/procurementBid/procurement-bid.service.ts"
click node_evaluation "https://github.com/anandgadge2/msme_pugarch/blob/main/backend/src/modules/l1Comparison/l1-comparison.service.ts"
click node_payments "https://github.com/anandgadge2/msme_pugarch/blob/main/backend/src/modules/payments/payment.service.ts"
click node_delivery "https://github.com/anandgadge2/msme_pugarch/blob/main/backend/src/modules/delivery/delivery.service.ts"
click node_fulfillment_workflow "https://github.com/anandgadge2/msme_pugarch/blob/main/backend/src/services/workflow/fulfillment-workflow.service.ts"
click node_invoice "https://github.com/anandgadge2/msme_pugarch/blob/main/backend/src/services/invoice-pdf.service.ts"

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_web,node_auth_ui,node_market_ui,node_market_api toneBlue
class node_api_server,node_auth_controller,node_auth_cookie,node_token,node_database,node_cache toneAmber
class node_market_backend,node_bid_routes,node_bid_service,node_evaluation toneMint
class node_payments,node_delivery,node_fulfillment_workflow,node_invoice toneRose
class node_user toneIndigo
```

## Components

### Web client

- [Web application](https://github.com/anandgadge2/msme_pugarch/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Session handling](https://github.com/anandgadge2/msme_pugarch/blob/main/frontend/src/hooks/useAuth.tsx): `frontend/src/hooks/useAuth.tsx`
- [Marketplace screens](https://github.com/anandgadge2/msme_pugarch/blob/main/frontend/src/features/marketplace/pages/MarketplaceServiceDetail.tsx): `frontend/src/features/marketplace/pages/MarketplaceServiceDetail.tsx`
- [Marketplace API](https://github.com/anandgadge2/msme_pugarch/blob/main/frontend/src/features/marketplace/api.ts): `frontend/src/features/marketplace/api.ts`

### Identity and platform

- [API server](https://github.com/anandgadge2/msme_pugarch/blob/main/backend/src/app.ts): `backend/src/app.ts`
- [Authentication](https://github.com/anandgadge2/msme_pugarch/blob/main/backend/src/modules/auth/auth.controller.ts): `backend/src/modules/auth/auth.controller.ts`
- [Session cookies](https://github.com/anandgadge2/msme_pugarch/blob/main/backend/src/services/auth-cookie.service.ts): `backend/src/services/auth-cookie.service.ts`
- [Token service](https://github.com/anandgadge2/msme_pugarch/blob/main/backend/src/services/token.service.ts): `backend/src/services/token.service.ts`
- [Application database](https://github.com/anandgadge2/msme_pugarch/blob/main/backend/src/lib/prisma.ts): `backend/src/lib/prisma.ts`
- [Cache service](https://github.com/anandgadge2/msme_pugarch/blob/main/backend/src/services/cache.service.ts): `backend/src/services/cache.service.ts`

### Procurement lifecycle

- [Marketplace routes](https://github.com/anandgadge2/msme_pugarch/blob/main/backend/src/routes/marketplace.routes.ts): `backend/src/routes/marketplace.routes.ts`
- [Procurement bids](https://github.com/anandgadge2/msme_pugarch/blob/main/backend/src/modules/procurementBid/procurement-bid.routes.ts): `backend/src/modules/procurementBid/procurement-bid.routes.ts`
- [Bid operations](https://github.com/anandgadge2/msme_pugarch/blob/main/backend/src/modules/procurementBid/procurement-bid.service.ts): `backend/src/modules/procurementBid/procurement-bid.service.ts`
- [L1 comparison](https://github.com/anandgadge2/msme_pugarch/blob/main/backend/src/modules/l1Comparison/l1-comparison.service.ts): `backend/src/modules/l1Comparison/l1-comparison.service.ts`

### Order fulfillment

- [Payments](https://github.com/anandgadge2/msme_pugarch/blob/main/backend/src/modules/payments/payment.service.ts): `backend/src/modules/payments/payment.service.ts`
- [Delivery tracking](https://github.com/anandgadge2/msme_pugarch/blob/main/backend/src/modules/delivery/delivery.service.ts): `backend/src/modules/delivery/delivery.service.ts`
- [Fulfillment workflow](https://github.com/anandgadge2/msme_pugarch/blob/main/backend/src/services/workflow/fulfillment-workflow.service.ts): `backend/src/services/workflow/fulfillment-workflow.service.ts`
- [Invoice PDF](https://github.com/anandgadge2/msme_pugarch/blob/main/backend/src/services/invoice-pdf.service.ts): `backend/src/services/invoice-pdf.service.ts`

### Other components

- **Buyer or seller**

## Connections

- Buyer or seller → Web application: uses
- Web application → Marketplace screens: renders (evidence: `frontend/src/App.tsx`)
- Web application → Session handling: uses (evidence: `frontend/src/App.tsx`)
- Marketplace screens → Marketplace API: uses (evidence: `frontend/src/features/marketplace/pages/MarketplaceServiceDetail.tsx`)
- Session handling → Authentication: calls auth endpoints (evidence: `frontend/src/hooks/useAuth.tsx`)
- API server → Authentication: serves
- Authentication → Application database: reads and writes (evidence: `backend/src/modules/auth/auth.controller.ts`)
- Authentication → Session cookies: issues sessions (evidence: `backend/src/modules/auth/auth.controller.ts`)
- Session cookies → Token service: issues and verifies (evidence: `backend/src/services/auth-cookie.service.ts`)
- Session cookies → Application database: stores sessions (evidence: `backend/src/services/auth-cookie.service.ts`)
- Application database → Cache service: invalidates (evidence: `backend/src/lib/prisma.ts`)
- API server → Marketplace routes: serves
- Marketplace routes → Procurement bids: imports (evidence: `backend/src/routes/marketplace.routes.ts`)
- Procurement bids → Bid operations: delegates to (evidence: `backend/src/modules/procurementBid/procurement-bid.routes.ts`)
- Procurement bids → Cache service: caches bid data (evidence: `backend/src/modules/procurementBid/procurement-bid.routes.ts`)
- Procurement bids → Fulfillment workflow: uses workflow (evidence: `backend/src/modules/procurementBid/procurement-bid.routes.ts`)
- Fulfillment workflow → Application database: updates records (evidence: `backend/src/services/workflow/fulfillment-workflow.service.ts`)
- Fulfillment workflow → Invoice PDF: generates PDF (evidence: `backend/src/services/workflow/fulfillment-workflow.service.ts`)
