# otienobryan/zamu_server architecture

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

- Interactive diagram: https://gitdiagram.com/otienobryan/zamu_server
- Repository: https://github.com/otienobryan/zamu_server

## Overview

This is a NestJS backend for operational and business-management workflows, rather than the generic starter described by its README. Users reach feature controllers over HTTP; controllers delegate requests to domain services, while authentication validates staff credentials and issues JWTs. The source tree exposes aviation bookings, fuel-station sales, purchasing and inventory, manufacturing, vehicle conversions, chat, and finance capabilities. Sampled controllers confirm service delegation, but most service implementations and module wiring were not sampled, so cross-domain calls and persistence links are intentionally not inferred.

Main entry points: [`src/auth/auth.service.ts`](https://github.com/otienobryan/zamu_server/blob/master/src/auth/auth.service.ts) (Staff authentication), [`src/config/database.config.ts`](https://github.com/otienobryan/zamu_server/blob/master/src/config/database.config.ts) (Relational database), [`src/app.module.ts`](https://github.com/otienobryan/zamu_server/blob/master/src/app.module.ts) (Nest application), [`src/sales/sales.controller.ts`](https://github.com/otienobryan/zamu_server/blob/master/src/sales/sales.controller.ts) (Fuel sales and reports)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_platform["API and identity"]
  node_app["Nest application<br/>[app.module.ts]"]
  node_auth["Staff authentication<br/>[auth.service.ts]"]
  node_staff[("Staff records<br/>[staff.entity.ts]")]
  node_database[("Relational database<br/>[database.config.ts]")]
end

subgraph group_travel["Travel operations"]
  node_bookings["Bookings and passengers"]
  node_appointments["Appointments"]
end

subgraph group_commerce["Sales and supply"]
  node_sales["Fuel sales and reports"]
  node_fuel["Fuel pricing"]
  node_purchase["Purchasing and stores"]
  node_rawmaterials["Raw materials"]
end

subgraph group_production["Production and service"]
  node_finished["Finished products"]
  node_workorders["Work orders"]
  node_vehicles["Vehicle analysis"]
  node_conversionanalysis["Image analysis"]
  node_cloudinary["Cloudinary media"]
end

subgraph group_finance["Finance and workforce"]
  node_accounts["Key accounts"]
  node_ledger["Account ledger"]
  node_reports["Financial reports"]
  node_expenses["Expenses and payments"]
  node_staffops["Staff operations"]
end

subgraph group_collaboration["Communication"]
  node_chat["Chat API<br/>[chat.controller.ts]"]
  node_gateway["Realtime chat<br/>[chat.gateway.ts]"]
end

node_user(("API user"))

node_user -->|"sends requests"| node_app
node_app -->|"routes identity"| node_auth
node_auth -->|"looks up staff"| node_staff
node_auth -->|"queries records"| node_database
node_user -->|"manages bookings"| node_bookings
node_user -->|"manages appointments"| node_appointments
node_user -->|"records and reports"| node_sales
node_sales -->|"delegates sales"| node_database
node_user -->|"manages fuel prices"| node_fuel
node_user -->|"receives orders"| node_purchase
node_purchase -->|"delegates orders"| node_database
node_user -->|"manages materials"| node_rawmaterials
node_user -->|"manages products"| node_finished
node_finished -.->|"uploads images"| node_cloudinary
node_user -->|"manages work"| node_workorders
node_user -->|"manages conversions"| node_vehicles
node_vehicles -->|"requests analysis"| node_conversionanalysis
node_user -->|"manages accounts"| node_accounts
node_user -->|"records ledger entries"| node_ledger
node_user -->|"requests reports"| node_reports
node_user -->|"manages expenses"| node_expenses
node_user -->|"manages staff"| node_staffops
node_user -->|"uses chat"| node_chat
node_user -->|"opens realtime chat"| node_gateway

click node_app "https://github.com/otienobryan/zamu_server/blob/master/src/app.module.ts"
click node_auth "https://github.com/otienobryan/zamu_server/blob/master/src/auth/auth.service.ts"
click node_staff "https://github.com/otienobryan/zamu_server/blob/master/src/entities/staff.entity.ts"
click node_bookings "https://github.com/otienobryan/zamu_server/blob/master/src/bookings/bookings.controller.ts"
click node_appointments "https://github.com/otienobryan/zamu_server/blob/master/src/appointments/appointments.controller.ts"
click node_sales "https://github.com/otienobryan/zamu_server/blob/master/src/sales/sales.controller.ts"
click node_fuel "https://github.com/otienobryan/zamu_server/blob/master/src/fuel-prices/fuel-prices.controller.ts"
click node_purchase "https://github.com/otienobryan/zamu_server/blob/master/src/purchase-orders/purchase-orders.controller.ts"
click node_rawmaterials "https://github.com/otienobryan/zamu_server/blob/master/src/raw-materials/raw-materials.controller.ts"
click node_finished "https://github.com/otienobryan/zamu_server/blob/master/src/finished-products/finished-products.controller.ts"
click node_workorders "https://github.com/otienobryan/zamu_server/blob/master/src/work-orders/work-orders.controller.ts"
click node_vehicles "https://github.com/otienobryan/zamu_server/blob/master/src/conversion-vehicles/conversion-vehicles.controller.ts"
click node_conversionanalysis "https://github.com/otienobryan/zamu_server/blob/master/src/conversion-vehicles/services/vehicle-analysis.service.ts"
click node_accounts "https://github.com/otienobryan/zamu_server/blob/master/src/key-accounts/key-accounts.controller.ts"
click node_ledger "https://github.com/otienobryan/zamu_server/blob/master/src/key-account-ledger/key-account-ledger.controller.ts"
click node_reports "https://github.com/otienobryan/zamu_server/blob/master/src/financial-reports/financial-reports.controller.ts"
click node_expenses "https://github.com/otienobryan/zamu_server/blob/master/src/expenses/expenses.controller.ts"
click node_staffops "https://github.com/otienobryan/zamu_server/blob/master/src/staff-members/staff-members.controller.ts"
click node_chat "https://github.com/otienobryan/zamu_server/blob/master/src/chat/chat.controller.ts"
click node_gateway "https://github.com/otienobryan/zamu_server/blob/master/src/chat/chat.gateway.ts"
click node_database "https://github.com/otienobryan/zamu_server/blob/master/src/config/database.config.ts"
click node_cloudinary "https://github.com/otienobryan/zamu_server/blob/master/src/cloudinary/cloudinary.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_app,node_auth,node_staff,node_database,node_user toneBlue
class node_bookings,node_appointments toneAmber
class node_sales,node_fuel,node_purchase,node_rawmaterials toneMint
class node_finished,node_workorders,node_vehicles,node_conversionanalysis,node_cloudinary toneRose
class node_accounts,node_ledger,node_reports,node_expenses,node_staffops toneIndigo
class node_chat,node_gateway toneTeal
```

## Components

### API and identity

- [Nest application](https://github.com/otienobryan/zamu_server/blob/master/src/app.module.ts): `src/app.module.ts`
- [Staff authentication](https://github.com/otienobryan/zamu_server/blob/master/src/auth/auth.service.ts): `src/auth/auth.service.ts`
- [Staff records](https://github.com/otienobryan/zamu_server/blob/master/src/entities/staff.entity.ts): `src/entities/staff.entity.ts`
- [Relational database](https://github.com/otienobryan/zamu_server/blob/master/src/config/database.config.ts): `src/config/database.config.ts`

### Travel operations

- [Bookings and passengers](https://github.com/otienobryan/zamu_server/blob/master/src/bookings/bookings.controller.ts): `src/bookings/bookings.controller.ts`
- [Appointments](https://github.com/otienobryan/zamu_server/blob/master/src/appointments/appointments.controller.ts): `src/appointments/appointments.controller.ts`

### Sales and supply

- [Fuel sales and reports](https://github.com/otienobryan/zamu_server/blob/master/src/sales/sales.controller.ts): `src/sales/sales.controller.ts`
- [Fuel pricing](https://github.com/otienobryan/zamu_server/blob/master/src/fuel-prices/fuel-prices.controller.ts): `src/fuel-prices/fuel-prices.controller.ts`
- [Purchasing and stores](https://github.com/otienobryan/zamu_server/blob/master/src/purchase-orders/purchase-orders.controller.ts): `src/purchase-orders/purchase-orders.controller.ts`
- [Raw materials](https://github.com/otienobryan/zamu_server/blob/master/src/raw-materials/raw-materials.controller.ts): `src/raw-materials/raw-materials.controller.ts`

### Production and service

- [Finished products](https://github.com/otienobryan/zamu_server/blob/master/src/finished-products/finished-products.controller.ts): `src/finished-products/finished-products.controller.ts`
- [Work orders](https://github.com/otienobryan/zamu_server/blob/master/src/work-orders/work-orders.controller.ts): `src/work-orders/work-orders.controller.ts`
- [Vehicle analysis](https://github.com/otienobryan/zamu_server/blob/master/src/conversion-vehicles/conversion-vehicles.controller.ts): `src/conversion-vehicles/conversion-vehicles.controller.ts`
- [Image analysis](https://github.com/otienobryan/zamu_server/blob/master/src/conversion-vehicles/services/vehicle-analysis.service.ts): `src/conversion-vehicles/services/vehicle-analysis.service.ts`
- [Cloudinary media](https://github.com/otienobryan/zamu_server/blob/master/src/cloudinary/cloudinary.service.ts): `src/cloudinary/cloudinary.service.ts`

### Finance and workforce

- [Key accounts](https://github.com/otienobryan/zamu_server/blob/master/src/key-accounts/key-accounts.controller.ts): `src/key-accounts/key-accounts.controller.ts`
- [Account ledger](https://github.com/otienobryan/zamu_server/blob/master/src/key-account-ledger/key-account-ledger.controller.ts): `src/key-account-ledger/key-account-ledger.controller.ts`
- [Financial reports](https://github.com/otienobryan/zamu_server/blob/master/src/financial-reports/financial-reports.controller.ts): `src/financial-reports/financial-reports.controller.ts`
- [Expenses and payments](https://github.com/otienobryan/zamu_server/blob/master/src/expenses/expenses.controller.ts): `src/expenses/expenses.controller.ts`
- [Staff operations](https://github.com/otienobryan/zamu_server/blob/master/src/staff-members/staff-members.controller.ts): `src/staff-members/staff-members.controller.ts`

### Communication

- [Chat API](https://github.com/otienobryan/zamu_server/blob/master/src/chat/chat.controller.ts): `src/chat/chat.controller.ts`
- [Realtime chat](https://github.com/otienobryan/zamu_server/blob/master/src/chat/chat.gateway.ts): `src/chat/chat.gateway.ts`

### Other components

- **API user**

## Connections

- API user → Nest application: sends requests
- Nest application → Staff authentication: routes identity
- Staff authentication → Staff records: looks up staff
- Staff authentication → Relational database: queries records
- API user → Bookings and passengers: manages bookings
- API user → Appointments: manages appointments
- API user → Fuel sales and reports: records and reports
- Fuel sales and reports → Relational database: delegates sales
- API user → Fuel pricing: manages fuel prices
- API user → Purchasing and stores: receives orders
- Purchasing and stores → Relational database: delegates orders
- API user → Raw materials: manages materials
- API user → Finished products: manages products
- Finished products → Cloudinary media: uploads images
- API user → Work orders: manages work
- API user → Vehicle analysis: manages conversions
- Vehicle analysis → Image analysis: requests analysis
- API user → Key accounts: manages accounts
- API user → Account ledger: records ledger entries
- API user → Financial reports: requests reports
- API user → Expenses and payments: manages expenses
- API user → Staff operations: manages staff
- API user → Chat API: uses chat
- API user → Realtime chat: opens realtime chat
