# nitesh-singh-1/kt_backend architecture

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

- Interactive diagram: https://gitdiagram.com/nitesh-singh-1/kt_backend
- Repository: https://github.com/nitesh-singh-1/kt_backend

## Overview

KTransport is a multi-tenant transport and logistics API. Its principal workflow is users authenticating to the API, then managing shipments and operational transport records such as trips, manifests, fleet, and parties; billing, tracking, reporting, claims, and administration are additional product areas evident in the controller tree and feature constants. The sampled code shows service-backed API handlers, tenant-aware persistence, and shipment numbering and data access. Many domain controllers and services are listed but unsampled, so their internal relationships are not inferred.

Main entry points: [`KTransport.API/Data/KTransportDbContext.cs`](https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Data/KTransportDbContext.cs) (Tenant-scoped data), [`KTransport.API/Services/ShipmentService.cs`](https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Services/ShipmentService.cs) (Shipment management), [`KTransport.API/Services/ITenantContext.cs`](https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Services/ITenantContext.cs) (Tenant context), [`KTransport.API/Services/FeatureAuthorizationService.cs`](https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Services/FeatureAuthorizationService.cs) (Feature authorization)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and access"]
  node_startup["API startup<br/>[Program.cs]"]
  node_auth_api["Authentication API<br/>[AuthController.cs]"]
  node_auth["Authentication<br/>[AuthService.cs]"]
  node_feature_auth["Feature authorization"]
  node_feature_keys["Feature definitions"]
end

subgraph group_transport["Transport operations"]
  node_ship_api["Shipment API"]
  node_ship_service["Shipment management<br/>[ShipmentService.cs]"]
  node_trip_api["Trip API<br/>[TripController.cs]"]
  node_trip_service["Trip operations<br/>[TripService.cs]"]
  node_manifest["Manifest operations<br/>[ManifestService.cs]"]
  node_tracking["Shipment tracking<br/>[TrackingService.cs]"]
  node_pod["Delivery proof<br/>[PodService.cs]"]
  node_fleet["Fleet management<br/>[FleetService.cs]"]
  node_shipment_model["Shipment records<br/>[Shipment.cs]"]
  node_trip_model["Trip records<br/>[Trip.cs]"]
  node_location_model["Locations<br/>[Location.cs]"]
end

subgraph group_business["Business capabilities"]
  node_parties["Party records<br/>[PartyService.cs]"]
  node_billing["Billing and invoices<br/>[InvoiceService.cs]"]
  node_claims["Claims operations"]
  node_reporting["Reports and analytics<br/>[ReportService.cs]"]
  node_party_model["Party records<br/>[Party.cs]"]
end

subgraph group_platform["Tenant platform"]
  node_tenant_api["Tenant administration"]
  node_tenant_service["Tenant management<br/>[TenantService.cs]"]
  node_tenant_context["Tenant context<br/>[ITenantContext.cs]"]
  node_tenant_model["Tenant records<br/>[Tenant.cs]"]
  node_data[("Tenant-scoped data")]
  node_sequence["Number sequences"]
  node_user_model["User records<br/>[User.cs]"]
  node_tenant_scoped["Tenant-scoped entities"]
end

node_user(("API user"))

node_user -.->|"authenticates"| node_auth_api
node_auth_api -->|"delegates to"| node_auth
node_startup -->|"configures"| node_data
node_startup -->|"registers"| node_tenant_context
node_auth -->|"reads and writes"| node_data
node_auth -->|"loads"| node_user_model
node_feature_auth -->|"queries"| node_data
node_feature_auth -->|"uses"| node_tenant_context
node_feature_auth -->|"normalizes"| node_feature_keys
node_ship_api -.->|"delegates to"| node_ship_service
node_ship_service -->|"reads and writes"| node_data
node_ship_service -->|"gets number"| node_sequence
node_ship_service -->|"creates and loads"| node_shipment_model
node_ship_service -->|"looks up"| node_party_model
node_ship_service -->|"loads hubs"| node_location_model
node_trip_api -->|"delegates to"| node_trip_service
node_tenant_api -->|"delegates to"| node_tenant_service
node_tenant_api -->|"uses"| node_tenant_context
node_tenant_api -->|"accepts and returns"| node_tenant_model
node_tenant_service -.->|"persists"| node_data
node_data -->|"filters by"| node_tenant_context
node_data -.->|"applies tenant rules"| node_tenant_scoped
node_data -->|"maps"| node_tenant_model
node_data -->|"maps"| node_shipment_model
node_data -.->|"maps"| node_trip_model

