# kk666679/halal-logistics architecture

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

- Interactive diagram: https://gitdiagram.com/kk666679/halal-logistics
- Repository: https://github.com/kk666679/halal-logistics

## Overview

This repository presents a Halal logistics platform: users enter through a Next.js web application and use backend capabilities for identity, certification, products, shipment tracking, and trade compliance. The tree also contains an agent-communication orchestrator, AI-agent services, and blockchain services, reflecting documented analytics and transparency capabilities. The sampled backend shows controller-to-service and service-to-Prisma calls; README statements supply broader system relationships. Several listed capabilities have no sampled implementation, so their links are documented or left unverified rather than inferred from names.

Main entry points: [`backend/src/app.module.ts`](https://github.com/kk666679/halal-logistics/blob/main/backend/src/app.module.ts) (Backend API), [`backend/src/prisma/prisma.service.ts`](https://github.com/kk666679/halal-logistics/blob/main/backend/src/prisma/prisma.service.ts) (Prisma database access), [`infrastructure/agent-communication/orchestrator/src/routes/agentRoutes.ts`](https://github.com/kk666679/halal-logistics/blob/main/infrastructure/agent-communication/orchestrator/src/routes/agentRoutes.ts) (Agent request routing), [`app/layout.tsx`](https://github.com/kk666679/halal-logistics/blob/main/app/layout.tsx) (Next.js application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_webapp["Next.js application<br/>[layout.tsx]"]
  node_dashboard["Operations dashboard<br/>[page.tsx]"]
  node_certui["Certification UI"]
  node_trackingui["Shipment tracking UI"]
end

subgraph group_core["Platform API"]
  node_gateway["Backend API<br/>[app.module.ts]"]
  node_auth["Authentication<br/>[auth.service.ts]"]
  node_database[("Prisma database access<br/>[prisma.service.ts]")]
  node_certapi["Certification workflow"]
  node_certservice["Certification service"]
  node_products["Product inventory"]
  node_productservice["Product service"]
  node_tracking["Shipment tracking"]
  node_trackingservice["Tracking service"]
end

subgraph group_agents["AI and agents"]
  node_orchestrator["Agent request routing<br/>[agentRoutes.ts]"]
  node_registry["Agent registry"]
  node_loadbalancer["Agent load balancing"]
  node_broker["Agent message broker"]
  node_certagent["AI certification agent"]
  node_qualityagent["Quality control agent<br/>[quality.service.ts]"]
  node_blockchain["Blockchain service"]
end

subgraph group_integrations["Trade integrations"]
  node_customs["Customs reporting<br/>[customsRoutes.ts]"]
end

node_user(("Platform user"))
node_customsapi["Customs authority"]

node_user -->|"uses"| node_webapp
node_webapp -->|"calls API"| node_gateway
node_user -.->|"views operations"| node_dashboard
node_user -.->|"submits application"| node_certui
node_user -.->|"checks shipment"| node_trackingui
node_gateway -.->|"provides auth"| node_auth
node_gateway -.->|"routes certification"| node_certapi
node_gateway -.->|"routes products"| node_products
node_gateway -.->|"routes tracking"| node_tracking
node_certapi -->|"calls"| node_certservice
node_certservice -->|"queries"| node_database
node_auth -->|"queries"| node_database
node_products -->|"calls"| node_productservice
node_productservice -->|"queries"| node_database
node_tracking -->|"calls"| node_trackingservice
node_trackingservice -->|"queries"| node_database
node_customs -->|"checks status"| node_customsapi
node_orchestrator -->|"looks up agents"| node_registry
node_orchestrator -.->|"routes requests"| node_loadbalancer
node_orchestrator -.->|"dispatches messages"| node_broker
node_gateway -.->|"integrates trade"| node_customs
node_gateway -.->|"offers AI capability"| node_certagent
node_gateway -.->|"offers AI capability"| node_qualityagent
node_gateway -.->|"offers transparency"| node_blockchain

click node_webapp "https://github.com/kk666679/halal-logistics/blob/main/app/layout.tsx"
click node_dashboard "https://github.com/kk666679/halal-logistics/blob/main/app/dashboard/page.tsx"
click node_certui "https://github.com/kk666679/halal-logistics/blob/main/components/certification/certification-application-form.tsx"
click node_trackingui "https://github.com/kk666679/halal-logistics/blob/main/components/tracking/shipment-tracker.tsx"
click node_gateway "https://github.com/kk666679/halal-logistics/blob/main/backend/src/app.module.ts"
click node_auth "https://github.com/kk666679/halal-logistics/blob/main/backend/src/auth/auth.service.ts"
click node_database "https://github.com/kk666679/halal-logistics/blob/main/backend/src/prisma/prisma.service.ts"
click node_certapi "https://github.com/kk666679/halal-logistics/blob/main/backend/src/certification/certification.controller.ts"
click node_certservice "https://github.com/kk666679/halal-logistics/blob/main/backend/src/certification/certification.service.ts"
click node_products "https://github.com/kk666679/halal-logistics/blob/main/backend/src/products/products.controller.ts"
click node_productservice "https://github.com/kk666679/halal-logistics/blob/main/backend/src/products/products.service.ts"
click node_tracking "https://github.com/kk666679/halal-logistics/blob/main/backend/src/tracking/tracking.controller.ts"
click node_trackingservice "https://github.com/kk666679/halal-logistics/blob/main/backend/src/tracking/tracking.service.ts"
click node_customs "https://github.com/kk666679/halal-logistics/blob/main/infrastructure/government-apis/regulatory-reporting/src/routes/customsRoutes.ts"
click node_orchestrator "https://github.com/kk666679/halal-logistics/blob/main/infrastructure/agent-communication/orchestrator/src/routes/agentRoutes.ts"
click node_registry "https://github.com/kk666679/halal-logistics/blob/main/infrastructure/agent-communication/orchestrator/src/services/AgentRegistryService.ts"
click node_loadbalancer "https://github.com/kk666679/halal-logistics/blob/main/infrastructure/agent-communication/orchestrator/src/services/LoadBalancerService.ts"
click node_broker "https://github.com/kk666679/halal-logistics/blob/main/infrastructure/agent-communication/orchestrator/src/services/MessageBrokerService.ts"
click node_certagent "https://github.com/kk666679/halal-logistics/blob/main/services/ai-agents/certification/src/certification/certification.controller.ts"
click node_qualityagent "https://github.com/kk666679/halal-logistics/blob/main/services/ai-agents/quality-control/src/quality/quality.service.ts"
click node_blockchain "https://github.com/kk666679/halal-logistics/blob/main/services/ai-agents/blockchain/src/blockchain/blockchain.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_webapp,node_dashboard,node_certui,node_trackingui,node_user toneBlue
class node_gateway,node_auth,node_database,node_certapi,node_certservice,node_products,node_productservice,node_tracking,node_trackingservice toneAmber
class node_orchestrator,node_registry,node_loadbalancer,node_broker,node_certagent,node_qualityagent,node_blockchain toneMint
class node_customs toneRose
class node_customsapi toneIndigo
```

## Components

### Web experience

- [Next.js application](https://github.com/kk666679/halal-logistics/blob/main/app/layout.tsx): `app/layout.tsx`
- [Operations dashboard](https://github.com/kk666679/halal-logistics/blob/main/app/dashboard/page.tsx): `app/dashboard/page.tsx`
- [Certification UI](https://github.com/kk666679/halal-logistics/blob/main/components/certification/certification-application-form.tsx): `components/certification/certification-application-form.tsx`
- [Shipment tracking UI](https://github.com/kk666679/halal-logistics/blob/main/components/tracking/shipment-tracker.tsx): `components/tracking/shipment-tracker.tsx`

### Platform API

- [Backend API](https://github.com/kk666679/halal-logistics/blob/main/backend/src/app.module.ts): `backend/src/app.module.ts`
- [Authentication](https://github.com/kk666679/halal-logistics/blob/main/backend/src/auth/auth.service.ts): `backend/src/auth/auth.service.ts`
- [Prisma database access](https://github.com/kk666679/halal-logistics/blob/main/backend/src/prisma/prisma.service.ts): `backend/src/prisma/prisma.service.ts`
- [Certification workflow](https://github.com/kk666679/halal-logistics/blob/main/backend/src/certification/certification.controller.ts): `backend/src/certification/certification.controller.ts`
- [Certification service](https://github.com/kk666679/halal-logistics/blob/main/backend/src/certification/certification.service.ts): `backend/src/certification/certification.service.ts`
- [Product inventory](https://github.com/kk666679/halal-logistics/blob/main/backend/src/products/products.controller.ts): `backend/src/products/products.controller.ts`
- [Product service](https://github.com/kk666679/halal-logistics/blob/main/backend/src/products/products.service.ts): `backend/src/products/products.service.ts`
- [Shipment tracking](https://github.com/kk666679/halal-logistics/blob/main/backend/src/tracking/tracking.controller.ts): `backend/src/tracking/tracking.controller.ts`
- [Tracking service](https://github.com/kk666679/halal-logistics/blob/main/backend/src/tracking/tracking.service.ts): `backend/src/tracking/tracking.service.ts`

### AI and agents

- [Agent request routing](https://github.com/kk666679/halal-logistics/blob/main/infrastructure/agent-communication/orchestrator/src/routes/agentRoutes.ts): `infrastructure/agent-communication/orchestrator/src/routes/agentRoutes.ts`
- [Agent registry](https://github.com/kk666679/halal-logistics/blob/main/infrastructure/agent-communication/orchestrator/src/services/AgentRegistryService.ts): `infrastructure/agent-communication/orchestrator/src/services/AgentRegistryService.ts`
- [Agent load balancing](https://github.com/kk666679/halal-logistics/blob/main/infrastructure/agent-communication/orchestrator/src/services/LoadBalancerService.ts): `infrastructure/agent-communication/orchestrator/src/services/LoadBalancerService.ts`
- [Agent message broker](https://github.com/kk666679/halal-logistics/blob/main/infrastructure/agent-communication/orchestrator/src/services/MessageBrokerService.ts): `infrastructure/agent-communication/orchestrator/src/services/MessageBrokerService.ts`
- [AI certification agent](https://github.com/kk666679/halal-logistics/blob/main/services/ai-agents/certification/src/certification/certification.controller.ts): `services/ai-agents/certification/src/certification/certification.controller.ts`
- [Quality control agent](https://github.com/kk666679/halal-logistics/blob/main/services/ai-agents/quality-control/src/quality/quality.service.ts): `services/ai-agents/quality-control/src/quality/quality.service.ts`
- [Blockchain service](https://github.com/kk666679/halal-logistics/blob/main/services/ai-agents/blockchain/src/blockchain/blockchain.service.ts): `services/ai-agents/blockchain/src/blockchain/blockchain.service.ts`

### Trade integrations

- [Customs reporting](https://github.com/kk666679/halal-logistics/blob/main/infrastructure/government-apis/regulatory-reporting/src/routes/customsRoutes.ts): `infrastructure/government-apis/regulatory-reporting/src/routes/customsRoutes.ts`

### Other components

- **Platform user**
- **Customs authority**

## Connections

- Platform user → Next.js application: uses (evidence: `README.md`)
- Next.js application → Backend API: calls API (evidence: `README.md`)
- Platform user → Operations dashboard: views operations
- Platform user → Certification UI: submits application
- Platform user → Shipment tracking UI: checks shipment
- Backend API → Authentication: provides auth
- Backend API → Certification workflow: routes certification
- Backend API → Product inventory: routes products
- Backend API → Shipment tracking: routes tracking
- Certification workflow → Certification service: calls (evidence: `backend/src/certification/certification.controller.ts`)
- Certification service → Prisma database access: queries (evidence: `backend/src/certification/certification.service.ts`)
- Authentication → Prisma database access: queries (evidence: `backend/src/auth/auth.service.ts`)
- Product inventory → Product service: calls (evidence: `backend/src/products/products.controller.ts`)
- Product service → Prisma database access: queries (evidence: `backend/src/products/products.service.ts`)
- Shipment tracking → Tracking service: calls (evidence: `backend/src/tracking/tracking.controller.ts`)
- Tracking service → Prisma database access: queries (evidence: `backend/src/tracking/tracking.service.ts`)
- Customs reporting → Customs authority: checks status (evidence: `infrastructure/government-apis/regulatory-reporting/src/routes/customsRoutes.ts`)
- Agent request routing → Agent registry: looks up agents (evidence: `infrastructure/agent-communication/orchestrator/src/routes/agentRoutes.ts`)
- Agent request routing → Agent load balancing: routes requests (evidence: `infrastructure/agent-communication/orchestrator/src/routes/agentRoutes.ts`)
- Agent request routing → Agent message broker: dispatches messages (evidence: `infrastructure/agent-communication/orchestrator/src/routes/agentRoutes.ts`)
- Backend API → Customs reporting: integrates trade (evidence: `README.md`)
- Backend API → AI certification agent: offers AI capability (evidence: `README.md`)
- Backend API → Quality control agent: offers AI capability (evidence: `README.md`)
- Backend API → Blockchain service: offers transparency (evidence: `README.md`)
