# ramkirankumar2002-pixel/trinetra-systems- architecture

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

- Interactive diagram: https://gitdiagram.com/ramkirankumar2002-pixel/trinetra-systems-
- Repository: https://github.com/ramkirankumar2002-pixel/trinetra-systems-

## Overview

Trinetra is a web, API, and site-edge platform for industrial weighbridge operations. The principal workflow takes a vehicle from entry and identification through document and material checks, two weighments, approvals and unloading, then completes the transaction while monitoring security anomalies. The graph also preserves management, integration, onboarding, support, and offline-sync capabilities documented by the README and tree. Internal links are limited to relationships visible in the excerpts or SOURCE INDEX; other subsystem connections are not inferred.

Main entry points: [`apps/api/src/modules/transactions/service.ts`](https://github.com/ramkirankumar2002-pixel/trinetra-systems-/blob/main/apps/api/src/modules/transactions/service.ts) (Transactions), [`apps/api/src/app.ts`](https://github.com/ramkirankumar2002-pixel/trinetra-systems-/blob/main/apps/api/src/app.ts) (Express API), [`apps/web/src/App.tsx`](https://github.com/ramkirankumar2002-pixel/trinetra-systems-/blob/main/apps/web/src/App.tsx) (Web application), [`apps/edge/src/index.ts`](https://github.com/ramkirankumar2002-pixel/trinetra-systems-/blob/main/apps/edge/src/index.ts) (Edge gateway runtime)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["User interface"]
  node_webapp["Web application<br/>[App.tsx]"]
end

subgraph group_api["Operations API"]
  node_transactions["Transactions<br/>[service.ts]"]
  node_vehicle["Vehicle identification<br/>[service.ts]"]
  node_documents["Document verification<br/>[service.ts]"]
  node_materials["Material classification<br/>[service.ts]"]
  node_weighbridge["Weighment capture"]
  node_approvals["Department approvals<br/>[engine.ts]"]
  node_unloading["Unloading assignment<br/>[service.ts]"]
  node_anomalies["Security anomalies<br/>[service.ts]"]
  node_api["Express API<br/>[app.ts]"]
  node_database[("PostgreSQL via Prisma<br/>[client.ts]")]
end

subgraph group_edge["Site edge gateway"]
  node_edge["Edge gateway runtime<br/>[index.ts]"]
  node_offline["Offline operations<br/>[operator.ts]"]
  node_localstore[("Local event store<br/>[localStore.ts]")]
  node_sync["Gateway sync client<br/>[client.ts]"]
end

subgraph group_ops["Platform operations"]
  node_dashboard["Dashboard and reports<br/>[reportAnalytics.ts]"]
  node_integrations["External integrations<br/>[extRoutes.ts]"]
  node_onboarding["Site onboarding"]
  node_support["Support and maintenance<br/>[routes.ts]"]
  node_reliability["Reliability management"]
end

node_users(("Site users"))

node_users -->|"use"| node_webapp
node_webapp -->|"request operations"| node_api
node_api -->|"persist operations"| node_database
node_webapp -->|"route to transaction views"| node_transactions
node_transactions -->|"identify vehicle"| node_vehicle
node_transactions -->|"verify documents"| node_documents
node_transactions -->|"classify material"| node_materials
node_transactions -->|"capture weighments"| node_weighbridge
node_transactions -->|"request approval"| node_approvals
node_transactions -->|"record unloading"| node_unloading
node_transactions -->|"monitor security"| node_anomalies
node_edge -->|"run offline"| node_offline
node_offline -->|"store events"| node_localstore
node_edge -->|"sync gateway"| node_sync
node_sync -->|"send events"| node_api
node_api -->|"serve reporting"| node_dashboard
node_api -->|"serve external routes"| node_integrations
node_api -.->|"provide onboarding"| node_onboarding
node_api -->|"provide support"| node_support
node_api -.->|"provide reliability"| node_reliability

click node_webapp "https://github.com/ramkirankumar2002-pixel/trinetra-systems-/blob/main/apps/web/src/App.tsx"
click node_transactions "https://github.com/ramkirankumar2002-pixel/trinetra-systems-/blob/main/apps/api/src/modules/transactions/service.ts"
click node_vehicle "https://github.com/ramkirankumar2002-pixel/trinetra-systems-/blob/main/apps/api/src/modules/vehicles/service.ts"
click node_documents "https://github.com/ramkirankumar2002-pixel/trinetra-systems-/blob/main/apps/api/src/modules/documents/service.ts"
click node_materials "https://github.com/ramkirankumar2002-pixel/trinetra-systems-/blob/main/apps/api/src/modules/materials/service.ts"
click node_weighbridge "https://github.com/ramkirankumar2002-pixel/trinetra-systems-/blob/main/apps/api/src/integrations/weighbridge/connectionManager.ts"
click node_approvals "https://github.com/ramkirankumar2002-pixel/trinetra-systems-/blob/main/apps/api/src/modules/approvals/engine.ts"
click node_unloading "https://github.com/ramkirankumar2002-pixel/trinetra-systems-/blob/main/apps/api/src/modules/unloadingPoints/service.ts"
click node_anomalies "https://github.com/ramkirankumar2002-pixel/trinetra-systems-/blob/main/apps/api/src/modules/anomalies/service.ts"
click node_api "https://github.com/ramkirankumar2002-pixel/trinetra-systems-/blob/main/apps/api/src/app.ts"
click node_database "https://github.com/ramkirankumar2002-pixel/trinetra-systems-/blob/main/apps/api/src/db/client.ts"
click node_edge "https://github.com/ramkirankumar2002-pixel/trinetra-systems-/blob/main/apps/edge/src/index.ts"
click node_offline "https://github.com/ramkirankumar2002-pixel/trinetra-systems-/blob/main/apps/edge/src/offline/operator.ts"
click node_localstore "https://github.com/ramkirankumar2002-pixel/trinetra-systems-/blob/main/apps/edge/src/store/localStore.ts"
click node_sync "https://github.com/ramkirankumar2002-pixel/trinetra-systems-/blob/main/apps/edge/src/gateway/client.ts"
click node_dashboard "https://github.com/ramkirankumar2002-pixel/trinetra-systems-/blob/main/apps/api/src/modules/dashboard/reportAnalytics.ts"
click node_integrations "https://github.com/ramkirankumar2002-pixel/trinetra-systems-/blob/main/apps/api/src/modules/integration/extRoutes.ts"
click node_onboarding "https://github.com/ramkirankumar2002-pixel/trinetra-systems-/tree/main/apps/api/src/modules/onboarding"
click node_support "https://github.com/ramkirankumar2002-pixel/trinetra-systems-/blob/main/apps/api/src/modules/support/routes.ts"
click node_reliability "https://github.com/ramkirankumar2002-pixel/trinetra-systems-/tree/main/apps/api/src/modules/reliability"

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_users toneBlue
class node_transactions,node_vehicle,node_documents,node_materials,node_weighbridge,node_approvals,node_unloading,node_anomalies,node_api,node_database toneAmber
class node_edge,node_offline,node_localstore,node_sync toneMint
class node_dashboard,node_integrations,node_onboarding,node_support,node_reliability toneRose
```

## Components

### User interface

- [Web application](https://github.com/ramkirankumar2002-pixel/trinetra-systems-/blob/main/apps/web/src/App.tsx): `apps/web/src/App.tsx`

### Operations API

- [Transactions](https://github.com/ramkirankumar2002-pixel/trinetra-systems-/blob/main/apps/api/src/modules/transactions/service.ts): `apps/api/src/modules/transactions/service.ts`
- [Vehicle identification](https://github.com/ramkirankumar2002-pixel/trinetra-systems-/blob/main/apps/api/src/modules/vehicles/service.ts): `apps/api/src/modules/vehicles/service.ts`
- [Document verification](https://github.com/ramkirankumar2002-pixel/trinetra-systems-/blob/main/apps/api/src/modules/documents/service.ts): `apps/api/src/modules/documents/service.ts`
- [Material classification](https://github.com/ramkirankumar2002-pixel/trinetra-systems-/blob/main/apps/api/src/modules/materials/service.ts): `apps/api/src/modules/materials/service.ts`
- [Weighment capture](https://github.com/ramkirankumar2002-pixel/trinetra-systems-/blob/main/apps/api/src/integrations/weighbridge/connectionManager.ts): `apps/api/src/integrations/weighbridge/connectionManager.ts`
- [Department approvals](https://github.com/ramkirankumar2002-pixel/trinetra-systems-/blob/main/apps/api/src/modules/approvals/engine.ts): `apps/api/src/modules/approvals/engine.ts`
- [Unloading assignment](https://github.com/ramkirankumar2002-pixel/trinetra-systems-/blob/main/apps/api/src/modules/unloadingPoints/service.ts): `apps/api/src/modules/unloadingPoints/service.ts`
- [Security anomalies](https://github.com/ramkirankumar2002-pixel/trinetra-systems-/blob/main/apps/api/src/modules/anomalies/service.ts): `apps/api/src/modules/anomalies/service.ts`
- [Express API](https://github.com/ramkirankumar2002-pixel/trinetra-systems-/blob/main/apps/api/src/app.ts): `apps/api/src/app.ts`
- [PostgreSQL via Prisma](https://github.com/ramkirankumar2002-pixel/trinetra-systems-/blob/main/apps/api/src/db/client.ts): `apps/api/src/db/client.ts`

### Site edge gateway

- [Edge gateway runtime](https://github.com/ramkirankumar2002-pixel/trinetra-systems-/blob/main/apps/edge/src/index.ts): `apps/edge/src/index.ts`
- [Offline operations](https://github.com/ramkirankumar2002-pixel/trinetra-systems-/blob/main/apps/edge/src/offline/operator.ts): `apps/edge/src/offline/operator.ts`
- [Local event store](https://github.com/ramkirankumar2002-pixel/trinetra-systems-/blob/main/apps/edge/src/store/localStore.ts): `apps/edge/src/store/localStore.ts`
- [Gateway sync client](https://github.com/ramkirankumar2002-pixel/trinetra-systems-/blob/main/apps/edge/src/gateway/client.ts): `apps/edge/src/gateway/client.ts`

### Platform operations

- [Dashboard and reports](https://github.com/ramkirankumar2002-pixel/trinetra-systems-/blob/main/apps/api/src/modules/dashboard/reportAnalytics.ts): `apps/api/src/modules/dashboard/reportAnalytics.ts`
- [External integrations](https://github.com/ramkirankumar2002-pixel/trinetra-systems-/blob/main/apps/api/src/modules/integration/extRoutes.ts): `apps/api/src/modules/integration/extRoutes.ts`
- [Site onboarding](https://github.com/ramkirankumar2002-pixel/trinetra-systems-/tree/main/apps/api/src/modules/onboarding): `apps/api/src/modules/onboarding`
- [Support and maintenance](https://github.com/ramkirankumar2002-pixel/trinetra-systems-/blob/main/apps/api/src/modules/support/routes.ts): `apps/api/src/modules/support/routes.ts`
- [Reliability management](https://github.com/ramkirankumar2002-pixel/trinetra-systems-/tree/main/apps/api/src/modules/reliability): `apps/api/src/modules/reliability`

### Other components

- **Site users**

## Connections

- Site users → Web application: use (evidence: `README.md`)
- Web application → Express API: request operations (evidence: `README.md`)
- Express API → PostgreSQL via Prisma: persist operations (evidence: `README.md`)
- Web application → Transactions: route to transaction views (evidence: `apps/web/src/App.tsx`)
- Transactions → Vehicle identification: identify vehicle (evidence: `README.md`)
- Transactions → Document verification: verify documents (evidence: `README.md`)
- Transactions → Material classification: classify material (evidence: `README.md`)
- Transactions → Weighment capture: capture weighments (evidence: `README.md`)
- Transactions → Department approvals: request approval (evidence: `apps/api/src/modules/approvals/engine.ts`)
- Transactions → Unloading assignment: record unloading (evidence: `README.md`)
- Transactions → Security anomalies: monitor security (evidence: `README.md`)
- Edge gateway runtime → Offline operations: run offline (evidence: `apps/edge/src/index.ts`)
- Offline operations → Local event store: store events (evidence: `apps/edge/src/offline/operator.ts`)
- Edge gateway runtime → Gateway sync client: sync gateway (evidence: `apps/edge/src/index.ts`)
- Gateway sync client → Express API: send events (evidence: `README.md`)
- Express API → Dashboard and reports: serve reporting
- Express API → External integrations: serve external routes (evidence: `apps/api/src/modules/integration/extRoutes.ts`)
- Express API → Site onboarding: provide onboarding
- Express API → Support and maintenance: provide support (evidence: `apps/api/src/modules/support/routes.ts`)
- Express API → Reliability management: provide reliability