click node_startup "https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Program.cs"
click node_auth_api "https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Controllers/AuthController.cs"
click node_auth "https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Services/AuthService.cs"
click node_feature_auth "https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Services/FeatureAuthorizationService.cs"
click node_feature_keys "https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Common/FeatureConstants.cs"
click node_ship_api "https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Controllers/ShipmentController.cs"
click node_ship_service "https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Services/ShipmentService.cs"
click node_trip_api "https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Controllers/TripController.cs"
click node_trip_service "https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Services/TripService.cs"
click node_manifest "https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Services/ManifestService.cs"
click node_tracking "https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Services/TrackingService.cs"
click node_pod "https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Services/PodService.cs"
click node_fleet "https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Services/FleetService.cs"
click node_parties "https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Services/PartyService.cs"
click node_billing "https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Services/InvoiceService.cs"
click node_claims "https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Services/CargoClaimService.cs"
click node_reporting "https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Services/ReportService.cs"
click node_tenant_api "https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Controllers/TenantController.cs"
click node_tenant_service "https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Services/TenantService.cs"
click node_tenant_context "https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Services/ITenantContext.cs"
click node_tenant_model "https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Models/Tenant.cs"
click node_data "https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Data/KTransportDbContext.cs"
click node_sequence "https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Services/NumberingSequenceService.cs"
click node_shipment_model "https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Models/Shipment.cs"
click node_trip_model "https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Models/Trip.cs"
click node_location_model "https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Models/Location.cs"
click node_party_model "https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Models/Party.cs"
click node_user_model "https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Models/User.cs"
click node_tenant_scoped "https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Common/ITenantScopedEntity.cs"

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_startup,node_auth_api,node_auth,node_feature_auth,node_feature_keys,node_user toneBlue
class node_ship_api,node_ship_service,node_trip_api,node_trip_service,node_manifest,node_tracking,node_pod,node_fleet,node_shipment_model,node_trip_model,node_location_model toneAmber
class node_parties,node_billing,node_claims,node_reporting,node_party_model toneMint
class node_tenant_api,node_tenant_service,node_tenant_context,node_tenant_model,node_data,node_sequence,node_user_model,node_tenant_scoped toneRose
```

## Components

### API and access

- [API startup](https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Program.cs): `KTransport.API/Program.cs`
- [Authentication API](https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Controllers/AuthController.cs): `KTransport.API/Controllers/AuthController.cs`
- [Authentication](https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Services/AuthService.cs): `KTransport.API/Services/AuthService.cs`
- [Feature authorization](https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Services/FeatureAuthorizationService.cs): `KTransport.API/Services/FeatureAuthorizationService.cs`
- [Feature definitions](https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Common/FeatureConstants.cs): `KTransport.API/Common/FeatureConstants.cs`

### Transport operations

- [Shipment API](https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Controllers/ShipmentController.cs): `KTransport.API/Controllers/ShipmentController.cs`
- [Shipment management](https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Services/ShipmentService.cs): `KTransport.API/Services/ShipmentService.cs`
- [Trip API](https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Controllers/TripController.cs): `KTransport.API/Controllers/TripController.cs`
- [Trip operations](https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Services/TripService.cs): `KTransport.API/Services/TripService.cs`
- [Manifest operations](https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Services/ManifestService.cs): `KTransport.API/Services/ManifestService.cs`
- [Shipment tracking](https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Services/TrackingService.cs): `KTransport.API/Services/TrackingService.cs`
- [Delivery proof](https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Services/PodService.cs): `KTransport.API/Services/PodService.cs`
- [Fleet management](https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Services/FleetService.cs): `KTransport.API/Services/FleetService.cs`
- [Shipment records](https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Models/Shipment.cs): `KTransport.API/Models/Shipment.cs`
- [Trip records](https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Models/Trip.cs): `KTransport.API/Models/Trip.cs`
- [Locations](https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Models/Location.cs): `KTransport.API/Models/Location.cs`

### Business capabilities

- [Party records](https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Services/PartyService.cs): `KTransport.API/Services/PartyService.cs`
- [Billing and invoices](https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Services/InvoiceService.cs): `KTransport.API/Services/InvoiceService.cs`
- [Claims operations](https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Services/CargoClaimService.cs): `KTransport.API/Services/CargoClaimService.cs`
- [Reports and analytics](https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Services/ReportService.cs): `KTransport.API/Services/ReportService.cs`
- [Party records](https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Models/Party.cs): `KTransport.API/Models/Party.cs`

### Tenant platform

- [Tenant administration](https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Controllers/TenantController.cs): `KTransport.API/Controllers/TenantController.cs`
- [Tenant management](https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Services/TenantService.cs): `KTransport.API/Services/TenantService.cs`
- [Tenant context](https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Services/ITenantContext.cs): `KTransport.API/Services/ITenantContext.cs`
- [Tenant records](https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Models/Tenant.cs): `KTransport.API/Models/Tenant.cs`
- [Tenant-scoped data](https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Data/KTransportDbContext.cs): `KTransport.API/Data/KTransportDbContext.cs`
- [Number sequences](https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Services/NumberingSequenceService.cs): `KTransport.API/Services/NumberingSequenceService.cs`
- [User records](https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Models/User.cs): `KTransport.API/Models/User.cs`
- [Tenant-scoped entities](https://github.com/nitesh-singh-1/kt_backend/blob/main/KTransport.API/Common/ITenantScopedEntity.cs): `KTransport.API/Common/ITenantScopedEntity.cs`

### Other components

- **API user**

## Connections

- API user → Authentication API: authenticates
- Authentication API → Authentication: delegates to (evidence: `KTransport.API/Controllers/AuthController.cs`)
- API startup → Tenant-scoped data: configures (evidence: `KTransport.API/Program.cs`)
- API startup → Tenant context: registers (evidence: `KTransport.API/Program.cs`)
- Authentication → Tenant-scoped data: reads and writes (evidence: `KTransport.API/Services/AuthService.cs`)
- Authentication → User records: loads (evidence: `KTransport.API/Services/AuthService.cs`)
- Feature authorization → Tenant-scoped data: queries (evidence: `KTransport.API/Services/FeatureAuthorizationService.cs`)
- Feature authorization → Tenant context: uses (evidence: `KTransport.API/Services/FeatureAuthorizationService.cs`)
- Feature authorization → Feature definitions: normalizes (evidence: `KTransport.API/Services/FeatureAuthorizationService.cs`)
- Shipment API → Shipment management: delegates to
- Shipment management → Tenant-scoped data: reads and writes (evidence: `KTransport.API/Services/ShipmentService.cs`)
- Shipment management → Number sequences: gets number (evidence: `KTransport.API/Services/ShipmentService.cs`)
- Shipment management → Shipment records: creates and loads (evidence: `KTransport.API/Services/ShipmentService.cs`)
- Shipment management → Party records: looks up (evidence: `KTransport.API/Services/ShipmentService.cs`)
- Shipment management → Locations: loads hubs (evidence: `KTransport.API/Services/ShipmentService.cs`)
- Trip API → Trip operations: delegates to (evidence: `KTransport.API/Controllers/TripController.cs`)
- Tenant administration → Tenant management: delegates to (evidence: `KTransport.API/Controllers/TenantController.cs`)
- Tenant administration → Tenant context: uses (evidence: `KTransport.API/Controllers/TenantController.cs`)
- Tenant administration → Tenant records: accepts and returns (evidence: `KTransport.API/Controllers/TenantController.cs`)
- Tenant management → Tenant-scoped data: persists
- Tenant-scoped data → Tenant context: filters by (evidence: `KTransport.API/Data/KTransportDbContext.cs`)
- Tenant-scoped data → Tenant-scoped entities: applies tenant rules
- Tenant-scoped data → Tenant records: maps (evidence: `KTransport.API/Data/KTransportDbContext.cs`)
- Tenant-scoped data → Shipment records: maps (evidence: `KTransport.API/Data/KTransportDbContext.cs`)
- Tenant-scoped data → Trip records: maps (evidence: `KTransport.API/Data/KTransportDbContext.cs`)
