# aayushteotia-hub/sama architecture

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

- Interactive diagram: https://gitdiagram.com/aayushteotia-hub/sama
- Repository: https://github.com/aayushteotia-hub/sama

## Overview

This is a role-based campus management application for students, teachers, and administrators. Users enter through authentication, then App.tsx selects role-specific screens for attendance, academics, communication, and administration. Attendance is a distinct workflow: students scan or identify themselves, face recognition evaluates input, and teachers review attendance requests. Administration also covers campus records, timetables, face registration, reports, and settings. The app uses a centralized storage service and seeded data. Several screens are documented by the source index but their internal behavior was not sampled, so their links are limited to evidenced routing or explicitly marked unverified.

Main entry points: [`src/App.tsx`](https://github.com/aayushteotia-hub/sama/blob/main/src/App.tsx) (Role-based app), [`src/services/storage.ts`](https://github.com/aayushteotia-hub/sama/blob/main/src/services/storage.ts) (Application storage), [`src/components/auth/LoginPage.tsx`](https://github.com/aayushteotia-hub/sama/blob/main/src/components/auth/LoginPage.tsx) (Authentication), [`src/services/faceRecognition.ts`](https://github.com/aayushteotia-hub/sama/blob/main/src/services/faceRecognition.ts) (Face recognition)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Application entry"]
  node_app["Role-based app<br/>[App.tsx]"]
  node_login["Authentication<br/>[LoginPage.tsx]"]
  node_navigation["Role navigation<br/>[SidebarDrawer.tsx]"]
end

subgraph group_attendance["Attendance workflow"]
  node_student_attendance["Student attendance"]
  node_face_scanner["Attendance scanner"]
  node_face_engine["Face recognition<br/>[faceRecognition.ts]"]
  node_teacher_dashboard["Teacher dashboard"]
  node_admin_face["Face registration"]
end

subgraph group_campus["Campus operations"]
  node_student_home["Student portal<br/>[StudentHome.tsx]"]
  node_student_timetable["Student timetable"]
  node_student_profile["Student profile<br/>[StudentProfile.tsx]"]
  node_student_fees["Student fees<br/>[StudentFees.tsx]"]
  node_student_syllabus["Student syllabus"]
  node_student_management["Student records"]
  node_academic_admin["Academic setup"]
  node_timetable_admin["Timetable setup"]
  node_admin_dashboard["Admin dashboard<br/>[AdminDashboard.tsx]"]
  node_common_features["Campus services<br/>[ChatGroupsView.tsx]"]
  node_complaints["Complaints"]
  node_help_requests["Help requests"]
  node_marks_grades["Marks and grades"]
end

subgraph group_shared["Shared services"]
  node_storage[("Application storage<br/>[storage.ts]")]
  node_seed_data["Seed records<br/>[mockData.ts]"]
  node_types["Domain types<br/>[types.ts]"]
end

node_users(("Campus users"))

node_users -.->|"use app"| node_app
node_app -.->|"renders navigation"| node_navigation
node_app -->|"routes attendance"| node_student_attendance
node_app -->|"routes grades"| node_marks_grades
node_app -->|"routes chat"| node_common_features
node_app -->|"routes dashboard"| node_admin_dashboard
node_app -->|"routes students"| node_student_management
node_app -->|"routes academics"| node_academic_admin
node_app -.->|"selects login"| node_login
node_app -.->|"opens scanner"| node_face_scanner
node_app -.->|"routes teacher"| node_teacher_dashboard
node_app -.->|"routes student"| node_student_home
node_app -.->|"routes timetable"| node_student_timetable
node_app -.->|"routes profile"| node_student_profile
node_app -.->|"routes fees"| node_student_fees
node_app -.->|"routes syllabus"| node_student_syllabus
node_app -.->|"routes timetable"| node_timetable_admin
node_app -.->|"opens registration"| node_admin_face
node_app -.->|"routes complaints"| node_complaints
node_app -.->|"routes requests"| node_help_requests
node_login -->|"loads users"| node_storage
node_login -.->|"recognizes faces"| node_face_engine
node_face_scanner -.->|"checks faces"| node_face_engine
node_admin_face -->|"uses recognition"| node_face_engine
node_teacher_dashboard -->|"reads attendance"| node_storage
node_student_management -->|"saves students"| node_storage
node_academic_admin -->|"manages records"| node_storage
node_student_attendance -.->|"records attendance"| node_storage
node_marks_grades -.->|"manages grades"| node_storage
node_common_features -.->|"manages messages"| node_storage
node_complaints -.->|"manages complaints"| node_storage
node_help_requests -.->|"manages requests"| node_storage
node_admin_dashboard -->|"loads summaries"| node_storage
node_timetable_admin -->|"manages schedule"| node_storage
node_student_timetable -.->|"reads schedule"| node_storage
node_student_profile -.->|"reads profile"| node_storage
node_storage -->|"loads seed data"| node_seed_data
node_app -->|"loads app state"| node_storage

click node_app "https://github.com/aayushteotia-hub/sama/blob/main/src/App.tsx"
click node_login "https://github.com/aayushteotia-hub/sama/blob/main/src/components/auth/LoginPage.tsx"
click node_navigation "https://github.com/aayushteotia-hub/sama/blob/main/src/components/layout/SidebarDrawer.tsx"
click node_student_attendance "https://github.com/aayushteotia-hub/sama/blob/main/src/components/common/DualAttendanceView.tsx"
click node_face_scanner "https://github.com/aayushteotia-hub/sama/blob/main/src/components/student/FaceScannerModal.tsx"
click node_face_engine "https://github.com/aayushteotia-hub/sama/blob/main/src/services/faceRecognition.ts"
click node_teacher_dashboard "https://github.com/aayushteotia-hub/sama/blob/main/src/components/teacher/TeacherDashboard.tsx"
click node_admin_face "https://github.com/aayushteotia-hub/sama/blob/main/src/components/admin/FaceRegistrationStudio.tsx"
click node_student_home "https://github.com/aayushteotia-hub/sama/blob/main/src/components/student/StudentHome.tsx"
click node_student_timetable "https://github.com/aayushteotia-hub/sama/blob/main/src/components/student/StudentTimetable.tsx"
click node_student_profile "https://github.com/aayushteotia-hub/sama/blob/main/src/components/student/StudentProfile.tsx"
click node_student_fees "https://github.com/aayushteotia-hub/sama/blob/main/src/components/student/StudentFees.tsx"
click node_student_syllabus "https://github.com/aayushteotia-hub/sama/blob/main/src/components/student/StudentSyllabus.tsx"
click node_student_management "https://github.com/aayushteotia-hub/sama/blob/main/src/components/admin/StudentManagement.tsx"
click node_academic_admin "https://github.com/aayushteotia-hub/sama/blob/main/src/components/admin/AcademicsManagement.tsx"
click node_timetable_admin "https://github.com/aayushteotia-hub/sama/blob/main/src/components/admin/TimetableManagement.tsx"
click node_admin_dashboard "https://github.com/aayushteotia-hub/sama/blob/main/src/components/admin/AdminDashboard.tsx"
click node_common_features "https://github.com/aayushteotia-hub/sama/blob/main/src/components/common/ChatGroupsView.tsx"
click node_complaints "https://github.com/aayushteotia-hub/sama/blob/main/src/components/common/ComplaintsManagement.tsx"
click node_help_requests "https://github.com/aayushteotia-hub/sama/blob/main/src/components/common/HelpRequestsView.tsx"
click node_marks_grades "https://github.com/aayushteotia-hub/sama/blob/main/src/components/common/MarksGradesView.tsx"
click node_storage "https://github.com/aayushteotia-hub/sama/blob/main/src/services/storage.ts"
click node_seed_data "https://github.com/aayushteotia-hub/sama/blob/main/src/services/mockData.ts"
click node_types "https://github.com/aayushteotia-hub/sama/blob/main/src/types.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_app,node_login,node_navigation,node_users toneBlue
class node_student_attendance,node_face_scanner,node_face_engine,node_teacher_dashboard,node_admin_face toneAmber
class node_student_home,node_student_timetable,node_student_profile,node_student_fees,node_student_syllabus,node_student_management,node_academic_admin,node_timetable_admin,node_admin_dashboard,node_common_features,node_complaints,node_help_requests,node_marks_grades toneMint
class node_storage,node_seed_data,node_types toneRose
```

## Components

### Application entry

- [Role-based app](https://github.com/aayushteotia-hub/sama/blob/main/src/App.tsx): `src/App.tsx`
- [Authentication](https://github.com/aayushteotia-hub/sama/blob/main/src/components/auth/LoginPage.tsx): `src/components/auth/LoginPage.tsx`
- [Role navigation](https://github.com/aayushteotia-hub/sama/blob/main/src/components/layout/SidebarDrawer.tsx): `src/components/layout/SidebarDrawer.tsx`

### Attendance workflow

- [Student attendance](https://github.com/aayushteotia-hub/sama/blob/main/src/components/common/DualAttendanceView.tsx): `src/components/common/DualAttendanceView.tsx`
- [Attendance scanner](https://github.com/aayushteotia-hub/sama/blob/main/src/components/student/FaceScannerModal.tsx): `src/components/student/FaceScannerModal.tsx`
- [Face recognition](https://github.com/aayushteotia-hub/sama/blob/main/src/services/faceRecognition.ts): `src/services/faceRecognition.ts`
- [Teacher dashboard](https://github.com/aayushteotia-hub/sama/blob/main/src/components/teacher/TeacherDashboard.tsx): `src/components/teacher/TeacherDashboard.tsx`
- [Face registration](https://github.com/aayushteotia-hub/sama/blob/main/src/components/admin/FaceRegistrationStudio.tsx): `src/components/admin/FaceRegistrationStudio.tsx`

### Campus operations

- [Student portal](https://github.com/aayushteotia-hub/sama/blob/main/src/components/student/StudentHome.tsx): `src/components/student/StudentHome.tsx`
- [Student timetable](https://github.com/aayushteotia-hub/sama/blob/main/src/components/student/StudentTimetable.tsx): `src/components/student/StudentTimetable.tsx`
- [Student profile](https://github.com/aayushteotia-hub/sama/blob/main/src/components/student/StudentProfile.tsx): `src/components/student/StudentProfile.tsx`
- [Student fees](https://github.com/aayushteotia-hub/sama/blob/main/src/components/student/StudentFees.tsx): `src/components/student/StudentFees.tsx`
- [Student syllabus](https://github.com/aayushteotia-hub/sama/blob/main/src/components/student/StudentSyllabus.tsx): `src/components/student/StudentSyllabus.tsx`
- [Student records](https://github.com/aayushteotia-hub/sama/blob/main/src/components/admin/StudentManagement.tsx): `src/components/admin/StudentManagement.tsx`
- [Academic setup](https://github.com/aayushteotia-hub/sama/blob/main/src/components/admin/AcademicsManagement.tsx): `src/components/admin/AcademicsManagement.tsx`
- [Timetable setup](https://github.com/aayushteotia-hub/sama/blob/main/src/components/admin/TimetableManagement.tsx): `src/components/admin/TimetableManagement.tsx`
- [Admin dashboard](https://github.com/aayushteotia-hub/sama/blob/main/src/components/admin/AdminDashboard.tsx): `src/components/admin/AdminDashboard.tsx`
- [Campus services](https://github.com/aayushteotia-hub/sama/blob/main/src/components/common/ChatGroupsView.tsx): `src/components/common/ChatGroupsView.tsx`
- [Complaints](https://github.com/aayushteotia-hub/sama/blob/main/src/components/common/ComplaintsManagement.tsx): `src/components/common/ComplaintsManagement.tsx`
- [Help requests](https://github.com/aayushteotia-hub/sama/blob/main/src/components/common/HelpRequestsView.tsx): `src/components/common/HelpRequestsView.tsx`
- [Marks and grades](https://github.com/aayushteotia-hub/sama/blob/main/src/components/common/MarksGradesView.tsx): `src/components/common/MarksGradesView.tsx`

### Shared services

- [Application storage](https://github.com/aayushteotia-hub/sama/blob/main/src/services/storage.ts): `src/services/storage.ts`
- [Seed records](https://github.com/aayushteotia-hub/sama/blob/main/src/services/mockData.ts): `src/services/mockData.ts`
- [Domain types](https://github.com/aayushteotia-hub/sama/blob/main/src/types.ts): `src/types.ts`

### Other components

- **Campus users**

## Connections

- Campus users → Role-based app: use app
- Role-based app → Role navigation: renders navigation (evidence: `src/App.tsx`)
- Role-based app → Student attendance: routes attendance (evidence: `src/App.tsx`)
- Role-based app → Marks and grades: routes grades (evidence: `src/App.tsx`)
- Role-based app → Campus services: routes chat (evidence: `src/App.tsx`)
- Role-based app → Admin dashboard: routes dashboard (evidence: `src/App.tsx`)
- Role-based app → Student records: routes students (evidence: `src/App.tsx`)
- Role-based app → Academic setup: routes academics (evidence: `src/App.tsx`)
- Role-based app → Authentication: selects login (evidence: `src/App.tsx`)
- Role-based app → Attendance scanner: opens scanner (evidence: `src/App.tsx`)
- Role-based app → Teacher dashboard: routes teacher (evidence: `src/App.tsx`)
- Role-based app → Student portal: routes student (evidence: `src/App.tsx`)
- Role-based app → Student timetable: routes timetable (evidence: `src/App.tsx`)
- Role-based app → Student profile: routes profile (evidence: `src/App.tsx`)
- Role-based app → Student fees: routes fees
- Role-based app → Student syllabus: routes syllabus
- Role-based app → Timetable setup: routes timetable (evidence: `src/App.tsx`)
- Role-based app → Face registration: opens registration (evidence: `src/App.tsx`)
- Role-based app → Complaints: routes complaints (evidence: `src/App.tsx`)
- Role-based app → Help requests: routes requests (evidence: `src/App.tsx`)
- Authentication → Application storage: loads users (evidence: `src/components/auth/LoginPage.tsx`)
- Authentication → Face recognition: recognizes faces (evidence: `src/components/auth/LoginPage.tsx`)
- Attendance scanner → Face recognition: checks faces (evidence: `src/components/student/FaceScannerModal.tsx`)
- Face registration → Face recognition: uses recognition (evidence: `src/components/admin/FaceRegistrationStudio.tsx`)
- Teacher dashboard → Application storage: reads attendance (evidence: `src/components/teacher/TeacherDashboard.tsx`)
- Student records → Application storage: saves students (evidence: `src/components/admin/StudentManagement.tsx`)
- Academic setup → Application storage: manages records (evidence: `src/components/admin/AcademicsManagement.tsx`)
- Student attendance → Application storage: records attendance (evidence: `src/components/common/DualAttendanceView.tsx`)
- Marks and grades → Application storage: manages grades (evidence: `src/components/common/MarksGradesView.tsx`)
- Campus services → Application storage: manages messages (evidence: `src/components/common/ChatGroupsView.tsx`)
- Complaints → Application storage: manages complaints (evidence: `src/components/common/ComplaintsManagement.tsx`)
- Help requests → Application storage: manages requests (evidence: `src/components/common/HelpRequestsView.tsx`)
- Admin dashboard → Application storage: loads summaries (evidence: `src/components/admin/AdminDashboard.tsx`)
- Timetable setup → Application storage: manages schedule (evidence: `src/components/admin/TimetableManagement.tsx`)
- Student timetable → Application storage: reads schedule
- Student profile → Application storage: reads profile (evidence: `src/components/student/StudentProfile.tsx`)
- Application storage → Seed records: loads seed data (evidence: `src/services/storage.ts`)
- Role-based app → Application storage: loads app state (evidence: `src/App.tsx`)
