# sachinmaurya69500/face_recognition_attendance_system architecture

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

- Interactive diagram: https://gitdiagram.com/sachinmaurya69500/face_recognition_attendance_system
- Repository: https://github.com/sachinmaurya69500/face_recognition_attendance_system

## Overview

Pratyaksh is a face-recognition attendance product: teachers/admins register students and capture attendance from camera images; students view attendance, while staff can manage accounts, sessions, visitors, and reports. The documented production path is mobile client → Nginx → FastAPI → PostgreSQL, with GPU face inference in the API. The graph also includes caching, sessions, photo handling, PDF reporting, and the date-picker utility. Relationships are based on the README and shown source-index references; unsampled details are not inferred.

Main entry points: [`backend/app/main.py`](https://github.com/sachinmaurya69500/face_recognition_attendance_system/blob/main/backend/app/main.py) (API and attendance), [`mobile-expo/App.tsx`](https://github.com/sachinmaurya69500/face_recognition_attendance_system/blob/main/mobile-expo/App.tsx) (Mobile app), [`backend/app/database.py`](https://github.com/sachinmaurya69500/face_recognition_attendance_system/blob/main/backend/app/database.py) (Database access), [`backend/app/photo_storage.py`](https://github.com/sachinmaurya69500/face_recognition_attendance_system/blob/main/backend/app/photo_storage.py) (Student photo storage)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Mobile client"]
  node_mobile["Mobile app<br/>[App.tsx]"]
  node_date_picker["Date-time picker"]
  node_date_format["Date formatting<br/>[dateFormat.ts]"]
end

subgraph group_api["API and domain"]
  node_nginx["Nginx gateway<br/>[default.conf]"]
  node_fastapi["API and attendance<br/>[main.py]"]
  node_face_model["Face inference<br/>[models.py]"]
  node_pdf_reports["PDF reports<br/>[pdf_services.py]"]
  node_visitor["Visitor and QR services"]
end

subgraph group_services["Runtime services"]
  node_sessions["Auth sessions<br/>[session_manager.py]"]
  node_cache["Cache and rate limits<br/>[cache.py]"]
  node_photo_storage["Student photo storage<br/>[photo_storage.py]"]
  node_student_photos["Photo thumbnails<br/>[student_photos.py]"]
end

subgraph group_storage["Persistence"]
  node_database_helper["Database access<br/>[database.py]"]
  node_seed["Database seeding<br/>[seed_database.py]"]
  node_postgres[("PostgreSQL and pgvector")]
  node_redis[("Redis")]
  node_photo_files[("Photo files")]
end

node_staff(("Teacher or admin"))
node_student(("Student"))

node_staff -->|"uses"| node_mobile
node_student -->|"uses"| node_mobile
node_mobile -->|"sends requests"| node_nginx
node_mobile -.->|"calls directly"| node_fastapi
node_nginx -->|"proxies requests"| node_fastapi
node_fastapi -->|"reads and writes"| node_database_helper
node_database_helper -->|"connects"| node_postgres
node_fastapi -->|"runs inference"| node_face_model
node_fastapi -->|"manages sessions"| node_sessions
node_sessions -->|"uses cache"| node_cache
node_fastapi -->|"caches and limits"| node_cache
node_cache -.->|"stores cache"| node_redis
node_fastapi -->|"generates reports"| node_pdf_reports
node_fastapi -->|"handles visitors"| node_visitor
node_fastapi -->|"stores photos"| node_photo_storage
node_photo_storage -->|"updates photo paths"| node_database_helper
node_photo_storage -->|"writes photo files"| node_photo_files
node_fastapi -->|"formats thumbnails"| node_student_photos
node_seed -->|"connects"| node_database_helper
node_seed -->|"creates and seeds"| node_postgres
node_date_picker -->|"uses parsing"| node_date_format

click node_mobile "https://github.com/sachinmaurya69500/face_recognition_attendance_system/blob/main/mobile-expo/App.tsx"
click node_date_picker "https://github.com/sachinmaurya69500/face_recognition_attendance_system/blob/main/mobile-expo/components/AppDateTimePicker.tsx"
click node_date_format "https://github.com/sachinmaurya69500/face_recognition_attendance_system/blob/main/mobile-expo/utils/dateFormat.ts"
click node_nginx "https://github.com/sachinmaurya69500/face_recognition_attendance_system/blob/main/nginx/default.conf"
click node_fastapi "https://github.com/sachinmaurya69500/face_recognition_attendance_system/blob/main/backend/app/main.py"
click node_face_model "https://github.com/sachinmaurya69500/face_recognition_attendance_system/blob/main/backend/app/models.py"
click node_pdf_reports "https://github.com/sachinmaurya69500/face_recognition_attendance_system/blob/main/backend/app/pdf_services.py"
click node_visitor "https://github.com/sachinmaurya69500/face_recognition_attendance_system/blob/main/backend/app/visitor_services.py"
click node_sessions "https://github.com/sachinmaurya69500/face_recognition_attendance_system/blob/main/backend/app/session_manager.py"
click node_cache "https://github.com/sachinmaurya69500/face_recognition_attendance_system/blob/main/backend/app/cache.py"
click node_photo_storage "https://github.com/sachinmaurya69500/face_recognition_attendance_system/blob/main/backend/app/photo_storage.py"
click node_student_photos "https://github.com/sachinmaurya69500/face_recognition_attendance_system/blob/main/backend/app/student_photos.py"
click node_database_helper "https://github.com/sachinmaurya69500/face_recognition_attendance_system/blob/main/backend/app/database.py"
click node_seed "https://github.com/sachinmaurya69500/face_recognition_attendance_system/blob/main/backend/app/seed_database.py"
click node_photo_files "https://github.com/sachinmaurya69500/face_recognition_attendance_system/tree/main/backend/storage/student_photos"

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_mobile,node_date_picker,node_date_format toneBlue
class node_nginx,node_fastapi,node_face_model,node_pdf_reports,node_visitor toneAmber
class node_sessions,node_cache,node_photo_storage,node_student_photos toneMint
class node_database_helper,node_seed,node_postgres,node_redis,node_photo_files toneRose
class node_staff,node_student toneIndigo
```

## Components

### Mobile client

- [Mobile app](https://github.com/sachinmaurya69500/face_recognition_attendance_system/blob/main/mobile-expo/App.tsx): `mobile-expo/App.tsx`
- [Date-time picker](https://github.com/sachinmaurya69500/face_recognition_attendance_system/blob/main/mobile-expo/components/AppDateTimePicker.tsx): `mobile-expo/components/AppDateTimePicker.tsx`
- [Date formatting](https://github.com/sachinmaurya69500/face_recognition_attendance_system/blob/main/mobile-expo/utils/dateFormat.ts): `mobile-expo/utils/dateFormat.ts`

### API and domain

- [Nginx gateway](https://github.com/sachinmaurya69500/face_recognition_attendance_system/blob/main/nginx/default.conf): `nginx/default.conf`
- [API and attendance](https://github.com/sachinmaurya69500/face_recognition_attendance_system/blob/main/backend/app/main.py): `backend/app/main.py`
- [Face inference](https://github.com/sachinmaurya69500/face_recognition_attendance_system/blob/main/backend/app/models.py): `backend/app/models.py`
- [PDF reports](https://github.com/sachinmaurya69500/face_recognition_attendance_system/blob/main/backend/app/pdf_services.py): `backend/app/pdf_services.py`
- [Visitor and QR services](https://github.com/sachinmaurya69500/face_recognition_attendance_system/blob/main/backend/app/visitor_services.py): `backend/app/visitor_services.py`

### Runtime services

- [Auth sessions](https://github.com/sachinmaurya69500/face_recognition_attendance_system/blob/main/backend/app/session_manager.py): `backend/app/session_manager.py`
- [Cache and rate limits](https://github.com/sachinmaurya69500/face_recognition_attendance_system/blob/main/backend/app/cache.py): `backend/app/cache.py`
- [Student photo storage](https://github.com/sachinmaurya69500/face_recognition_attendance_system/blob/main/backend/app/photo_storage.py): `backend/app/photo_storage.py`
- [Photo thumbnails](https://github.com/sachinmaurya69500/face_recognition_attendance_system/blob/main/backend/app/student_photos.py): `backend/app/student_photos.py`

### Persistence

- [Database access](https://github.com/sachinmaurya69500/face_recognition_attendance_system/blob/main/backend/app/database.py): `backend/app/database.py`
- [Database seeding](https://github.com/sachinmaurya69500/face_recognition_attendance_system/blob/main/backend/app/seed_database.py): `backend/app/seed_database.py`
- **PostgreSQL and pgvector**
- **Redis**
- [Photo files](https://github.com/sachinmaurya69500/face_recognition_attendance_system/tree/main/backend/storage/student_photos): `backend/storage/student_photos`

### Other components

- **Teacher or admin**
- **Student**

## Connections

- Teacher or admin → Mobile app: uses (evidence: `Readme.md`)
- Student → Mobile app: uses (evidence: `Readme.md`)
- Mobile app → Nginx gateway: sends requests (evidence: `Readme.md`)
- Mobile app → API and attendance: calls directly (evidence: `Readme.md`)
- Nginx gateway → API and attendance: proxies requests (evidence: `Readme.md`)
- API and attendance → Database access: reads and writes (evidence: `backend/app/main.py`)
- Database access → PostgreSQL and pgvector: connects (evidence: `Readme.md`)
- API and attendance → Face inference: runs inference (evidence: `Readme.md`)
- API and attendance → Auth sessions: manages sessions (evidence: `backend/app/main.py`)
- Auth sessions → Cache and rate limits: uses cache (evidence: `backend/app/session_manager.py`)
- API and attendance → Cache and rate limits: caches and limits (evidence: `backend/app/main.py`)
- Cache and rate limits → Redis: stores cache
- API and attendance → PDF reports: generates reports (evidence: `backend/app/main.py`)
- API and attendance → Visitor and QR services: handles visitors (evidence: `backend/app/main.py`)
- API and attendance → Student photo storage: stores photos (evidence: `backend/app/main.py`)
- Student photo storage → Database access: updates photo paths (evidence: `backend/app/photo_storage.py`)
- Student photo storage → Photo files: writes photo files (evidence: `backend/app/photo_storage.py`)
- API and attendance → Photo thumbnails: formats thumbnails (evidence: `backend/app/main.py`)
- Database seeding → Database access: connects (evidence: `backend/app/seed_database.py`)
- Database seeding → PostgreSQL and pgvector: creates and seeds (evidence: `backend/app/seed_database.py`)
- Date-time picker → Date formatting: uses parsing (evidence: `mobile-expo/components/AppDateTimePicker.tsx`)
