# syncrozz/staffattend architecture

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

- Interactive diagram: https://gitdiagram.com/syncrozz/staffattend
- Repository: https://github.com/syncrozz/staffattend

## Overview

StaffAttend is an institutional attendance-management application. Staff sign in, enter an institution, select an open event, and record attendance by scanning or another supported method; operators then manage staff and events and review reports. The graph captures the sampled frontend orchestration, Firebase-backed state and attendance operations, reporting utilities, and the Cloud Functions authorization/invitation layer. Several UI and backend details were not excerpted, so links involving those areas are limited to indexed imports or omitted where ownership is unclear.

Main entry points: [`src/App.tsx`](https://github.com/syncrozz/staffattend/blob/main/src/App.tsx) (App and workflow routing), [`functions/src/index.js`](https://github.com/syncrozz/staffattend/blob/main/functions/src/index.js) (Cloud Function endpoints), [`src/contexts/AuthContext.tsx`](https://github.com/syncrozz/staffattend/blob/main/src/contexts/AuthContext.tsx) (Authentication state), [`src/components/EventManagementView.tsx`](https://github.com/syncrozz/staffattend/blob/main/src/components/EventManagementView.tsx) (Event management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Application workflow"]
  node_app["App and workflow routing<br/>[App.tsx]"]
  node_login["Sign-in<br/>[LoginView.tsx]"]
  node_pending["Pending access"]
  node_dashboard["Dashboard<br/>[DashboardView.tsx]"]
  node_events["Event management"]
  node_scanner["Attendance scanner<br/>[ScannerView.tsx]"]
  node_staff["Staff directory"]
  node_concept["Concept guide"]
end

subgraph group_identity["Identity and institutions"]
  node_auth["Authentication state<br/>[AuthContext.tsx]"]
  node_authidentity["Provider identity rules<br/>[authIdentity.ts]"]
  node_institution["Institution context"]
  node_firebase["Firebase setup<br/>[firebase.ts]"]
  node_departments["Department access rules"]
end

subgraph group_attendance["Attendance operations"]
  node_attendance["Attendance data and scans"]
  node_sound["Scan feedback audio<br/>[soundService.ts]"]
  node_audience["Session audience selection<br/>[sessionAudience.ts]"]
  node_dates["Institution event dates<br/>[eventDate.ts]"]
end

subgraph group_insights["Reporting and utilities"]
  node_reports["Reports<br/>[ReportsView.tsx]"]
  node_matrix["Attendance matrix"]
  node_eventcontext["Event report context<br/>[eventContext.ts]"]
  node_csv["CSV import and export<br/>[csvHelper.ts]"]
end

subgraph group_backend["Cloud Functions"]
  node_functions["Cloud Function endpoints<br/>[index.js]"]
  node_guard["Function authorization<br/>[authGuard.js]"]
  node_invitations["Member invitations"]
  node_adminauth["Institution admin auth"]
  node_sessionlife["Session lifecycle"]
  node_fnaudience["Function audience rules<br/>[sessionAudience.js]"]
  node_fndates["Function date rules<br/>[eventDate.js]"]
  node_fndepartments["Function department rules"]
end

node_user(("Institution user"))
node_firestore[("Cloud Firestore")]

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_pending
node_app -->|"renders"| node_dashboard
node_app -->|"renders"| node_events
node_app -->|"renders"| node_scanner
node_app -->|"renders"| node_staff
node_app -->|"renders"| node_reports
node_app -->|"renders"| node_concept
node_app -->|"reads state"| node_auth
node_app -->|"reads state"| node_institution
node_login -->|"signs in through"| node_auth
node_auth -->|"validates providers"| node_authidentity
node_auth -->|"uses auth services"| node_firebase
node_institution -->|"reads identity"| node_auth
node_institution -->|"reads and writes"| node_firestore
node_firebase -->|"initializes connection"| node_firestore
node_app -->|"processes scans"| node_attendance
node_attendance -->|"reads and writes"| node_firestore
node_scanner -->|"captures attendance"| node_attendance
node_events -->|"selects session audience"| node_audience
node_events -->|"checks department access"| node_departments
node_events -->|"uses event dates"| node_dates
node_reports -->|"builds attendance matrix"| node_matrix
node_reports -->|"uses report context"| node_eventcontext
node_eventcontext -->|"uses matrix data"| node_matrix
node_matrix -->|"filters audience"| node_audience
node_staff -->|"imports and exports"| node_csv
node_functions -->|"uses authorization"| node_guard
node_functions -->|"uses invitations"| node_invitations
node_functions -->|"uses lifecycle logic"| node_sessionlife
node_functions -->|"uses audience rules"| node_fnaudience
node_functions -->|"uses date rules"| node_fndates
node_functions -->|"uses admin auth"| node_adminauth
node_functions -->|"uses department rules"| node_fndepartments
node_adminauth -->|"uses authorization"| node_guard
node_adminauth -->|"uses invitation logic"| node_invitations

click node_app "https://github.com/syncrozz/staffattend/blob/main/src/App.tsx"
click node_login "https://github.com/syncrozz/staffattend/blob/main/src/components/LoginView.tsx"
click node_pending "https://github.com/syncrozz/staffattend/blob/main/src/components/PendingAccessView.tsx"
click node_dashboard "https://github.com/syncrozz/staffattend/blob/main/src/components/DashboardView.tsx"
click node_events "https://github.com/syncrozz/staffattend/blob/main/src/components/EventManagementView.tsx"
click node_scanner "https://github.com/syncrozz/staffattend/blob/main/src/components/ScannerView.tsx"
click node_staff "https://github.com/syncrozz/staffattend/blob/main/src/components/StaffDirectoryView.tsx"
click node_concept "https://github.com/syncrozz/staffattend/blob/main/src/components/ConceptGuideView.tsx"
click node_reports "https://github.com/syncrozz/staffattend/blob/main/src/components/ReportsView.tsx"
click node_auth "https://github.com/syncrozz/staffattend/blob/main/src/contexts/AuthContext.tsx"
click node_authidentity "https://github.com/syncrozz/staffattend/blob/main/src/utils/authIdentity.ts"
click node_institution "https://github.com/syncrozz/staffattend/blob/main/src/contexts/InstitutionContext.tsx"
click node_firebase "https://github.com/syncrozz/staffattend/blob/main/src/services/firebase.ts"
click node_attendance "https://github.com/syncrozz/staffattend/blob/main/src/services/attendanceEngine.ts"
click node_sound "https://github.com/syncrozz/staffattend/blob/main/src/services/soundService.ts"
click node_matrix "https://github.com/syncrozz/staffattend/blob/main/src/utils/attendanceMatrix.ts"
click node_eventcontext "https://github.com/syncrozz/staffattend/blob/main/src/utils/eventContext.ts"
click node_csv "https://github.com/syncrozz/staffattend/blob/main/src/utils/csvHelper.ts"
click node_audience "https://github.com/syncrozz/staffattend/blob/main/src/utils/sessionAudience.ts"
click node_departments "https://github.com/syncrozz/staffattend/blob/main/src/utils/departmentManager.ts"
click node_dates "https://github.com/syncrozz/staffattend/blob/main/src/utils/eventDate.ts"
click node_functions "https://github.com/syncrozz/staffattend/blob/main/functions/src/index.js"
click node_guard "https://github.com/syncrozz/staffattend/blob/main/functions/src/authGuard.js"
click node_invitations "https://github.com/syncrozz/staffattend/blob/main/functions/src/memberInvitations.js"
click node_adminauth "https://github.com/syncrozz/staffattend/blob/main/functions/src/institutionAdminAuth.js"
click node_sessionlife "https://github.com/syncrozz/staffattend/blob/main/functions/src/sessionLifecycle.js"
click node_fnaudience "https://github.com/syncrozz/staffattend/blob/main/functions/src/sessionAudience.js"
click node_fndates "https://github.com/syncrozz/staffattend/blob/main/functions/src/eventDate.js"
click node_fndepartments "https://github.com/syncrozz/staffattend/blob/main/functions/src/departmentManager.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_app,node_login,node_pending,node_dashboard,node_events,node_scanner,node_staff,node_concept,node_user toneBlue
class node_auth,node_authidentity,node_institution,node_firebase,node_departments,node_firestore toneAmber
class node_attendance,node_sound,node_audience,node_dates toneMint
class node_reports,node_matrix,node_eventcontext,node_csv toneRose
class node_functions,node_guard,node_invitations,node_adminauth,node_sessionlife,node_fnaudience,node_fndates,node_fndepartments toneIndigo
```

## Components

### Application workflow

- [App and workflow routing](https://github.com/syncrozz/staffattend/blob/main/src/App.tsx): `src/App.tsx`
- [Sign-in](https://github.com/syncrozz/staffattend/blob/main/src/components/LoginView.tsx): `src/components/LoginView.tsx`
- [Pending access](https://github.com/syncrozz/staffattend/blob/main/src/components/PendingAccessView.tsx): `src/components/PendingAccessView.tsx`
- [Dashboard](https://github.com/syncrozz/staffattend/blob/main/src/components/DashboardView.tsx): `src/components/DashboardView.tsx`
- [Event management](https://github.com/syncrozz/staffattend/blob/main/src/components/EventManagementView.tsx): `src/components/EventManagementView.tsx`
- [Attendance scanner](https://github.com/syncrozz/staffattend/blob/main/src/components/ScannerView.tsx): `src/components/ScannerView.tsx`
- [Staff directory](https://github.com/syncrozz/staffattend/blob/main/src/components/StaffDirectoryView.tsx): `src/components/StaffDirectoryView.tsx`
- [Concept guide](https://github.com/syncrozz/staffattend/blob/main/src/components/ConceptGuideView.tsx): `src/components/ConceptGuideView.tsx`

### Identity and institutions

- [Authentication state](https://github.com/syncrozz/staffattend/blob/main/src/contexts/AuthContext.tsx): `src/contexts/AuthContext.tsx`
- [Provider identity rules](https://github.com/syncrozz/staffattend/blob/main/src/utils/authIdentity.ts): `src/utils/authIdentity.ts`
- [Institution context](https://github.com/syncrozz/staffattend/blob/main/src/contexts/InstitutionContext.tsx): `src/contexts/InstitutionContext.tsx`
- [Firebase setup](https://github.com/syncrozz/staffattend/blob/main/src/services/firebase.ts): `src/services/firebase.ts`
- [Department access rules](https://github.com/syncrozz/staffattend/blob/main/src/utils/departmentManager.ts): `src/utils/departmentManager.ts`

### Attendance operations

- [Attendance data and scans](https://github.com/syncrozz/staffattend/blob/main/src/services/attendanceEngine.ts): `src/services/attendanceEngine.ts`
- [Scan feedback audio](https://github.com/syncrozz/staffattend/blob/main/src/services/soundService.ts): `src/services/soundService.ts`
- [Session audience selection](https://github.com/syncrozz/staffattend/blob/main/src/utils/sessionAudience.ts): `src/utils/sessionAudience.ts`
- [Institution event dates](https://github.com/syncrozz/staffattend/blob/main/src/utils/eventDate.ts): `src/utils/eventDate.ts`

### Reporting and utilities

- [Reports](https://github.com/syncrozz/staffattend/blob/main/src/components/ReportsView.tsx): `src/components/ReportsView.tsx`
- [Attendance matrix](https://github.com/syncrozz/staffattend/blob/main/src/utils/attendanceMatrix.ts): `src/utils/attendanceMatrix.ts`
- [Event report context](https://github.com/syncrozz/staffattend/blob/main/src/utils/eventContext.ts): `src/utils/eventContext.ts`
- [CSV import and export](https://github.com/syncrozz/staffattend/blob/main/src/utils/csvHelper.ts): `src/utils/csvHelper.ts`

### Cloud Functions

- [Cloud Function endpoints](https://github.com/syncrozz/staffattend/blob/main/functions/src/index.js): `functions/src/index.js`
- [Function authorization](https://github.com/syncrozz/staffattend/blob/main/functions/src/authGuard.js): `functions/src/authGuard.js`
- [Member invitations](https://github.com/syncrozz/staffattend/blob/main/functions/src/memberInvitations.js): `functions/src/memberInvitations.js`
- [Institution admin auth](https://github.com/syncrozz/staffattend/blob/main/functions/src/institutionAdminAuth.js): `functions/src/institutionAdminAuth.js`
- [Session lifecycle](https://github.com/syncrozz/staffattend/blob/main/functions/src/sessionLifecycle.js): `functions/src/sessionLifecycle.js`
- [Function audience rules](https://github.com/syncrozz/staffattend/blob/main/functions/src/sessionAudience.js): `functions/src/sessionAudience.js`
- [Function date rules](https://github.com/syncrozz/staffattend/blob/main/functions/src/eventDate.js): `functions/src/eventDate.js`
- [Function department rules](https://github.com/syncrozz/staffattend/blob/main/functions/src/departmentManager.js): `functions/src/departmentManager.js`

### Other components

- **Institution user**
- **Cloud Firestore**

## Connections

- Institution user → App and workflow routing: uses (evidence: `src/App.tsx`)
- App and workflow routing → Sign-in: routes to (evidence: `src/App.tsx`)
- App and workflow routing → Pending access: routes to (evidence: `src/App.tsx`)
- App and workflow routing → Dashboard: renders (evidence: `src/App.tsx`)
- App and workflow routing → Event management: renders (evidence: `src/App.tsx`)
- App and workflow routing → Attendance scanner: renders (evidence: `src/App.tsx`)
- App and workflow routing → Staff directory: renders (evidence: `src/App.tsx`)
- App and workflow routing → Reports: renders (evidence: `src/App.tsx`)
- App and workflow routing → Concept guide: renders (evidence: `src/App.tsx`)
- App and workflow routing → Authentication state: reads state (evidence: `src/App.tsx`)
- App and workflow routing → Institution context: reads state (evidence: `src/App.tsx`)
- Sign-in → Authentication state: signs in through (evidence: `src/components/LoginView.tsx`)
- Authentication state → Provider identity rules: validates providers (evidence: `src/contexts/AuthContext.tsx`)
- Authentication state → Firebase setup: uses auth services (evidence: `src/contexts/AuthContext.tsx`)
- Institution context → Authentication state: reads identity (evidence: `src/contexts/InstitutionContext.tsx`)
- Institution context → Cloud Firestore: reads and writes (evidence: `src/contexts/InstitutionContext.tsx`)
- Firebase setup → Cloud Firestore: initializes connection (evidence: `src/services/firebase.ts`)
- App and workflow routing → Attendance data and scans: processes scans (evidence: `src/App.tsx`)
- Attendance data and scans → Cloud Firestore: reads and writes (evidence: `src/services/attendanceEngine.ts`)
- Attendance scanner → Attendance data and scans: captures attendance (evidence: `src/App.tsx`)
- Event management → Session audience selection: selects session audience (evidence: `src/components/EventManagementView.tsx`)
- Event management → Department access rules: checks department access (evidence: `src/components/EventManagementView.tsx`)
- Event management → Institution event dates: uses event dates (evidence: `src/components/EventManagementView.tsx`)
- Reports → Attendance matrix: builds attendance matrix (evidence: `src/components/ReportsView.tsx`)
- Reports → Event report context: uses report context (evidence: `src/components/ReportsView.tsx`)
- Event report context → Attendance matrix: uses matrix data (evidence: `src/utils/eventContext.ts`)
- Attendance matrix → Session audience selection: filters audience (evidence: `src/utils/attendanceMatrix.ts`)
- Staff directory → CSV import and export: imports and exports (evidence: `src/components/StaffDirectoryView.tsx`)
- Cloud Function endpoints → Function authorization: uses authorization (evidence: `functions/src/index.js`)
- Cloud Function endpoints → Member invitations: uses invitations (evidence: `functions/src/index.js`)
- Cloud Function endpoints → Session lifecycle: uses lifecycle logic (evidence: `functions/src/index.js`)
- Cloud Function endpoints → Function audience rules: uses audience rules (evidence: `functions/src/index.js`)
- Cloud Function endpoints → Function date rules: uses date rules (evidence: `functions/src/index.js`)
- Cloud Function endpoints → Institution admin auth: uses admin auth (evidence: `functions/src/index.js`)
- Cloud Function endpoints → Function department rules: uses department rules (evidence: `functions/src/index.js`)
- Institution admin auth → Function authorization: uses authorization (evidence: `functions/src/institutionAdminAuth.js`)
- Institution admin auth → Member invitations: uses invitation logic (evidence: `functions/src/institutionAdminAuth.js`)
