# yugraj20/selfattendancee architecture

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

- Interactive diagram: https://gitdiagram.com/yugraj20/selfattendancee
- Repository: https://github.com/yugraj20/selfattendancee

## Overview

Self Attendance is a local-first attendance tracker: users manage subjects and a timetable, record class outcomes, and review attendance calculations and history. The React app is the main coordinator; IndexedDB is the local source of truth, with optional Google sign-in and Firestore mirroring. It also supports AI-assisted timetable and text imports, validated backup/restore, and Excel export. The README documents these product flows; some UI wiring is unsampled, so the graph omits uncertain component-level calls.

Main entry points: [`src/App.tsx`](https://github.com/yugraj20/selfattendancee/blob/main/src/App.tsx) (App coordinator), [`src/sync.ts`](https://github.com/yugraj20/selfattendancee/blob/main/src/sync.ts) (Cloud sync), [`src/math.ts`](https://github.com/yugraj20/selfattendancee/blob/main/src/math.ts) (Attendance calculations), [`src/main.tsx`](https://github.com/yugraj20/selfattendancee/blob/main/src/main.tsx) (React entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App and attendance"]
  node_entry["React entry<br/>[main.tsx]"]
  node_app["App coordinator<br/>[App.tsx]"]
  node_navigation["Floating navigation<br/>[FloatingNav.tsx]"]
  node_quickmark["Quick marking<br/>[QuickMarkModal.tsx]"]
  node_subjects["Subject management<br/>[SubjectsPage.tsx]"]
  node_monthly["Monthly attendance"]
end

subgraph group_domain["Attendance domain"]
  node_math["Attendance calculations<br/>[math.ts]"]
end

subgraph group_storage["Persistence and sync"]
  node_localdb[("IndexedDB store<br/>[db.ts]")]
  node_firebase["Firebase auth setup<br/>[firebase.ts]"]
  node_sync["Cloud sync<br/>[sync.ts]"]
end

subgraph group_tools["Import and export"]
  node_timetableai["Timetable AI import<br/>[gemini.ts]"]
  node_attendanceai["Attendance text import"]
  node_backup["Backup and restore<br/>[backup.ts]"]
  node_excelmodal["Excel export UI"]
  node_excel["Excel generation<br/>[excel-export.ts]"]
end

node_student(("Student"))
node_firestore[("Firestore")]
node_geminiservice["Gemini API"]

node_student -->|"opens app"| node_entry
node_entry -->|"renders"| node_app
node_student -->|"tracks attendance"| node_app
node_app -->|"reads and writes"| node_localdb
node_app -->|"coordinates sync"| node_sync
node_app -->|"signs in"| node_firebase
node_sync -->|"reads local data"| node_localdb
node_sync -->|"mirrors data"| node_firestore
node_firebase -->|"configures access"| node_firestore
node_app -->|"calculates attendance"| node_math
node_subjects -->|"calculates subject stats"| node_math
node_quickmark -->|"uses date helper"| node_math
node_app -->|"imports timetable"| node_timetableai
node_app -->|"imports attendance"| node_attendanceai
node_timetableai -->|"sends timetable file"| node_geminiservice
node_attendanceai -->|"sends text for parsing"| node_geminiservice
node_app -->|"backs up and restores"| node_backup
node_app -->|"offers export"| node_excelmodal
node_excelmodal -->|"generates workbook"| node_excel

click node_entry "https://github.com/yugraj20/selfattendancee/blob/main/src/main.tsx"
click node_app "https://github.com/yugraj20/selfattendancee/blob/main/src/App.tsx"
click node_navigation "https://github.com/yugraj20/selfattendancee/blob/main/src/components/FloatingNav.tsx"
click node_quickmark "https://github.com/yugraj20/selfattendancee/blob/main/src/components/QuickMarkModal.tsx"
click node_subjects "https://github.com/yugraj20/selfattendancee/blob/main/src/components/SubjectsPage.tsx"
click node_monthly "https://github.com/yugraj20/selfattendancee/blob/main/src/components/MonthlyAttendance.tsx"
click node_math "https://github.com/yugraj20/selfattendancee/blob/main/src/math.ts"
click node_localdb "https://github.com/yugraj20/selfattendancee/blob/main/src/db.ts"
click node_firebase "https://github.com/yugraj20/selfattendancee/blob/main/src/firebase.ts"
click node_sync "https://github.com/yugraj20/selfattendancee/blob/main/src/sync.ts"
click node_timetableai "https://github.com/yugraj20/selfattendancee/blob/main/src/gemini.ts"
click node_attendanceai "https://github.com/yugraj20/selfattendancee/blob/main/src/attendance-import.ts"
click node_backup "https://github.com/yugraj20/selfattendancee/blob/main/src/backup.ts"
click node_excelmodal "https://github.com/yugraj20/selfattendancee/blob/main/src/components/ExcelExportModal.tsx"
click node_excel "https://github.com/yugraj20/selfattendancee/blob/main/src/excel-export.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_entry,node_app,node_navigation,node_quickmark,node_subjects,node_monthly toneBlue
class node_math,node_firestore toneAmber
class node_localdb,node_firebase,node_sync,node_geminiservice toneMint
class node_timetableai,node_attendanceai,node_backup,node_excelmodal,node_excel toneRose
class node_student toneIndigo
```

## Components

### App and attendance

- [React entry](https://github.com/yugraj20/selfattendancee/blob/main/src/main.tsx): `src/main.tsx`
- [App coordinator](https://github.com/yugraj20/selfattendancee/blob/main/src/App.tsx): `src/App.tsx`
- [Floating navigation](https://github.com/yugraj20/selfattendancee/blob/main/src/components/FloatingNav.tsx): `src/components/FloatingNav.tsx`
- [Quick marking](https://github.com/yugraj20/selfattendancee/blob/main/src/components/QuickMarkModal.tsx): `src/components/QuickMarkModal.tsx`
- [Subject management](https://github.com/yugraj20/selfattendancee/blob/main/src/components/SubjectsPage.tsx): `src/components/SubjectsPage.tsx`
- [Monthly attendance](https://github.com/yugraj20/selfattendancee/blob/main/src/components/MonthlyAttendance.tsx): `src/components/MonthlyAttendance.tsx`

### Attendance domain

- [Attendance calculations](https://github.com/yugraj20/selfattendancee/blob/main/src/math.ts): `src/math.ts`

### Persistence and sync

- [IndexedDB store](https://github.com/yugraj20/selfattendancee/blob/main/src/db.ts): `src/db.ts`
- [Firebase auth setup](https://github.com/yugraj20/selfattendancee/blob/main/src/firebase.ts): `src/firebase.ts`
- [Cloud sync](https://github.com/yugraj20/selfattendancee/blob/main/src/sync.ts): `src/sync.ts`

### Import and export

- [Timetable AI import](https://github.com/yugraj20/selfattendancee/blob/main/src/gemini.ts): `src/gemini.ts`
- [Attendance text import](https://github.com/yugraj20/selfattendancee/blob/main/src/attendance-import.ts): `src/attendance-import.ts`
- [Backup and restore](https://github.com/yugraj20/selfattendancee/blob/main/src/backup.ts): `src/backup.ts`
- [Excel export UI](https://github.com/yugraj20/selfattendancee/blob/main/src/components/ExcelExportModal.tsx): `src/components/ExcelExportModal.tsx`
- [Excel generation](https://github.com/yugraj20/selfattendancee/blob/main/src/excel-export.ts): `src/excel-export.ts`

### Other components

- **Student**
- **Firestore**
- **Gemini API**

## Connections

- Student → React entry: opens app (evidence: `README.md`)
- React entry → App coordinator: renders (evidence: `src/main.tsx`)
- Student → App coordinator: tracks attendance (evidence: `README.md`)
- App coordinator → IndexedDB store: reads and writes (evidence: `README.md`)
- App coordinator → Cloud sync: coordinates sync (evidence: `README.md`)
- App coordinator → Firebase auth setup: signs in (evidence: `README.md`)
- Cloud sync → IndexedDB store: reads local data (evidence: `src/sync.ts`)
- Cloud sync → Firestore: mirrors data (evidence: `src/sync.ts`)
- Firebase auth setup → Firestore: configures access (evidence: `src/firebase.ts`)
- App coordinator → Attendance calculations: calculates attendance (evidence: `src/App.tsx`)
- Subject management → Attendance calculations: calculates subject stats (evidence: `src/components/SubjectsPage.tsx`)
- Quick marking → Attendance calculations: uses date helper (evidence: `src/components/QuickMarkModal.tsx`)
- App coordinator → Timetable AI import: imports timetable (evidence: `README.md`)
- App coordinator → Attendance text import: imports attendance (evidence: `README.md`)
- Timetable AI import → Gemini API: sends timetable file (evidence: `src/gemini.ts`)
- Attendance text import → Gemini API: sends text for parsing
- App coordinator → Backup and restore: backs up and restores (evidence: `README.md`)
- App coordinator → Excel export UI: offers export (evidence: `src/App.tsx`)
- Excel export UI → Excel generation: generates workbook (evidence: `src/components/ExcelExportModal.tsx`)
