# gma7postmams/opstracker architecture

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

- Interactive diagram: https://gitdiagram.com/gma7postmams/opstracker
- Repository: https://github.com/gma7postmams/opstracker

## Overview

MAMS Support Operations Tracker is a web application for recording Technical Assistance and Other Tasks, then reviewing work through dashboards and reports. Users sign in and work with typed records; administrators also manage users, master data, branding, imports, and backups. The map emphasizes documented product capabilities and sampled route behavior. Some page-to-endpoint wiring and unsampled feature internals are not shown because their implementation was not inspected.

Main entry points: [`app/(app)/admin/page.tsx`](https://github.com/gma7postmams/opstracker/blob/main/app/(app)/admin/page.tsx) (Admin Page), [`app/api/import/route.ts`](https://github.com/gma7postmams/opstracker/blob/main/app/api/import/route.ts) (Import API), [`app/api/records/[type]/route.ts`](https://github.com/gma7postmams/opstracker/blob/main/app/api/records/%5Btype%5D/route.ts) (Record Collection API), [`app/api/records/[type]/[id]/route.ts`](https://github.com/gma7postmams/opstracker/blob/main/app/api/records/%5Btype%5D/%5Bid%5D/route.ts) (Record Item API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_work["Daily Work"]
  node_login["Sign In<br/>[page.tsx]"]
  node_assistance["Assistance Page<br/>[page.tsx]"]
  node_tasks["Tasks Page<br/>[page.tsx]"]
  node_records_view["Records View<br/>[RecordsView.tsx]"]
  node_record_detail["Record Detail<br/>[page.tsx]"]
end

subgraph group_records["Record Services"]
  node_record_list_api["Record Collection API<br/>[route.ts]"]
  node_record_item_api["Record Item API<br/>[route.ts]"]
  node_record_service["Record Service<br/>[records.ts]"]
  node_validation["Validation Rules<br/>[validation.ts]"]
  node_record_types["Record Type Config<br/>[recordTypes.ts]"]
end

subgraph group_insights["Insights"]
  node_dashboard["Dashboard<br/>[page.tsx]"]
  node_dashboard_api["Dashboard API<br/>[route.ts]"]
  node_reports_page["Reports Page<br/>[page.tsx]"]
  node_reports_api["Reports API<br/>[route.ts]"]
end

subgraph group_admin["Administration"]
  node_admin_page["Admin Page<br/>[page.tsx]"]
  node_users_api["User Management API<br/>[route.ts]"]
  node_user_item_api["User Profile API<br/>[route.ts]"]
  node_masterdata_api["Master Data API<br/>[route.ts]"]
  node_import_api["Import API<br/>[route.ts]"]
  node_csv_parser["CSV Parser<br/>[csv.ts]"]
  node_xlsx_parser["Workbook Reader<br/>[xlsx.ts]"]
  node_backup_api["Backup Restore API<br/>[route.ts]"]
  node_branding_api["Branding API<br/>[route.ts]"]
end

subgraph group_platform["Platform Services"]
  node_branding_service["Branding Service<br/>[branding.ts]"]
  node_upload_api["Image Upload API<br/>[route.ts]"]
  node_auth_service["Authentication<br/>[auth.ts]"]
end

node_user(("User"))
node_database[("PostgreSQL")]
node_uploads["Uploaded Assets"]

node_user -->|"opens"| node_login
node_user -->|"logs work"| node_assistance
node_user -->|"logs work"| node_tasks
node_assistance -->|"displays"| node_records_view
node_tasks -->|"displays"| node_records_view
node_records_view -->|"requests records"| node_record_list_api
node_record_detail -->|"loads record"| node_record_item_api
node_record_list_api -->|"lists or creates"| node_record_service
node_record_list_api -->|"validates input"| node_validation
node_record_list_api -->|"reads and writes"| node_database
node_record_item_api -->|"loads record"| node_record_service
node_record_item_api -->|"validates edits"| node_validation
node_record_item_api -->|"updates record"| node_database
node_record_service -->|"queries records"| node_database
node_record_list_api -->|"checks type"| node_record_types
node_record_item_api -->|"checks type"| node_record_types
node_user -->|"reviews activity"| node_dashboard
node_dashboard -->|"requests summary"| node_dashboard_api
node_dashboard_api -->|"aggregates records"| node_database
node_user -->|"views reports"| node_reports_page
node_reports_page -->|"requests tallies"| node_reports_api
node_reports_api -->|"reads records"| node_database
node_user -->|"administers system"| node_admin_page
node_admin_page -->|"manages users"| node_users_api
node_users_api -->|"validates users"| node_validation
node_users_api -->|"reads and writes"| node_database
node_admin_page -->|"edits profiles"| node_user_item_api
node_user_item_api -->|"validates edits"| node_validation
node_user_item_api -->|"updates users"| node_database
node_admin_page -->|"manages options"| node_masterdata_api
node_masterdata_api -->|"reads and writes"| node_database
node_admin_page -->|"imports records"| node_import_api
node_import_api -->|"parses CSV"| node_csv_parser
node_import_api -->|"parses workbook"| node_xlsx_parser
node_import_api -->|"validates rows"| node_validation
node_import_api -->|"allocates references"| node_record_service
node_import_api -->|"imports records"| node_database
node_admin_page -->|"backs up or restores"| node_backup_api
node_backup_api -->|"exports or restores"| node_database
node_admin_page -->|"configures branding"| node_branding_api
node_branding_api -->|"loads defaults"| node_branding_service
node_branding_api -->|"reads and writes"| node_database
node_admin_page -->|"uploads assets"| node_upload_api
node_upload_api -->|"writes image"| node_uploads
node_login -->|"authenticates"| node_auth_service

click node_login "https://github.com/gma7postmams/opstracker/blob/main/app/login/page.tsx"
click node_dashboard "https://github.com/gma7postmams/opstracker/blob/main/app/(app)/dashboard/page.tsx"
click node_assistance "https://github.com/gma7postmams/opstracker/blob/main/app/(app)/assistance/page.tsx"
click node_tasks "https://github.com/gma7postmams/opstracker/blob/main/app/(app)/tasks/page.tsx"
click node_records_view "https://github.com/gma7postmams/opstracker/blob/main/components/RecordsView.tsx"
click node_record_detail "https://github.com/gma7postmams/opstracker/blob/main/app/(app)/records/%5Btype%5D/%5Bid%5D/page.tsx"
click node_record_list_api "https://github.com/gma7postmams/opstracker/blob/main/app/api/records/%5Btype%5D/route.ts"
click node_record_item_api "https://github.com/gma7postmams/opstracker/blob/main/app/api/records/%5Btype%5D/%5Bid%5D/route.ts"
click node_record_service "https://github.com/gma7postmams/opstracker/blob/main/lib/records.ts"
click node_validation "https://github.com/gma7postmams/opstracker/blob/main/lib/validation.ts"
click node_record_types "https://github.com/gma7postmams/opstracker/blob/main/lib/recordTypes.ts"
click node_dashboard_api "https://github.com/gma7postmams/opstracker/blob/main/app/api/dashboard/route.ts"
click node_reports_page "https://github.com/gma7postmams/opstracker/blob/main/app/(app)/reports/page.tsx"
click node_reports_api "https://github.com/gma7postmams/opstracker/blob/main/app/api/reports/route.ts"
click node_admin_page "https://github.com/gma7postmams/opstracker/blob/main/app/(app)/admin/page.tsx"
click node_users_api "https://github.com/gma7postmams/opstracker/blob/main/app/api/users/route.ts"
click node_user_item_api "https://github.com/gma7postmams/opstracker/blob/main/app/api/users/%5Bid%5D/route.ts"
click node_masterdata_api "https://github.com/gma7postmams/opstracker/blob/main/app/api/masterdata/route.ts"
click node_import_api "https://github.com/gma7postmams/opstracker/blob/main/app/api/import/route.ts"
click node_csv_parser "https://github.com/gma7postmams/opstracker/blob/main/lib/csv.ts"
click node_xlsx_parser "https://github.com/gma7postmams/opstracker/blob/main/lib/xlsx.ts"
click node_backup_api "https://github.com/gma7postmams/opstracker/blob/main/app/api/backup/route.ts"
click node_branding_api "https://github.com/gma7postmams/opstracker/blob/main/app/api/branding/route.ts"
click node_branding_service "https://github.com/gma7postmams/opstracker/blob/main/lib/branding.ts"
click node_upload_api "https://github.com/gma7postmams/opstracker/blob/main/app/api/upload/route.ts"
click node_auth_service "https://github.com/gma7postmams/opstracker/blob/main/lib/auth.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_login,node_assistance,node_tasks,node_records_view,node_record_detail,node_user toneBlue
class node_record_list_api,node_record_item_api,node_record_service,node_validation,node_record_types,node_database toneAmber
class node_dashboard,node_dashboard_api,node_reports_page,node_reports_api toneMint
class node_admin_page,node_users_api,node_user_item_api,node_masterdata_api,node_import_api,node_csv_parser,node_xlsx_parser,node_backup_api,node_branding_api toneRose
class node_branding_service,node_upload_api,node_auth_service,node_uploads toneIndigo
```

## Components

### Daily Work

- [Sign In](https://github.com/gma7postmams/opstracker/blob/main/app/login/page.tsx): `app/login/page.tsx`
- [Assistance Page](https://github.com/gma7postmams/opstracker/blob/main/app/(app)/assistance/page.tsx): `app/(app)/assistance/page.tsx`
- [Tasks Page](https://github.com/gma7postmams/opstracker/blob/main/app/(app)/tasks/page.tsx): `app/(app)/tasks/page.tsx`
- [Records View](https://github.com/gma7postmams/opstracker/blob/main/components/RecordsView.tsx): `components/RecordsView.tsx`
- [Record Detail](https://github.com/gma7postmams/opstracker/blob/main/app/(app)/records/%5Btype%5D/%5Bid%5D/page.tsx): `app/(app)/records/[type]/[id]/page.tsx`

### Record Services

- [Record Collection API](https://github.com/gma7postmams/opstracker/blob/main/app/api/records/%5Btype%5D/route.ts): `app/api/records/[type]/route.ts`
- [Record Item API](https://github.com/gma7postmams/opstracker/blob/main/app/api/records/%5Btype%5D/%5Bid%5D/route.ts): `app/api/records/[type]/[id]/route.ts`
- [Record Service](https://github.com/gma7postmams/opstracker/blob/main/lib/records.ts): `lib/records.ts`
- [Validation Rules](https://github.com/gma7postmams/opstracker/blob/main/lib/validation.ts): `lib/validation.ts`
- [Record Type Config](https://github.com/gma7postmams/opstracker/blob/main/lib/recordTypes.ts): `lib/recordTypes.ts`

### Insights

- [Dashboard](https://github.com/gma7postmams/opstracker/blob/main/app/(app)/dashboard/page.tsx): `app/(app)/dashboard/page.tsx`
- [Dashboard API](https://github.com/gma7postmams/opstracker/blob/main/app/api/dashboard/route.ts): `app/api/dashboard/route.ts`
- [Reports Page](https://github.com/gma7postmams/opstracker/blob/main/app/(app)/reports/page.tsx): `app/(app)/reports/page.tsx`
- [Reports API](https://github.com/gma7postmams/opstracker/blob/main/app/api/reports/route.ts): `app/api/reports/route.ts`

### Administration

- [Admin Page](https://github.com/gma7postmams/opstracker/blob/main/app/(app)/admin/page.tsx): `app/(app)/admin/page.tsx`
- [User Management API](https://github.com/gma7postmams/opstracker/blob/main/app/api/users/route.ts): `app/api/users/route.ts`
- [User Profile API](https://github.com/gma7postmams/opstracker/blob/main/app/api/users/%5Bid%5D/route.ts): `app/api/users/[id]/route.ts`
- [Master Data API](https://github.com/gma7postmams/opstracker/blob/main/app/api/masterdata/route.ts): `app/api/masterdata/route.ts`
- [Import API](https://github.com/gma7postmams/opstracker/blob/main/app/api/import/route.ts): `app/api/import/route.ts`
- [CSV Parser](https://github.com/gma7postmams/opstracker/blob/main/lib/csv.ts): `lib/csv.ts`
- [Workbook Reader](https://github.com/gma7postmams/opstracker/blob/main/lib/xlsx.ts): `lib/xlsx.ts`
- [Backup Restore API](https://github.com/gma7postmams/opstracker/blob/main/app/api/backup/route.ts): `app/api/backup/route.ts`
- [Branding API](https://github.com/gma7postmams/opstracker/blob/main/app/api/branding/route.ts): `app/api/branding/route.ts`

### Platform Services

- [Branding Service](https://github.com/gma7postmams/opstracker/blob/main/lib/branding.ts): `lib/branding.ts`
- [Image Upload API](https://github.com/gma7postmams/opstracker/blob/main/app/api/upload/route.ts): `app/api/upload/route.ts`
- [Authentication](https://github.com/gma7postmams/opstracker/blob/main/lib/auth.ts): `lib/auth.ts`

### Other components

- **User**
- **PostgreSQL**
- **Uploaded Assets**

## Connections

- User → Sign In: opens
- User → Assistance Page: logs work
- User → Tasks Page: logs work
- Assistance Page → Records View: displays
- Tasks Page → Records View: displays
- Records View → Record Collection API: requests records
- Record Detail → Record Item API: loads record
- Record Collection API → Record Service: lists or creates
- Record Collection API → Validation Rules: validates input
- Record Collection API → PostgreSQL: reads and writes
- Record Item API → Record Service: loads record
- Record Item API → Validation Rules: validates edits
- Record Item API → PostgreSQL: updates record
- Record Service → PostgreSQL: queries records
- Record Collection API → Record Type Config: checks type
- Record Item API → Record Type Config: checks type
- User → Dashboard: reviews activity
- Dashboard → Dashboard API: requests summary
- Dashboard API → PostgreSQL: aggregates records
- User → Reports Page: views reports
- Reports Page → Reports API: requests tallies
- Reports API → PostgreSQL: reads records
- User → Admin Page: administers system
- Admin Page → User Management API: manages users
- User Management API → Validation Rules: validates users
- User Management API → PostgreSQL: reads and writes
- Admin Page → User Profile API: edits profiles
- User Profile API → Validation Rules: validates edits
- User Profile API → PostgreSQL: updates users
- Admin Page → Master Data API: manages options
- Master Data API → PostgreSQL: reads and writes
- Admin Page → Import API: imports records
- Import API → CSV Parser: parses CSV
- Import API → Workbook Reader: parses workbook
- Import API → Validation Rules: validates rows
- Import API → Record Service: allocates references
- Import API → PostgreSQL: imports records
- Admin Page → Backup Restore API: backs up or restores
- Backup Restore API → PostgreSQL: exports or restores
- Admin Page → Branding API: configures branding
- Branding API → Branding Service: loads defaults
- Branding API → PostgreSQL: reads and writes
- Admin Page → Image Upload API: uploads assets
- Image Upload API → Uploaded Assets: writes image
- Sign In → Authentication: authenticates
