# codeswithrakib/dhruto architecture

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

- Interactive diagram: https://gitdiagram.com/codeswithrakib/dhruto
- Repository: https://github.com/codeswithrakib/dhruto

## Overview

Dhruto is a courier-operations platform, with a NestJS API and a merchant-facing web application. Its central operational flow is parcel creation and tracking, followed by hub handling and rider delivery; finance, analytics, intelligence, notifications, and integrations support that work. The graph emphasizes API domain boundaries and sampled controller-to-service calls. The README is empty, and most source was not excerpted, so several documented-by-tree capabilities are shown as subsystems without speculative call relationships.

Main entry points: [`apps/api/src/finance/finance.controller.ts`](https://github.com/codeswithrakib/dhruto/blob/main/apps/api/src/finance/finance.controller.ts) (Finance API), [`apps/api/src/intelligence/intelligence.controller.ts`](https://github.com/codeswithrakib/dhruto/blob/main/apps/api/src/intelligence/intelligence.controller.ts) (Intelligence API), [`apps/api/src/parcels/parcels.controller.ts`](https://github.com/codeswithrakib/dhruto/blob/main/apps/api/src/parcels/parcels.controller.ts) (Parcel API), [`apps/api/src/parcels/parcels.service.ts`](https://github.com/codeswithrakib/dhruto/blob/main/apps/api/src/parcels/parcels.service.ts) (Parcel lifecycle)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_operations["Parcel Operations"]
  node_parcel_api["Parcel API"]
  node_parcel_service["Parcel lifecycle<br/>[parcels.service.ts]"]
  node_tracking_api["Tracking API"]
  node_hub_api["Hub API<br/>[hubs.controller.ts]"]
  node_hub_service["Hub operations<br/>[hubs.service.ts]"]
  node_rider_api["Rider API"]
  node_rider_service["Rider delivery<br/>[riders.service.ts]"]
  node_parcel_store[("Operational records<br/>[Parcel.entity.ts]")]
end

subgraph group_platform["Identity &amp; Platform"]
  node_auth_api["Authentication API<br/>[auth.controller.ts]"]
  node_auth_service["Authentication<br/>[auth.service.ts]"]
  node_user_store[("User records<br/>[User.entity.ts]")]
end

subgraph group_business["Business Services"]
  node_finance_api["Finance API"]
  node_finance_service["Finance operations<br/>[finance.service.ts]"]
  node_merchant_service["Merchant accounts"]
  node_notifications["Notifications"]
  node_web_app["Merchant and operations UI"]
end

subgraph group_insights["Insights &amp; Integrations"]
  node_analytics["Analytics &amp; exports"]
  node_intelligence_api["Intelligence API"]
  node_intelligence_service["Delivery intelligence"]
  node_risk_engine["Risk scoring"]
  node_integrations["Integrations &amp; outbox"]
  node_webhooks_api["Webhook API"]
  node_webhooks_service["Webhook delivery"]
end

node_merchant(("Merchant user"))

node_parcel_api -->|"calls"| node_parcel_service
node_hub_api -->|"calls"| node_hub_service
node_rider_api -->|"calls"| node_rider_service
node_finance_api -->|"calls"| node_finance_service
node_finance_api -->|"resolves merchant"| node_merchant_service
node_auth_api -->|"calls"| node_auth_service
node_intelligence_api -->|"calls"| node_intelligence_service
node_intelligence_api -.->|"uses risk engine"| node_risk_engine
node_webhooks_api -->|"calls"| node_webhooks_service
node_parcel_service -.->|"persists parcels"| node_parcel_store
node_auth_service -.->|"uses user records"| node_user_store
node_merchant -.->|"uses"| node_web_app
node_web_app -.->|"requests parcel operations"| node_parcel_api

click node_parcel_api "https://github.com/codeswithrakib/dhruto/blob/main/apps/api/src/parcels/parcels.controller.ts"
click node_parcel_service "https://github.com/codeswithrakib/dhruto/blob/main/apps/api/src/parcels/parcels.service.ts"
click node_tracking_api "https://github.com/codeswithrakib/dhruto/blob/main/apps/api/src/parcels/tracking.controller.ts"
click node_hub_api "https://github.com/codeswithrakib/dhruto/blob/main/apps/api/src/hubs/hubs.controller.ts"
click node_hub_service "https://github.com/codeswithrakib/dhruto/blob/main/apps/api/src/hubs/hubs.service.ts"
click node_rider_api "https://github.com/codeswithrakib/dhruto/blob/main/apps/api/src/riders/riders.controller.ts"
click node_rider_service "https://github.com/codeswithrakib/dhruto/blob/main/apps/api/src/riders/riders.service.ts"
click node_parcel_store "https://github.com/codeswithrakib/dhruto/blob/main/apps/api/src/database/entities/Parcel.entity.ts"
click node_auth_api "https://github.com/codeswithrakib/dhruto/blob/main/apps/api/src/auth/auth.controller.ts"
click node_auth_service "https://github.com/codeswithrakib/dhruto/blob/main/apps/api/src/auth/services/auth.service.ts"
click node_user_store "https://github.com/codeswithrakib/dhruto/blob/main/apps/api/src/database/entities/User.entity.ts"
click node_finance_api "https://github.com/codeswithrakib/dhruto/blob/main/apps/api/src/finance/finance.controller.ts"
click node_finance_service "https://github.com/codeswithrakib/dhruto/blob/main/apps/api/src/finance/finance.service.ts"
click node_merchant_service "https://github.com/codeswithrakib/dhruto/blob/main/apps/api/src/merchants/merchants.service.ts"
click node_analytics "https://github.com/codeswithrakib/dhruto/tree/main/apps/api/src/analytics"
click node_intelligence_api "https://github.com/codeswithrakib/dhruto/blob/main/apps/api/src/intelligence/intelligence.controller.ts"
click node_intelligence_service "https://github.com/codeswithrakib/dhruto/blob/main/apps/api/src/intelligence/intelligence.service.ts"
click node_risk_engine "https://github.com/codeswithrakib/dhruto/blob/main/apps/api/src/intelligence/services/risk-engine.service.ts"
click node_integrations "https://github.com/codeswithrakib/dhruto/tree/main/apps/api/src/integrations"
click node_webhooks_api "https://github.com/codeswithrakib/dhruto/blob/main/apps/api/src/webhooks/webhooks.controller.ts"
click node_webhooks_service "https://github.com/codeswithrakib/dhruto/blob/main/apps/api/src/webhooks/webhooks.service.ts"
click node_notifications "https://github.com/codeswithrakib/dhruto/tree/main/apps/api/src/notifications"
click node_web_app "https://github.com/codeswithrakib/dhruto/tree/main/apps/web-merchant/app"

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_parcel_api,node_parcel_service,node_tracking_api,node_hub_api,node_hub_service,node_rider_api,node_rider_service,node_parcel_store,node_merchant toneBlue
class node_auth_api,node_auth_service,node_user_store toneAmber
class node_finance_api,node_finance_service,node_merchant_service,node_notifications,node_web_app toneMint
class node_analytics,node_intelligence_api,node_intelligence_service,node_risk_engine,node_integrations,node_webhooks_api,node_webhooks_service toneRose
```

## Components

### Parcel Operations

- [Parcel API](https://github.com/codeswithrakib/dhruto/blob/main/apps/api/src/parcels/parcels.controller.ts): `apps/api/src/parcels/parcels.controller.ts`
- [Parcel lifecycle](https://github.com/codeswithrakib/dhruto/blob/main/apps/api/src/parcels/parcels.service.ts): `apps/api/src/parcels/parcels.service.ts`
- [Tracking API](https://github.com/codeswithrakib/dhruto/blob/main/apps/api/src/parcels/tracking.controller.ts): `apps/api/src/parcels/tracking.controller.ts`
- [Hub API](https://github.com/codeswithrakib/dhruto/blob/main/apps/api/src/hubs/hubs.controller.ts): `apps/api/src/hubs/hubs.controller.ts`
- [Hub operations](https://github.com/codeswithrakib/dhruto/blob/main/apps/api/src/hubs/hubs.service.ts): `apps/api/src/hubs/hubs.service.ts`
- [Rider API](https://github.com/codeswithrakib/dhruto/blob/main/apps/api/src/riders/riders.controller.ts): `apps/api/src/riders/riders.controller.ts`
- [Rider delivery](https://github.com/codeswithrakib/dhruto/blob/main/apps/api/src/riders/riders.service.ts): `apps/api/src/riders/riders.service.ts`
- [Operational records](https://github.com/codeswithrakib/dhruto/blob/main/apps/api/src/database/entities/Parcel.entity.ts): `apps/api/src/database/entities/Parcel.entity.ts`

### Identity & Platform

- [Authentication API](https://github.com/codeswithrakib/dhruto/blob/main/apps/api/src/auth/auth.controller.ts): `apps/api/src/auth/auth.controller.ts`
- [Authentication](https://github.com/codeswithrakib/dhruto/blob/main/apps/api/src/auth/services/auth.service.ts): `apps/api/src/auth/services/auth.service.ts`
- [User records](https://github.com/codeswithrakib/dhruto/blob/main/apps/api/src/database/entities/User.entity.ts): `apps/api/src/database/entities/User.entity.ts`

### Business Services

- [Finance API](https://github.com/codeswithrakib/dhruto/blob/main/apps/api/src/finance/finance.controller.ts): `apps/api/src/finance/finance.controller.ts`
- [Finance operations](https://github.com/codeswithrakib/dhruto/blob/main/apps/api/src/finance/finance.service.ts): `apps/api/src/finance/finance.service.ts`
- [Merchant accounts](https://github.com/codeswithrakib/dhruto/blob/main/apps/api/src/merchants/merchants.service.ts): `apps/api/src/merchants/merchants.service.ts`
- [Notifications](https://github.com/codeswithrakib/dhruto/tree/main/apps/api/src/notifications): `apps/api/src/notifications`
- [Merchant and operations UI](https://github.com/codeswithrakib/dhruto/tree/main/apps/web-merchant/app): `apps/web-merchant/app`

### Insights & Integrations

- [Analytics & exports](https://github.com/codeswithrakib/dhruto/tree/main/apps/api/src/analytics): `apps/api/src/analytics`
- [Intelligence API](https://github.com/codeswithrakib/dhruto/blob/main/apps/api/src/intelligence/intelligence.controller.ts): `apps/api/src/intelligence/intelligence.controller.ts`
- [Delivery intelligence](https://github.com/codeswithrakib/dhruto/blob/main/apps/api/src/intelligence/intelligence.service.ts): `apps/api/src/intelligence/intelligence.service.ts`
- [Risk scoring](https://github.com/codeswithrakib/dhruto/blob/main/apps/api/src/intelligence/services/risk-engine.service.ts): `apps/api/src/intelligence/services/risk-engine.service.ts`
- [Integrations & outbox](https://github.com/codeswithrakib/dhruto/tree/main/apps/api/src/integrations): `apps/api/src/integrations`
- [Webhook API](https://github.com/codeswithrakib/dhruto/blob/main/apps/api/src/webhooks/webhooks.controller.ts): `apps/api/src/webhooks/webhooks.controller.ts`
- [Webhook delivery](https://github.com/codeswithrakib/dhruto/blob/main/apps/api/src/webhooks/webhooks.service.ts): `apps/api/src/webhooks/webhooks.service.ts`

### Other components

- **Merchant user**

## Connections

- Parcel API → Parcel lifecycle: calls (evidence: `apps/api/src/parcels/parcels.controller.ts`)
- Hub API → Hub operations: calls (evidence: `apps/api/src/hubs/hubs.controller.ts`)
- Rider API → Rider delivery: calls (evidence: `apps/api/src/riders/riders.controller.ts`)
- Finance API → Finance operations: calls (evidence: `apps/api/src/finance/finance.controller.ts`)
- Finance API → Merchant accounts: resolves merchant (evidence: `apps/api/src/finance/finance.controller.ts`)
- Authentication API → Authentication: calls (evidence: `apps/api/src/auth/auth.controller.ts`)
- Intelligence API → Delivery intelligence: calls (evidence: `apps/api/src/intelligence/intelligence.controller.ts`)
- Intelligence API → Risk scoring: uses risk engine
- Webhook API → Webhook delivery: calls (evidence: `apps/api/src/webhooks/webhooks.controller.ts`)
- Parcel lifecycle → Operational records: persists parcels
- Authentication → User records: uses user records
- Merchant user → Merchant and operations UI: uses
- Merchant and operations UI → Parcel API: requests parcel operations
