# ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system architecture

> Architecture diagram of the GitHub repository ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system
- Repository: https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system

## Overview

PCB-AI is a full-stack PCB inspection and quality-intelligence platform. Engineers submit an image or demo scenario, receive defect detections and stored inspection results, then review process analytics, probable root causes, corrective actions, and closed-loop feedback. The React pages call a centralized API client; FastAPI routes handle requests and services perform inspection and analysis over SQLite-backed records. The README documents the main product capabilities; some route-to-service details and the training/sentinel internals are not fully shown, so uncertain links are omitted.

Main entry points: [`frontend/src/App.jsx`](https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/frontend/src/App.jsx) (Page Router), [`frontend/src/services/api.js`](https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/frontend/src/services/api.js) (API Client), [`backend/main.py`](https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/backend/main.py) (FastAPI App), [`backend/routes/inspection.py`](https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/backend/routes/inspection.py) (Inspection Routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Engineer Console"]
  node_app["Page Router<br/>[App.jsx]"]
  node_inspection_ui["Inspection UI<br/>[Inspection.jsx]"]
  node_quality_ui["Quality Views<br/>[Dashboard.jsx]"]
  node_history_ui["Inspection History<br/>[History.jsx]"]
  node_process_ui["Process Monitoring"]
  node_rca_ui["Root Cause View<br/>[RootCause.jsx]"]
  node_actions_ui["Action Review"]
  node_loop_ui["Closed Loop View<br/>[ClosedLoop.jsx]"]
  node_analytics_ui["Analytics Views<br/>[Analytics.jsx]"]
  node_falsecall_ui["False Call View"]
  node_api_client["API Client<br/>[api.js]"]
end

subgraph group_api["API and Inspection"]
  node_fastapi["FastAPI App<br/>[main.py]"]
  node_inspection_route["Inspection Routes<br/>[inspection.py]"]
  node_process_route["Process Actions<br/>[process_actions.py]"]
  node_analytics_route["Analytics Routes<br/>[analytics.py]"]
  node_dashboard_route["Dashboard Route<br/>[dashboard.py]"]
  node_sentinel_route["Sentinel Routes<br/>[sentinel.py]"]
end

subgraph group_quality["Quality Intelligence"]
  node_mock_engine["Mock Inspection"]
  node_yolo_engine["YOLO Inspection"]
  node_root_cause["Root Cause Analysis"]
  node_corrective["Action Recommendations"]
  node_analytics["Quality Analytics"]
  node_event_hub["Event Hub<br/>[event_hub.py]"]
  node_job_service["Job Service<br/>[job_service.py]"]
  node_dataset_service["Synthetic Datasets"]
end

subgraph group_storage["Inspection Data"]
  node_db_session[("DB Session<br/>[db.py]")]
  node_models[("Inspection Records<br/>[models.py]")]
  node_seeding["Demo Seed Data<br/>[seed.py]"]
end

node_engineer(("Engineer"))

node_engineer -->|"uses console"| node_app
node_app -->|"routes to"| node_inspection_ui
node_app -->|"routes to"| node_quality_ui
node_app -->|"routes to"| node_history_ui
node_app -->|"routes to"| node_process_ui
node_app -->|"routes to"| node_rca_ui
node_app -->|"routes to"| node_actions_ui
node_app -->|"routes to"| node_loop_ui
node_app -->|"routes to"| node_analytics_ui
node_app -->|"routes to"| node_falsecall_ui
node_inspection_ui -->|"submits inspection"| node_api_client
node_quality_ui -->|"requests dashboard"| node_api_client
node_history_ui -->|"requests history"| node_api_client
node_process_ui -->|"requests process data"| node_api_client
node_rca_ui -->|"requests causes"| node_api_client
node_actions_ui -->|"reviews actions"| node_api_client
node_loop_ui -->|"sends feedback"| node_api_client
node_analytics_ui -->|"requests analytics"| node_api_client
node_falsecall_ui -->|"requests comparison"| node_api_client
node_api_client -->|"calls API"| node_fastapi
node_fastapi -->|"mounts routes"| node_inspection_route
node_fastapi -->|"mounts routes"| node_process_route
node_fastapi -->|"mounts routes"| node_analytics_route
node_fastapi -->|"mounts routes"| node_dashboard_route
node_fastapi -->|"mounts routes"| node_sentinel_route
node_inspection_route -->|"uses demo engine"| node_mock_engine
node_inspection_route -->|"runs inference"| node_yolo_engine
node_inspection_route -->|"derives causes"| node_root_cause
node_inspection_route -->|"gets recommendations"| node_corrective
node_analytics_route -->|"requests metrics"| node_analytics
node_dashboard_route -->|"computes KPIs"| node_analytics
node_inspection_route -->|"opens session"| node_db_session
node_process_route -->|"opens session"| node_db_session
node_analytics_route -->|"opens session"| node_db_session
node_dashboard_route -->|"opens session"| node_db_session
node_db_session -->|"maps records"| node_models
node_analytics -->|"queries records"| node_models
node_inspection_route -->|"persists results"| node_models
node_fastapi -->|"creates schema"| node_db_session
node_fastapi -->|"loads seed module"| node_seeding
node_sentinel_route -->|"uses events"| node_event_hub
node_sentinel_route -->|"dispatches jobs"| node_job_service
node_sentinel_route -->|"creates datasets"| node_dataset_service
node_job_service -->|"publishes events"| node_event_hub

click node_app "https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/frontend/src/App.jsx"
click node_inspection_ui "https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/frontend/src/pages/Inspection.jsx"
click node_quality_ui "https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/frontend/src/pages/Dashboard.jsx"
click node_history_ui "https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/frontend/src/pages/History.jsx"
click node_process_ui "https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/frontend/src/pages/ProcessMonitoring.jsx"
click node_rca_ui "https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/frontend/src/pages/RootCause.jsx"
click node_actions_ui "https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/frontend/src/pages/CorrectiveActions.jsx"
click node_loop_ui "https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/frontend/src/pages/ClosedLoop.jsx"
click node_analytics_ui "https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/frontend/src/pages/Analytics.jsx"
click node_falsecall_ui "https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/frontend/src/pages/FalseCallAnalysis.jsx"
click node_api_client "https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/frontend/src/services/api.js"
click node_fastapi "https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/backend/main.py"
click node_inspection_route "https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/backend/routes/inspection.py"
click node_process_route "https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/backend/routes/process_actions.py"
click node_analytics_route "https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/backend/routes/analytics.py"
click node_dashboard_route "https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/backend/routes/dashboard.py"
click node_sentinel_route "https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/backend/routes/sentinel.py"
click node_mock_engine "https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/backend/services/mock_inspection_service.py"
click node_yolo_engine "https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/backend/services/yolo_inspection_service.py"
click node_root_cause "https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/backend/services/root_cause_service.py"
click node_corrective "https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/backend/services/corrective_action_service.py"
click node_analytics "https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/backend/services/analytics_service.py"
click node_event_hub "https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/backend/services/event_hub.py"
click node_job_service "https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/backend/services/job_service.py"
click node_dataset_service "https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/backend/services/synthetic_dataset_service.py"
click node_db_session "https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/backend/database/db.py"
click node_models "https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/backend/models/models.py"
click node_seeding "https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/backend/database/seed.py"

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_inspection_ui,node_quality_ui,node_history_ui,node_process_ui,node_rca_ui,node_actions_ui,node_loop_ui,node_analytics_ui,node_falsecall_ui,node_api_client toneBlue
class node_fastapi,node_inspection_route,node_process_route,node_analytics_route,node_dashboard_route,node_sentinel_route toneAmber
class node_mock_engine,node_yolo_engine,node_root_cause,node_corrective,node_analytics,node_event_hub,node_job_service,node_dataset_service toneMint
class node_db_session,node_models,node_seeding toneRose
class node_engineer toneIndigo
```

## Components

### Engineer Console

- [Page Router](https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Inspection UI](https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/frontend/src/pages/Inspection.jsx): `frontend/src/pages/Inspection.jsx`
- [Quality Views](https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/frontend/src/pages/Dashboard.jsx): `frontend/src/pages/Dashboard.jsx`
- [Inspection History](https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/frontend/src/pages/History.jsx): `frontend/src/pages/History.jsx`
- [Process Monitoring](https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/frontend/src/pages/ProcessMonitoring.jsx): `frontend/src/pages/ProcessMonitoring.jsx`
- [Root Cause View](https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/frontend/src/pages/RootCause.jsx): `frontend/src/pages/RootCause.jsx`
- [Action Review](https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/frontend/src/pages/CorrectiveActions.jsx): `frontend/src/pages/CorrectiveActions.jsx`
- [Closed Loop View](https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/frontend/src/pages/ClosedLoop.jsx): `frontend/src/pages/ClosedLoop.jsx`
- [Analytics Views](https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/frontend/src/pages/Analytics.jsx): `frontend/src/pages/Analytics.jsx`
- [False Call View](https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/frontend/src/pages/FalseCallAnalysis.jsx): `frontend/src/pages/FalseCallAnalysis.jsx`
- [API Client](https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`

### API and Inspection

- [FastAPI App](https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/backend/main.py): `backend/main.py`
- [Inspection Routes](https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/backend/routes/inspection.py): `backend/routes/inspection.py`
- [Process Actions](https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/backend/routes/process_actions.py): `backend/routes/process_actions.py`
- [Analytics Routes](https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/backend/routes/analytics.py): `backend/routes/analytics.py`
- [Dashboard Route](https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/backend/routes/dashboard.py): `backend/routes/dashboard.py`
- [Sentinel Routes](https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/backend/routes/sentinel.py): `backend/routes/sentinel.py`

### Quality Intelligence

- [Mock Inspection](https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/backend/services/mock_inspection_service.py): `backend/services/mock_inspection_service.py`
- [YOLO Inspection](https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/backend/services/yolo_inspection_service.py): `backend/services/yolo_inspection_service.py`
- [Root Cause Analysis](https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/backend/services/root_cause_service.py): `backend/services/root_cause_service.py`
- [Action Recommendations](https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/backend/services/corrective_action_service.py): `backend/services/corrective_action_service.py`
- [Quality Analytics](https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/backend/services/analytics_service.py): `backend/services/analytics_service.py`
- [Event Hub](https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/backend/services/event_hub.py): `backend/services/event_hub.py`
- [Job Service](https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/backend/services/job_service.py): `backend/services/job_service.py`
- [Synthetic Datasets](https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/backend/services/synthetic_dataset_service.py): `backend/services/synthetic_dataset_service.py`

### Inspection Data

- [DB Session](https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/backend/database/db.py): `backend/database/db.py`
- [Inspection Records](https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/backend/models/models.py): `backend/models/models.py`
- [Demo Seed Data](https://github.com/ltvasanth/inspectraai-ai-powered-pcb-defect-inspection-system/blob/main/backend/database/seed.py): `backend/database/seed.py`

### Other components

- **Engineer**

## Connections

- Engineer → Page Router: uses console (evidence: `frontend/src/App.jsx`)
- Page Router → Inspection UI: routes to (evidence: `frontend/src/App.jsx`)
- Page Router → Quality Views: routes to (evidence: `frontend/src/App.jsx`)
- Page Router → Inspection History: routes to (evidence: `frontend/src/App.jsx`)
- Page Router → Process Monitoring: routes to (evidence: `frontend/src/App.jsx`)
- Page Router → Root Cause View: routes to (evidence: `frontend/src/App.jsx`)
- Page Router → Action Review: routes to (evidence: `frontend/src/App.jsx`)
- Page Router → Closed Loop View: routes to (evidence: `frontend/src/App.jsx`)
- Page Router → Analytics Views: routes to (evidence: `frontend/src/App.jsx`)
- Page Router → False Call View: routes to (evidence: `frontend/src/App.jsx`)
- Inspection UI → API Client: submits inspection (evidence: `frontend/src/pages/Inspection.jsx`)
- Quality Views → API Client: requests dashboard (evidence: `frontend/src/pages/Dashboard.jsx`)
- Inspection History → API Client: requests history (evidence: `frontend/src/pages/History.jsx`)
- Process Monitoring → API Client: requests process data (evidence: `frontend/src/pages/ProcessMonitoring.jsx`)
- Root Cause View → API Client: requests causes (evidence: `frontend/src/pages/RootCause.jsx`)
- Action Review → API Client: reviews actions (evidence: `frontend/src/pages/CorrectiveActions.jsx`)
- Closed Loop View → API Client: sends feedback (evidence: `frontend/src/pages/ClosedLoop.jsx`)
- Analytics Views → API Client: requests analytics (evidence: `frontend/src/pages/Analytics.jsx`)
- False Call View → API Client: requests comparison (evidence: `frontend/src/pages/FalseCallAnalysis.jsx`)
- API Client → FastAPI App: calls API (evidence: `README.md`)
- FastAPI App → Inspection Routes: mounts routes (evidence: `backend/main.py`)
- FastAPI App → Process Actions: mounts routes (evidence: `backend/main.py`)
- FastAPI App → Analytics Routes: mounts routes (evidence: `backend/main.py`)
- FastAPI App → Dashboard Route: mounts routes (evidence: `backend/main.py`)
- FastAPI App → Sentinel Routes: mounts routes (evidence: `backend/main.py`)
- Inspection Routes → Mock Inspection: uses demo engine (evidence: `backend/routes/inspection.py`)
- Inspection Routes → YOLO Inspection: runs inference (evidence: `backend/routes/inspection.py`)
- Inspection Routes → Root Cause Analysis: derives causes (evidence: `backend/routes/inspection.py`)
- Inspection Routes → Action Recommendations: gets recommendations (evidence: `backend/routes/inspection.py`)
- Analytics Routes → Quality Analytics: requests metrics (evidence: `backend/routes/analytics.py`)
- Dashboard Route → Quality Analytics: computes KPIs (evidence: `backend/routes/dashboard.py`)
- Inspection Routes → DB Session: opens session (evidence: `backend/routes/inspection.py`)
- Process Actions → DB Session: opens session (evidence: `backend/routes/process_actions.py`)
- Analytics Routes → DB Session: opens session (evidence: `backend/routes/analytics.py`)
- Dashboard Route → DB Session: opens session (evidence: `backend/routes/dashboard.py`)
- DB Session → Inspection Records: maps records (evidence: `backend/models/models.py`)
- Quality Analytics → Inspection Records: queries records (evidence: `backend/services/analytics_service.py`)
- Inspection Routes → Inspection Records: persists results (evidence: `backend/routes/inspection.py`)
- FastAPI App → DB Session: creates schema (evidence: `backend/main.py`)
- FastAPI App → Demo Seed Data: loads seed module (evidence: `backend/main.py`)
- Sentinel Routes → Event Hub: uses events (evidence: `backend/routes/sentinel.py`)
- Sentinel Routes → Job Service: dispatches jobs (evidence: `backend/routes/sentinel.py`)
- Sentinel Routes → Synthetic Datasets: creates datasets (evidence: `backend/routes/sentinel.py`)
- Job Service → Event Hub: publishes events (evidence: `backend/services/job_service.py`)
