# jaishilautomation-maker/automation architecture

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

- Interactive diagram: https://gitdiagram.com/jaishilautomation-maker/automation
- Repository: https://github.com/jaishilautomation-maker/automation

## Overview

This is a factory-operations web app spanning production, stores, pulveriser operations and laboratory quality control. Staff enter and review operational records; lab workflows additionally create batches, finalize QC, generate emailed reports, and exchange finalized QC records with the A-20 system. The tree and sampled routes establish these server-side integrations, but most page implementations were not sampled, so page-to-storage wiring is shown only where documented, not inferred across the product.

Main entry points: [`lib/reports/generate-filled-report.ts`](https://github.com/jaishilautomation-maker/automation/blob/main/lib/reports/generate-filled-report.ts) (Report builder), [`app/api/notify/route.ts`](https://github.com/jaishilautomation-maker/automation/blob/main/app/api/notify/route.ts) (Notification API), [`app/api/qc-exchange/send/route.ts`](https://github.com/jaishilautomation-maker/automation/blob/main/app/api/qc-exchange/send/route.ts) (QC exchange sender), [`app/api/qc-exchange/retry-pending/route.ts`](https://github.com/jaishilautomation-maker/automation/blob/main/app/api/qc-exchange/retry-pending/route.ts) (Exchange retries)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_operations["Factory Operations"]
  node_dashboard["Operations dashboard<br/>[page.tsx]"]
  node_production["Production records<br/>[page.tsx]"]
  node_maintenance["Maintenance<br/>[page.tsx]"]
  node_breakdown["Breakdown records<br/>[page.tsx]"]
  node_packing["Packing operations<br/>[page.tsx]"]
  node_jobcard["Production job cards<br/>[page.tsx]"]
  node_stores["Stores management<br/>[page.tsx]"]
  node_pulveriser["Pulveriser workflows<br/>[page.tsx]"]
end

subgraph group_quality["Lab Quality"]
  node_qc["QC workflows<br/>[page.tsx]"]
  node_qc_records["QC records and search<br/>[page.tsx]"]
  node_qc_imports["QC imports<br/>[page.tsx]"]
  node_batch_api["Batch creation API<br/>[route.ts]"]
  node_report_api["Report generation API<br/>[route.ts]"]
  node_report_builder["Report builder"]
end

subgraph group_platform["Identity and Data"]
  node_auth["Authentication<br/>[page.tsx]"]
  node_profile_api["User profile API<br/>[route.ts]"]
  node_supabase[("Supabase")]
end

subgraph group_integrations["External Integrations"]
  node_notify_api["Notification API<br/>[route.ts]"]
  node_sheets_sync["Sheets synchronization<br/>[sheets-sync.ts]"]
  node_email["Email service"]
  node_sheets[("Google Sheets")]
  node_exchange_send["QC exchange sender<br/>[route.ts]"]
  node_exchange_receive["QC exchange receiver<br/>[route.ts]"]
  node_exchange_retry["Exchange retries<br/>[route.ts]"]
  node_a20["A-20 system"]
end

node_staff(("Factory staff"))

node_staff -->|"signs in"| node_auth
node_staff -->|"uses"| node_dashboard
node_staff -->|"records"| node_production
node_staff -->|"records"| node_maintenance
node_staff -->|"records"| node_breakdown
node_staff -->|"records"| node_packing
node_staff -->|"records"| node_jobcard
node_staff -->|"manages"| node_stores
node_staff -->|"operates"| node_pulveriser
node_staff -->|"records"| node_qc
node_staff -->|"reviews"| node_qc_records
node_staff -->|"reviews"| node_qc_imports
node_batch_api -->|"creates batch and QC rows"| node_supabase
node_report_api -->|"generates report"| node_report_builder
node_report_builder -->|"reads record"| node_supabase
node_report_builder -->|"emails report"| node_email
node_profile_api -->|"reads profile"| node_supabase
node_notify_api -->|"sends email"| node_email
node_notify_api -->|"dispatches sheet sync"| node_sheets_sync
node_sheets_sync -->|"writes rows"| node_sheets
node_exchange_send -->|"writes exchange log"| node_supabase
node_exchange_send -->|"sends signed QC"| node_a20
node_a20 -->|"posts QC payload"| node_exchange_receive
node_exchange_receive -->|"stores imported QC"| node_supabase
node_exchange_retry -->|"reads pending log"| node_supabase
node_exchange_retry -->|"retries delivery"| node_a20

click node_dashboard "https://github.com/jaishilautomation-maker/automation/blob/main/app/(app)/dashboard/page.tsx"
click node_production "https://github.com/jaishilautomation-maker/automation/blob/main/app/(app)/operator/page.tsx"
click node_maintenance "https://github.com/jaishilautomation-maker/automation/blob/main/app/(app)/maintenance/page.tsx"
click node_breakdown "https://github.com/jaishilautomation-maker/automation/blob/main/app/(app)/breakdown/page.tsx"
click node_packing "https://github.com/jaishilautomation-maker/automation/blob/main/app/(app)/packing-breakdown/page.tsx"
click node_jobcard "https://github.com/jaishilautomation-maker/automation/blob/main/app/(app)/production-job-card/page.tsx"
click node_stores "https://github.com/jaishilautomation-maker/automation/blob/main/app/(app)/stores/page.tsx"
click node_pulveriser "https://github.com/jaishilautomation-maker/automation/blob/main/app/(app)/pulveriser/production/page.tsx"
click node_qc "https://github.com/jaishilautomation-maker/automation/blob/main/app/(app)/lab-qc/page.tsx"
click node_qc_records "https://github.com/jaishilautomation-maker/automation/blob/main/app/(app)/lab-qc/records/page.tsx"
click node_qc_imports "https://github.com/jaishilautomation-maker/automation/blob/main/app/(app)/lab-qc/qc-imports/page.tsx"
click node_batch_api "https://github.com/jaishilautomation-maker/automation/blob/main/app/api/lab-qc/create-batch/route.ts"
click node_report_api "https://github.com/jaishilautomation-maker/automation/blob/main/app/api/lab-qc/generate-report/route.ts"
click node_report_builder "https://github.com/jaishilautomation-maker/automation/blob/main/lib/reports/generate-filled-report.ts"
click node_auth "https://github.com/jaishilautomation-maker/automation/blob/main/app/(auth)/login/page.tsx"
click node_profile_api "https://github.com/jaishilautomation-maker/automation/blob/main/app/api/auth/profile/route.ts"
click node_notify_api "https://github.com/jaishilautomation-maker/automation/blob/main/app/api/notify/route.ts"
click node_sheets_sync "https://github.com/jaishilautomation-maker/automation/blob/main/lib/notifications/sheets-sync.ts"
click node_exchange_send "https://github.com/jaishilautomation-maker/automation/blob/main/app/api/qc-exchange/send/route.ts"
click node_exchange_receive "https://github.com/jaishilautomation-maker/automation/blob/main/app/api/qc-exchange/receive/route.ts"
click node_exchange_retry "https://github.com/jaishilautomation-maker/automation/blob/main/app/api/qc-exchange/retry-pending/route.ts"

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_dashboard,node_production,node_maintenance,node_breakdown,node_packing,node_jobcard,node_stores,node_pulveriser toneBlue
class node_qc,node_qc_records,node_qc_imports,node_batch_api,node_report_api,node_report_builder toneAmber
class node_auth,node_profile_api,node_supabase toneMint
class node_notify_api,node_sheets_sync,node_email,node_sheets,node_exchange_send,node_exchange_receive,node_exchange_retry,node_a20 toneRose
class node_staff toneIndigo
```

## Components

### Factory Operations

- [Operations dashboard](https://github.com/jaishilautomation-maker/automation/blob/main/app/(app)/dashboard/page.tsx): `app/(app)/dashboard/page.tsx`
- [Production records](https://github.com/jaishilautomation-maker/automation/blob/main/app/(app)/operator/page.tsx): `app/(app)/operator/page.tsx`
- [Maintenance](https://github.com/jaishilautomation-maker/automation/blob/main/app/(app)/maintenance/page.tsx): `app/(app)/maintenance/page.tsx`
- [Breakdown records](https://github.com/jaishilautomation-maker/automation/blob/main/app/(app)/breakdown/page.tsx): `app/(app)/breakdown/page.tsx`
- [Packing operations](https://github.com/jaishilautomation-maker/automation/blob/main/app/(app)/packing-breakdown/page.tsx): `app/(app)/packing-breakdown/page.tsx`
- [Production job cards](https://github.com/jaishilautomation-maker/automation/blob/main/app/(app)/production-job-card/page.tsx): `app/(app)/production-job-card/page.tsx`
- [Stores management](https://github.com/jaishilautomation-maker/automation/blob/main/app/(app)/stores/page.tsx): `app/(app)/stores/page.tsx`
- [Pulveriser workflows](https://github.com/jaishilautomation-maker/automation/blob/main/app/(app)/pulveriser/production/page.tsx): `app/(app)/pulveriser/production/page.tsx`

### Lab Quality

- [QC workflows](https://github.com/jaishilautomation-maker/automation/blob/main/app/(app)/lab-qc/page.tsx): `app/(app)/lab-qc/page.tsx`
- [QC records and search](https://github.com/jaishilautomation-maker/automation/blob/main/app/(app)/lab-qc/records/page.tsx): `app/(app)/lab-qc/records/page.tsx`
- [QC imports](https://github.com/jaishilautomation-maker/automation/blob/main/app/(app)/lab-qc/qc-imports/page.tsx): `app/(app)/lab-qc/qc-imports/page.tsx`
- [Batch creation API](https://github.com/jaishilautomation-maker/automation/blob/main/app/api/lab-qc/create-batch/route.ts): `app/api/lab-qc/create-batch/route.ts`
- [Report generation API](https://github.com/jaishilautomation-maker/automation/blob/main/app/api/lab-qc/generate-report/route.ts): `app/api/lab-qc/generate-report/route.ts`
- [Report builder](https://github.com/jaishilautomation-maker/automation/blob/main/lib/reports/generate-filled-report.ts): `lib/reports/generate-filled-report.ts`

### Identity and Data

- [Authentication](https://github.com/jaishilautomation-maker/automation/blob/main/app/(auth)/login/page.tsx): `app/(auth)/login/page.tsx`
- [User profile API](https://github.com/jaishilautomation-maker/automation/blob/main/app/api/auth/profile/route.ts): `app/api/auth/profile/route.ts`
- **Supabase**

### External Integrations

- [Notification API](https://github.com/jaishilautomation-maker/automation/blob/main/app/api/notify/route.ts): `app/api/notify/route.ts`
- [Sheets synchronization](https://github.com/jaishilautomation-maker/automation/blob/main/lib/notifications/sheets-sync.ts): `lib/notifications/sheets-sync.ts`
- **Email service**
- **Google Sheets**
- [QC exchange sender](https://github.com/jaishilautomation-maker/automation/blob/main/app/api/qc-exchange/send/route.ts): `app/api/qc-exchange/send/route.ts`
- [QC exchange receiver](https://github.com/jaishilautomation-maker/automation/blob/main/app/api/qc-exchange/receive/route.ts): `app/api/qc-exchange/receive/route.ts`
- [Exchange retries](https://github.com/jaishilautomation-maker/automation/blob/main/app/api/qc-exchange/retry-pending/route.ts): `app/api/qc-exchange/retry-pending/route.ts`
- **A-20 system**

### Other components

- **Factory staff**

## Connections

- Factory staff → Authentication: signs in
- Factory staff → Operations dashboard: uses
- Factory staff → Production records: records
- Factory staff → Maintenance: records
- Factory staff → Breakdown records: records
- Factory staff → Packing operations: records
- Factory staff → Production job cards: records
- Factory staff → Stores management: manages
- Factory staff → Pulveriser workflows: operates
- Factory staff → QC workflows: records
- Factory staff → QC records and search: reviews
- Factory staff → QC imports: reviews
- Batch creation API → Supabase: creates batch and QC rows
- Report generation API → Report builder: generates report
- Report builder → Supabase: reads record
- Report builder → Email service: emails report
- User profile API → Supabase: reads profile
- Notification API → Email service: sends email
- Notification API → Sheets synchronization: dispatches sheet sync
- Sheets synchronization → Google Sheets: writes rows
- QC exchange sender → Supabase: writes exchange log
- QC exchange sender → A-20 system: sends signed QC
- A-20 system → QC exchange receiver: posts QC payload
- QC exchange receiver → Supabase: stores imported QC
- Exchange retries → Supabase: reads pending log
- Exchange retries → A-20 system: retries delivery
