# afri-trade-exchange/sentra architecture

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

- Interactive diagram: https://gitdiagram.com/afri-trade-exchange/sentra
- Repository: https://github.com/afri-trade-exchange/sentra

## Overview

Sentra supports traders creating consignments and uploading trade documents, then using generated QR codes and status views to support border clearance by customs officers. The README documents these product capabilities; sampled code confirms route protection, Firebase authentication and role lookup, and a simulated public tracking lookup. Consignment and document persistence wiring was not sampled, so those connections are shown only where documented and no backend service is inferred.

Main entry points: [`src/App.tsx`](https://github.com/afri-trade-exchange/sentra/blob/main/src/App.tsx) (Routes and shell), [`src/Components/CustomsDashboard.tsx`](https://github.com/afri-trade-exchange/sentra/blob/main/src/Components/CustomsDashboard.tsx) (Customs dashboard), [`src/Components/Landing/LandingPage.tsx`](https://github.com/afri-trade-exchange/sentra/blob/main/src/Components/Landing/LandingPage.tsx) (Landing and tracking), [`src/Components/Dashboard.tsx`](https://github.com/afri-trade-exchange/sentra/blob/main/src/Components/Dashboard.tsx) (Trader dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Public and access"]
  node_app["Routes and shell<br/>[App.tsx]"]
  node_landing["Landing and tracking<br/>[LandingPage.tsx]"]
end

subgraph group_identity["Identity and roles"]
  node_signup["Trader signup<br/>[TraderSignup.tsx]"]
  node_login["Sign-in<br/>[LoginPage.tsx]"]
  node_auth_context["Auth context<br/>[AuthContext.tsx]"]
  node_protected["Role-protected routes<br/>[ProtectedRoute.tsx]"]
  node_auth_service["Auth and user roles<br/>[authService.ts]"]
end

subgraph group_trader["Trader workflow"]
  node_trader_dashboard["Trader dashboard<br/>[Dashboard.tsx]"]
  node_create_consignment["Consignment creation"]
  node_upload["Document upload<br/>[UploadModal.tsx]"]
  node_trader_types["Dashboard data types<br/>[dashboard.ts]"]
  node_invoice["Invoice details and export"]
  node_trader_settings["Account settings<br/>[Settings.tsx]"]
end

subgraph group_customs["Customs clearance"]
  node_customs_dashboard["Customs dashboard"]
  node_scanner["QR scanner<br/>[QrScannerModal.tsx]"]
  node_queue["Consignment queue<br/>[SearchInput.tsx]"]
  node_status["Status and timeline<br/>[StatusDropdown.tsx]"]
  node_bulk["Bulk actions<br/>[BulkActions.tsx]"]
  node_analytics["Analytics and activity"]
  node_help["Officer onboarding<br/>[GuidedTour.tsx]"]
end

subgraph group_services["External services"]
  node_firebase_auth["Firebase Authentication"]
  node_firestore[("Firestore")]
end

node_visitor(("Visitor"))
node_trader_actor(("Trader"))
node_officer(("Customs officer"))

node_visitor -->|"opens"| node_app
node_trader_actor -->|"opens"| node_app
node_officer -->|"opens"| node_app
node_app -->|"routes to"| node_landing
node_landing -->|"navigates to"| node_signup
node_landing -->|"navigates to"| node_login
node_landing -->|"looks up order"| node_landing
node_app -->|"routes to"| node_signup
node_app -->|"routes to"| node_login
node_signup -->|"registers user"| node_auth_service
node_login -->|"authenticates"| node_auth_service
node_auth_service -->|"creates or signs in"| node_firebase_auth
node_auth_service -->|"reads and writes roles"| node_firestore
node_auth_context -->|"observes session"| node_firebase_auth
node_auth_context -->|"reads user role"| node_firestore
node_app -->|"provides auth"| node_auth_context
node_app -->|"wraps private routes"| node_protected
node_protected -->|"checks role"| node_auth_context
node_app -->|"routes to"| node_trader_dashboard
node_app -->|"routes to"| node_customs_dashboard
node_trader_dashboard -->|"opens creation"| node_create_consignment
node_create_consignment -->|"collects documents"| node_upload
node_create_consignment -->|"uses data types"| node_trader_types
node_trader_dashboard -->|"opens invoice"| node_invoice
node_trader_actor -->|"manages consignments"| node_trader_dashboard
node_officer -->|"reviews consignments"| node_customs_dashboard
node_customs_dashboard -->|"opens scanner"| node_scanner
node_customs_dashboard -->|"searches queue"| node_queue
node_customs_dashboard -->|"updates status"| node_status
node_customs_dashboard -->|"dispatches bulk actions"| node_bulk
node_customs_dashboard -->|"shows insights"| node_analytics
node_customs_dashboard -->|"offers onboarding"| node_help
node_trader_dashboard -.->|"consignment data"| node_firestore
node_customs_dashboard -.->|"consignment data"| node_firestore

click node_app "https://github.com/afri-trade-exchange/sentra/blob/main/src/App.tsx"
click node_landing "https://github.com/afri-trade-exchange/sentra/blob/main/src/Components/Landing/LandingPage.tsx"
click node_signup "https://github.com/afri-trade-exchange/sentra/blob/main/src/Components/TraderSignup.tsx"
click node_login "https://github.com/afri-trade-exchange/sentra/blob/main/src/Components/LoginPage.tsx"
click node_auth_context "https://github.com/afri-trade-exchange/sentra/blob/main/src/Components/AuthContext.tsx"
click node_protected "https://github.com/afri-trade-exchange/sentra/blob/main/src/Components/ProtectedRoute.tsx"
click node_auth_service "https://github.com/afri-trade-exchange/sentra/blob/main/src/firebase/authService.ts"
click node_trader_dashboard "https://github.com/afri-trade-exchange/sentra/blob/main/src/Components/Dashboard.tsx"
click node_create_consignment "https://github.com/afri-trade-exchange/sentra/blob/main/src/Components/Dashboard/ConsignmentCreationModal.tsx"
click node_upload "https://github.com/afri-trade-exchange/sentra/blob/main/src/Components/UploadModal.tsx"
click node_trader_types "https://github.com/afri-trade-exchange/sentra/blob/main/src/types/dashboard.ts"
click node_invoice "https://github.com/afri-trade-exchange/sentra/blob/main/src/Components/InvoiceDetailModal.tsx"
click node_trader_settings "https://github.com/afri-trade-exchange/sentra/blob/main/src/Components/Settings.tsx"
click node_customs_dashboard "https://github.com/afri-trade-exchange/sentra/blob/main/src/Components/CustomsDashboard.tsx"
click node_scanner "https://github.com/afri-trade-exchange/sentra/blob/main/src/Components/CustomsDashboard/QrScannerModal.tsx"
click node_queue "https://github.com/afri-trade-exchange/sentra/blob/main/src/Components/CustomsDashboard/SearchInput.tsx"
click node_status "https://github.com/afri-trade-exchange/sentra/blob/main/src/Components/CustomsDashboard/StatusDropdown.tsx"
click node_bulk "https://github.com/afri-trade-exchange/sentra/blob/main/src/Components/CustomsDashboard/BulkActions.tsx"
click node_analytics "https://github.com/afri-trade-exchange/sentra/blob/main/src/Components/CustomsDashboard/AnalyticsOverview.tsx"
click node_help "https://github.com/afri-trade-exchange/sentra/blob/main/src/Components/CustomsDashboard/GuidedTour.tsx"

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_landing toneBlue
class node_signup,node_login,node_auth_context,node_protected,node_auth_service toneAmber
class node_trader_dashboard,node_create_consignment,node_upload,node_trader_types,node_invoice,node_trader_settings toneMint
class node_customs_dashboard,node_scanner,node_queue,node_status,node_bulk,node_analytics,node_help toneRose
class node_firebase_auth,node_firestore,node_visitor,node_trader_actor,node_officer toneIndigo
```

## Components

### Public and access

- [Routes and shell](https://github.com/afri-trade-exchange/sentra/blob/main/src/App.tsx): `src/App.tsx`
- [Landing and tracking](https://github.com/afri-trade-exchange/sentra/blob/main/src/Components/Landing/LandingPage.tsx): `src/Components/Landing/LandingPage.tsx`

### Identity and roles

- [Trader signup](https://github.com/afri-trade-exchange/sentra/blob/main/src/Components/TraderSignup.tsx): `src/Components/TraderSignup.tsx`
- [Sign-in](https://github.com/afri-trade-exchange/sentra/blob/main/src/Components/LoginPage.tsx): `src/Components/LoginPage.tsx`
- [Auth context](https://github.com/afri-trade-exchange/sentra/blob/main/src/Components/AuthContext.tsx): `src/Components/AuthContext.tsx`
- [Role-protected routes](https://github.com/afri-trade-exchange/sentra/blob/main/src/Components/ProtectedRoute.tsx): `src/Components/ProtectedRoute.tsx`
- [Auth and user roles](https://github.com/afri-trade-exchange/sentra/blob/main/src/firebase/authService.ts): `src/firebase/authService.ts`

### Trader workflow

- [Trader dashboard](https://github.com/afri-trade-exchange/sentra/blob/main/src/Components/Dashboard.tsx): `src/Components/Dashboard.tsx`
- [Consignment creation](https://github.com/afri-trade-exchange/sentra/blob/main/src/Components/Dashboard/ConsignmentCreationModal.tsx): `src/Components/Dashboard/ConsignmentCreationModal.tsx`
- [Document upload](https://github.com/afri-trade-exchange/sentra/blob/main/src/Components/UploadModal.tsx): `src/Components/UploadModal.tsx`
- [Dashboard data types](https://github.com/afri-trade-exchange/sentra/blob/main/src/types/dashboard.ts): `src/types/dashboard.ts`
- [Invoice details and export](https://github.com/afri-trade-exchange/sentra/blob/main/src/Components/InvoiceDetailModal.tsx): `src/Components/InvoiceDetailModal.tsx`
- [Account settings](https://github.com/afri-trade-exchange/sentra/blob/main/src/Components/Settings.tsx): `src/Components/Settings.tsx`

### Customs clearance

- [Customs dashboard](https://github.com/afri-trade-exchange/sentra/blob/main/src/Components/CustomsDashboard.tsx): `src/Components/CustomsDashboard.tsx`
- [QR scanner](https://github.com/afri-trade-exchange/sentra/blob/main/src/Components/CustomsDashboard/QrScannerModal.tsx): `src/Components/CustomsDashboard/QrScannerModal.tsx`
- [Consignment queue](https://github.com/afri-trade-exchange/sentra/blob/main/src/Components/CustomsDashboard/SearchInput.tsx): `src/Components/CustomsDashboard/SearchInput.tsx`
- [Status and timeline](https://github.com/afri-trade-exchange/sentra/blob/main/src/Components/CustomsDashboard/StatusDropdown.tsx): `src/Components/CustomsDashboard/StatusDropdown.tsx`
- [Bulk actions](https://github.com/afri-trade-exchange/sentra/blob/main/src/Components/CustomsDashboard/BulkActions.tsx): `src/Components/CustomsDashboard/BulkActions.tsx`
- [Analytics and activity](https://github.com/afri-trade-exchange/sentra/blob/main/src/Components/CustomsDashboard/AnalyticsOverview.tsx): `src/Components/CustomsDashboard/AnalyticsOverview.tsx`
- [Officer onboarding](https://github.com/afri-trade-exchange/sentra/blob/main/src/Components/CustomsDashboard/GuidedTour.tsx): `src/Components/CustomsDashboard/GuidedTour.tsx`

### External services

- **Firebase Authentication**
- **Firestore**

### Other components

- **Visitor**
- **Trader**
- **Customs officer**

## Connections

- Visitor → Routes and shell: opens
- Trader → Routes and shell: opens
- Customs officer → Routes and shell: opens
- Routes and shell → Landing and tracking: routes to
- Landing and tracking → Trader signup: navigates to
- Landing and tracking → Sign-in: navigates to
- Landing and tracking → Landing and tracking: looks up order
- Routes and shell → Trader signup: routes to
- Routes and shell → Sign-in: routes to
- Trader signup → Auth and user roles: registers user
- Sign-in → Auth and user roles: authenticates
- Auth and user roles → Firebase Authentication: creates or signs in
- Auth and user roles → Firestore: reads and writes roles
- Auth context → Firebase Authentication: observes session
- Auth context → Firestore: reads user role
- Routes and shell → Auth context: provides auth
- Routes and shell → Role-protected routes: wraps private routes
- Role-protected routes → Auth context: checks role
- Routes and shell → Trader dashboard: routes to
- Routes and shell → Customs dashboard: routes to
- Trader dashboard → Consignment creation: opens creation
- Consignment creation → Document upload: collects documents
- Consignment creation → Dashboard data types: uses data types
- Trader dashboard → Invoice details and export: opens invoice
- Trader → Trader dashboard: manages consignments
- Customs officer → Customs dashboard: reviews consignments
- Customs dashboard → QR scanner: opens scanner
- Customs dashboard → Consignment queue: searches queue
- Customs dashboard → Status and timeline: updates status
- Customs dashboard → Bulk actions: dispatches bulk actions
- Customs dashboard → Analytics and activity: shows insights
- Customs dashboard → Officer onboarding: offers onboarding
- Trader dashboard → Firestore: consignment data
- Customs dashboard → Firestore: consignment data
