# jkwhar/repairtracker architecture

> Architecture diagram of the GitHub repository jkwhar/repairtracker, 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/jkwhar/repairtracker
- Repository: https://github.com/jkwhar/repairtracker

## Overview

RepairTracker is an internal Chromebook repair-ticket web app: technicians sign in, look up a device by barcode or query, review its repair history, and record a repair with outcomes, parts, and optional photos. Admins manage users, devices, parts, and outcomes, and can inspect reports and audit activity. The frontend uses PocketBase for authentication, records, and file storage; PocketBase hooks write audit entries. The README describes the stack and intended capabilities, while sampled source confirms selected auth, admin, and audit behavior; unsampled wiring is represented only where the tree and product description support it.

Main entry points: [`frontend/src/lib/pocketbase.ts`](https://github.com/jkwhar/repairtracker/blob/main/frontend/src/lib/pocketbase.ts) (PocketBase client), [`frontend/src/app/admin/layout.tsx`](https://github.com/jkwhar/repairtracker/blob/main/frontend/src/app/admin/layout.tsx) (Admin console), [`frontend/src/components/repair/RepairForm.tsx`](https://github.com/jkwhar/repairtracker/blob/main/frontend/src/components/repair/RepairForm.tsx) (Repair intake), [`frontend/src/lib/api/repairs.ts`](https://github.com/jkwhar/repairtracker/blob/main/frontend/src/lib/api/repairs.ts) (Repair API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_technician["Technician workflow"]
  node_login["Sign in<br/>[page.tsx]"]
  node_repairlist["Repair workspace<br/>[page.tsx]"]
  node_scanner["Barcode scan<br/>[BarcodeScanner.tsx]"]
  node_history["Repair history<br/>[RepairHistory.tsx]"]
  node_repairform["Repair intake<br/>[RepairForm.tsx]"]
  node_outcomeselect["Outcome selection"]
  node_partselect["Parts selection<br/>[PartSelector.tsx]"]
  node_photoupload["Photo upload<br/>[PhotoUpload.tsx]"]
end

subgraph group_administration["Administration"]
  node_admin["Admin console<br/>[layout.tsx]"]
  node_users["User management<br/>[UserManager.tsx]"]
  node_parts["Parts inventory<br/>[PartManager.tsx]"]
  node_outcomes["Outcome management<br/>[OutcomeManager.tsx]"]
  node_devicesadmin["Device management<br/>[page.tsx]"]
  node_csv["CSV import<br/>[CsvUploader.tsx]"]
  node_reports["Reports<br/>[page.tsx]"]
  node_auditview["Audit review<br/>[page.tsx]"]
end

subgraph group_frontend["Frontend services"]
  node_authstate["Auth state<br/>[useAuth.ts]"]
  node_auth["Authentication<br/>[auth.ts]"]
  node_scanlogic["Scan handling"]
  node_devicehook["Device lookup<br/>[useDevice.ts]"]
  node_deviceapi["Device API<br/>[devices.ts]"]
  node_repairhook["Repair data<br/>[useRepairs.ts]"]
  node_repairapi["Repair API<br/>[repairs.ts]"]
  node_usersapi["Users API<br/>[users.ts]"]
  node_partsapi["Parts API<br/>[parts.ts]"]
  node_outcomesapi["Outcomes API<br/>[outcomes.ts]"]
  node_auditapi["Audit API<br/>[audit.ts]"]
  node_pbclient["PocketBase client<br/>[pocketbase.ts]"]
end

subgraph group_backend["PocketBase backend"]
  node_pocketbase[("PocketBase service")]
  node_audit_hook["Audit hooks<br/>[audit.pb.js]"]
  node_photos[("Photo storage")]
end

node_tech(("Technician"))

node_tech -->|"signs in"| node_login
node_login -->|"submits credentials"| node_authstate
node_authstate -->|"calls"| node_auth
node_auth -->|"uses"| node_pbclient
node_pbclient -->|"authenticates"| node_pocketbase
node_tech -->|"opens repairs"| node_repairlist
node_repairlist -->|"uses"| node_scanner
node_scanner -->|"handles input"| node_scanlogic
node_repairlist -->|"looks up device"| node_devicehook
node_devicehook -->|"calls"| node_deviceapi
node_deviceapi -->|"queries"| node_pbclient
node_repairlist -->|"shows history"| node_history
node_history -->|"loads repairs"| node_repairhook
node_repairhook -->|"calls"| node_repairapi
node_repairapi -->|"reads repairs"| node_pbclient
node_tech -->|"records repair"| node_repairform
node_repairform -->|"selects outcome"| node_outcomeselect
node_repairform -->|"selects parts"| node_partselect
node_repairform -->|"attaches photos"| node_photoupload
node_repairform -->|"saves repair"| node_repairapi
node_repairapi -->|"writes repair"| node_pbclient
node_repairapi -.->|"uploads files"| node_photos
node_tech -->|"opens admin"| node_admin
node_admin -->|"manages users"| node_users
node_admin -->|"manages stock"| node_parts
node_admin -->|"manages outcomes"| node_outcomes
node_admin -->|"manages devices"| node_devicesadmin
node_admin -->|"imports data"| node_csv
node_admin -->|"views reports"| node_reports
node_admin -->|"reviews activity"| node_auditview
node_users -->|"calls"| node_usersapi
node_parts -->|"calls"| node_partsapi
node_outcomes -->|"calls"| node_outcomesapi
node_usersapi -->|"uses"| node_pbclient
node_partsapi -->|"uses"| node_pbclient
node_outcomesapi -->|"uses"| node_pbclient
node_auditview -->|"loads logs"| node_auditapi
node_auditapi -->|"uses"| node_pbclient
node_pbclient -->|"accesses records"| node_pocketbase
node_pocketbase -->|"dispatches events"| node_audit_hook
node_audit_hook -->|"writes audit logs"| node_pocketbase

click node_login "https://github.com/jkwhar/repairtracker/blob/main/frontend/src/app/login/page.tsx"
click node_authstate "https://github.com/jkwhar/repairtracker/blob/main/frontend/src/hooks/useAuth.ts"
click node_auth "https://github.com/jkwhar/repairtracker/blob/main/frontend/src/lib/auth.ts"
click node_repairlist "https://github.com/jkwhar/repairtracker/blob/main/frontend/src/app/repairs/page.tsx"
click node_scanner "https://github.com/jkwhar/repairtracker/blob/main/frontend/src/components/repair/BarcodeScanner.tsx"
click node_scanlogic "https://github.com/jkwhar/repairtracker/blob/main/frontend/src/hooks/useBarcodeScanner.ts"
click node_devicehook "https://github.com/jkwhar/repairtracker/blob/main/frontend/src/hooks/useDevice.ts"
click node_deviceapi "https://github.com/jkwhar/repairtracker/blob/main/frontend/src/lib/api/devices.ts"
click node_history "https://github.com/jkwhar/repairtracker/blob/main/frontend/src/components/repair/RepairHistory.tsx"
click node_repairhook "https://github.com/jkwhar/repairtracker/blob/main/frontend/src/hooks/useRepairs.ts"
click node_repairform "https://github.com/jkwhar/repairtracker/blob/main/frontend/src/components/repair/RepairForm.tsx"
click node_outcomeselect "https://github.com/jkwhar/repairtracker/blob/main/frontend/src/components/repair/OutcomeSelector.tsx"
click node_partselect "https://github.com/jkwhar/repairtracker/blob/main/frontend/src/components/repair/PartSelector.tsx"
click node_photoupload "https://github.com/jkwhar/repairtracker/blob/main/frontend/src/components/repair/PhotoUpload.tsx"
click node_repairapi "https://github.com/jkwhar/repairtracker/blob/main/frontend/src/lib/api/repairs.ts"
click node_admin "https://github.com/jkwhar/repairtracker/blob/main/frontend/src/app/admin/layout.tsx"
click node_users "https://github.com/jkwhar/repairtracker/blob/main/frontend/src/components/admin/UserManager.tsx"
click node_parts "https://github.com/jkwhar/repairtracker/blob/main/frontend/src/components/admin/PartManager.tsx"
click node_outcomes "https://github.com/jkwhar/repairtracker/blob/main/frontend/src/components/admin/OutcomeManager.tsx"
click node_devicesadmin "https://github.com/jkwhar/repairtracker/blob/main/frontend/src/app/admin/devices/page.tsx"
click node_csv "https://github.com/jkwhar/repairtracker/blob/main/frontend/src/components/admin/CsvUploader.tsx"
click node_reports "https://github.com/jkwhar/repairtracker/blob/main/frontend/src/app/admin/reports/page.tsx"
click node_auditview "https://github.com/jkwhar/repairtracker/blob/main/frontend/src/app/admin/audit/page.tsx"
click node_usersapi "https://github.com/jkwhar/repairtracker/blob/main/frontend/src/lib/api/users.ts"
click node_partsapi "https://github.com/jkwhar/repairtracker/blob/main/frontend/src/lib/api/parts.ts"
click node_outcomesapi "https://github.com/jkwhar/repairtracker/blob/main/frontend/src/lib/api/outcomes.ts"
click node_auditapi "https://github.com/jkwhar/repairtracker/blob/main/frontend/src/lib/api/audit.ts"
click node_pbclient "https://github.com/jkwhar/repairtracker/blob/main/frontend/src/lib/pocketbase.ts"
click node_audit_hook "https://github.com/jkwhar/repairtracker/blob/main/pocketbase/pb_hooks/audit.pb.js"

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_login,node_repairlist,node_scanner,node_history,node_repairform,node_outcomeselect,node_partselect,node_photoupload toneBlue
class node_admin,node_users,node_parts,node_outcomes,node_devicesadmin,node_csv,node_reports,node_auditview toneAmber
class node_authstate,node_auth,node_scanlogic,node_devicehook,node_deviceapi,node_repairhook,node_repairapi,node_usersapi,node_partsapi,node_outcomesapi,node_auditapi,node_pbclient toneMint
class node_pocketbase,node_audit_hook,node_photos toneRose
class node_tech toneIndigo
```

## Components

### Technician workflow

- [Sign in](https://github.com/jkwhar/repairtracker/blob/main/frontend/src/app/login/page.tsx): `frontend/src/app/login/page.tsx`
- [Repair workspace](https://github.com/jkwhar/repairtracker/blob/main/frontend/src/app/repairs/page.tsx): `frontend/src/app/repairs/page.tsx`
- [Barcode scan](https://github.com/jkwhar/repairtracker/blob/main/frontend/src/components/repair/BarcodeScanner.tsx): `frontend/src/components/repair/BarcodeScanner.tsx`
- [Repair history](https://github.com/jkwhar/repairtracker/blob/main/frontend/src/components/repair/RepairHistory.tsx): `frontend/src/components/repair/RepairHistory.tsx`
- [Repair intake](https://github.com/jkwhar/repairtracker/blob/main/frontend/src/components/repair/RepairForm.tsx): `frontend/src/components/repair/RepairForm.tsx`
- [Outcome selection](https://github.com/jkwhar/repairtracker/blob/main/frontend/src/components/repair/OutcomeSelector.tsx): `frontend/src/components/repair/OutcomeSelector.tsx`
- [Parts selection](https://github.com/jkwhar/repairtracker/blob/main/frontend/src/components/repair/PartSelector.tsx): `frontend/src/components/repair/PartSelector.tsx`
- [Photo upload](https://github.com/jkwhar/repairtracker/blob/main/frontend/src/components/repair/PhotoUpload.tsx): `frontend/src/components/repair/PhotoUpload.tsx`

### Administration

- [Admin console](https://github.com/jkwhar/repairtracker/blob/main/frontend/src/app/admin/layout.tsx): `frontend/src/app/admin/layout.tsx`
- [User management](https://github.com/jkwhar/repairtracker/blob/main/frontend/src/components/admin/UserManager.tsx): `frontend/src/components/admin/UserManager.tsx`
- [Parts inventory](https://github.com/jkwhar/repairtracker/blob/main/frontend/src/components/admin/PartManager.tsx): `frontend/src/components/admin/PartManager.tsx`
- [Outcome management](https://github.com/jkwhar/repairtracker/blob/main/frontend/src/components/admin/OutcomeManager.tsx): `frontend/src/components/admin/OutcomeManager.tsx`
- [Device management](https://github.com/jkwhar/repairtracker/blob/main/frontend/src/app/admin/devices/page.tsx): `frontend/src/app/admin/devices/page.tsx`
- [CSV import](https://github.com/jkwhar/repairtracker/blob/main/frontend/src/components/admin/CsvUploader.tsx): `frontend/src/components/admin/CsvUploader.tsx`
- [Reports](https://github.com/jkwhar/repairtracker/blob/main/frontend/src/app/admin/reports/page.tsx): `frontend/src/app/admin/reports/page.tsx`
- [Audit review](https://github.com/jkwhar/repairtracker/blob/main/frontend/src/app/admin/audit/page.tsx): `frontend/src/app/admin/audit/page.tsx`

### Frontend services

- [Auth state](https://github.com/jkwhar/repairtracker/blob/main/frontend/src/hooks/useAuth.ts): `frontend/src/hooks/useAuth.ts`
- [Authentication](https://github.com/jkwhar/repairtracker/blob/main/frontend/src/lib/auth.ts): `frontend/src/lib/auth.ts`
- [Scan handling](https://github.com/jkwhar/repairtracker/blob/main/frontend/src/hooks/useBarcodeScanner.ts): `frontend/src/hooks/useBarcodeScanner.ts`
- [Device lookup](https://github.com/jkwhar/repairtracker/blob/main/frontend/src/hooks/useDevice.ts): `frontend/src/hooks/useDevice.ts`
- [Device API](https://github.com/jkwhar/repairtracker/blob/main/frontend/src/lib/api/devices.ts): `frontend/src/lib/api/devices.ts`
- [Repair data](https://github.com/jkwhar/repairtracker/blob/main/frontend/src/hooks/useRepairs.ts): `frontend/src/hooks/useRepairs.ts`
- [Repair API](https://github.com/jkwhar/repairtracker/blob/main/frontend/src/lib/api/repairs.ts): `frontend/src/lib/api/repairs.ts`
- [Users API](https://github.com/jkwhar/repairtracker/blob/main/frontend/src/lib/api/users.ts): `frontend/src/lib/api/users.ts`
- [Parts API](https://github.com/jkwhar/repairtracker/blob/main/frontend/src/lib/api/parts.ts): `frontend/src/lib/api/parts.ts`
- [Outcomes API](https://github.com/jkwhar/repairtracker/blob/main/frontend/src/lib/api/outcomes.ts): `frontend/src/lib/api/outcomes.ts`
- [Audit API](https://github.com/jkwhar/repairtracker/blob/main/frontend/src/lib/api/audit.ts): `frontend/src/lib/api/audit.ts`
- [PocketBase client](https://github.com/jkwhar/repairtracker/blob/main/frontend/src/lib/pocketbase.ts): `frontend/src/lib/pocketbase.ts`

### PocketBase backend

- **PocketBase service**
- [Audit hooks](https://github.com/jkwhar/repairtracker/blob/main/pocketbase/pb_hooks/audit.pb.js): `pocketbase/pb_hooks/audit.pb.js`
- **Photo storage**

### Other components

- **Technician**

## Connections

- Technician → Sign in: signs in
- Sign in → Auth state: submits credentials
- Auth state → Authentication: calls
- Authentication → PocketBase client: uses
- PocketBase client → PocketBase service: authenticates
- Technician → Repair workspace: opens repairs
- Repair workspace → Barcode scan: uses
- Barcode scan → Scan handling: handles input
- Repair workspace → Device lookup: looks up device
- Device lookup → Device API: calls
- Device API → PocketBase client: queries
- Repair workspace → Repair history: shows history
- Repair history → Repair data: loads repairs
- Repair data → Repair API: calls
- Repair API → PocketBase client: reads repairs
- Technician → Repair intake: records repair
- Repair intake → Outcome selection: selects outcome
- Repair intake → Parts selection: selects parts
- Repair intake → Photo upload: attaches photos
- Repair intake → Repair API: saves repair
- Repair API → PocketBase client: writes repair
- Repair API → Photo storage: uploads files
- Technician → Admin console: opens admin
- Admin console → User management: manages users
- Admin console → Parts inventory: manages stock
- Admin console → Outcome management: manages outcomes
- Admin console → Device management: manages devices
- Admin console → CSV import: imports data
- Admin console → Reports: views reports
- Admin console → Audit review: reviews activity
- User management → Users API: calls
- Parts inventory → Parts API: calls
- Outcome management → Outcomes API: calls
- Users API → PocketBase client: uses
- Parts API → PocketBase client: uses
- Outcomes API → PocketBase client: uses
- Audit review → Audit API: loads logs
- Audit API → PocketBase client: uses
- PocketBase client → PocketBase service: accesses records
- PocketBase service → Audit hooks: dispatches events
- Audit hooks → PocketBase service: writes audit logs
