# manisha-v/face-recognition-based-employee-attendance-logger architecture

> Architecture diagram of the GitHub repository manisha-v/face-recognition-based-employee-attendance-logger, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-09-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/manisha-v/face-recognition-based-employee-attendance-logger
- Repository: https://github.com/manisha-v/face-recognition-based-employee-attendance-logger

## Overview

##### Project Type and Purpose
- This is a full-stack, monolithic web application for employee attendance using face recognition.
- Built with Python/Flask (backend), SQLite (persistence), HTML/CSS/JS (frontend), and ML libraries (OpenCV, dlib, face_recognition, deepface).

##### Top-Level Architecture Components
a. Client (Browser)
- Renders HTML templates
- Runs CSS/JS (index, chatbot, stats, login, signup, etc.)
b. Web Server (Flask App – app.py)
- Routes & Controllers for authentication, registration, face capture, attendance marking, report generation
- Integrates face-recognition service
c. Face Recognition Module
- Uses OpenCV (camera capture), dlib, face_recognition, deepface
- Training pipeline (static/TrainingImages → encoded models)
- Recognition pipeline (live camera frames → identity matches)
d. Data Storage
- SQLite database (EmployeeDB.db) for user credentials, attendance logs
- File system:
– static/TrainingImages (face templates)
– static/records.csv, todayAttendance.csv (exported reports)
e. Static Content Server
- Serves CSS, JS, audio, JSON helpers, and images

##### Relationships & Data Flow
- User ↔ Browser UI: HTTP GET/POST for login/signup, OTP flow, reset password, & attendance pages
- Browser → Flask: sends form data, image captures (via JS)
- Flask → Face Recognition Module: processes images, returns identity result
- Flask → SQLite: reads/writes user info & attendance records
- Flask → File System: stores new face images, generates CSV reports
- Browser ← Flask: returns rendered templates with dynamic data (stats, records)

##### Architectural Patterns & Principles
- MVC-style separation:
- Models: SQLite schemas & CSV files
- Views: HTML templates + static assets
- Controllers: Flask routes in app.py
- Monolithic service: single deployable Python process
- Layered design:
- Presentation (templates/static)
- Application logic (Flask + face-rec modules)
- Data persistency (SQLite + local files)
- Extensibility points: Face recognition component can be swapped or scaled separately

##### Technologies & Frameworks
- Backend: Python 3.8.13, Flask
- Database: SQLite
- ML Libraries: OpenCV, dlib, face_recognition, deepface
- Frontend: HTML, CSS, JavaScript
- Environment & Deployment: conda (msenv.yml), single-server process

## Diagram (Mermaid)

```mermaid
graph TB
    %% Presentation Layer
    subgraph "Presentation Layer"
        direction TB
        Browser["Browser UI<br>(HTML/CSS/JS)"]:::presentation
        subgraph "Templates"
            direction TB
            OTP["OTP.html"]:::presentation
            RecordsPage["RecordsPage.html"]:::presentation
            Chatbot["chatBot.html"]:::presentation
            Index["index.html"]:::presentation
            InsertPage["insertPage.html"]:::presentation
            Login["login.html"]:::presentation
            RecogPage["recogPage.html"]:::presentation
            ResetRequest["resetRequest.html"]:::presentation
            ResetPassword["resetPassword.html"]:::presentation
            Signup["signup.html"]:::presentation
            StatsPage["statsPage.html"]:::presentation
        end
        subgraph "Static Assets"
            direction TB
            CSS1["index.css"]:::presentation
            CSS2["chatbot.css"]:::presentation
            Audio["cameraSound.wav"]:::presentation
            HelperData["help.json"]:::presentation
        end
    end

    %% Application Layer
    subgraph "Application Layer"
        direction TB
        FlaskApp["Flask Server<br>(app.py)"]:::application
    end

    %% Data & Face Recognition Layer
    subgraph "Data & Face Recognition Layer"
        direction TB
        subgraph "Face Recognition Module"
            direction TB
            FaceRec["Face Recognition Service"]:::application
            subgraph "ML Libraries"
                direction TB
                CV["OpenCV"]:::external
                Dlib["dlib"]:::external
                FR["face_recognition"]:::external
                DF["deepface"]:::external
            end
        end
        DB["SQLite DB<br>(EmployeeDB.db)"]:::data
        subgraph "File System Storage"
            direction TB
            TrainingImages["TrainingImages/"]:::data
            ReportsCSV["records.csv"]:::data
            TodayCSV["todayAttendance.csv"]:::data
        end
    end

    %% Connections
    Browser -->|"HTTP requests (forms,image captures)"| FlaskApp
    FlaskApp -->|"Image processing requests"| FaceRec
    FaceRec -->|"Identity results"| FlaskApp
    FlaskApp -->|"Read/Write user & attendance data"| DB
    FlaskApp -->|"Read/Write images & CSV"| TrainingImages
    FlaskApp -->|"Generate CSV reports"| ReportsCSV
    FlaskApp -->|"Generate CSV reports"| TodayCSV
    FlaskApp -->|"HTTP responses (templates with data)"| Browser

    %% Click Events for Templates
    click OTP "https://github.com/manisha-v/face-recognition-based-employee-attendance-logger/blob/main/templates/OTP.html"
    click RecordsPage "https://github.com/manisha-v/face-recognition-based-employee-attendance-logger/blob/main/templates/RecordsPage.html"
    click Chatbot "https://github.com/manisha-v/face-recognition-based-employee-attendance-logger/blob/main/templates/chatBot.html"
    click Index "https://github.com/manisha-v/face-recognition-based-employee-attendance-logger/blob/main/templates/index.html"
    click InsertPage "https://github.com/manisha-v/face-recognition-based-employee-attendance-logger/blob/main/templates/insertPage.html"
    click Login "https://github.com/manisha-v/face-recognition-based-employee-attendance-logger/blob/main/templates/login.html"
    click RecogPage "https://github.com/manisha-v/face-recognition-based-employee-attendance-logger/blob/main/templates/recogPage.html"
    click ResetRequest "https://github.com/manisha-v/face-recognition-based-employee-attendance-logger/blob/main/templates/resetRequest.html"
    click ResetPassword "https://github.com/manisha-v/face-recognition-based-employee-attendance-logger/blob/main/templates/resetPassword.html"
    click Signup "https://github.com/manisha-v/face-recognition-based-employee-attendance-logger/blob/main/templates/signup.html"
    click StatsPage "https://github.com/manisha-v/face-recognition-based-employee-attendance-logger/blob/main/templates/statsPage.html"

    %% Click Events for Static Assets
    click CSS1 "https://github.com/manisha-v/face-recognition-based-employee-attendance-logger/blob/main/static/index.css"
    click CSS2 "https://github.com/manisha-v/face-recognition-based-employee-attendance-logger/blob/main/static/chatbot.css"
    click Audio "https://github.com/manisha-v/face-recognition-based-employee-attendance-logger/blob/main/static/cameraSound.wav"
    click HelperData "https://github.com/manisha-v/face-recognition-based-employee-attendance-logger/blob/main/static/help.json"

    %% Click Events for App and Data
    click FlaskApp "https://github.com/manisha-v/face-recognition-based-employee-attendance-logger/blob/main/app.py"
    click TrainingImages "https://github.com/manisha-v/face-recognition-based-employee-attendance-logger/tree/main/static/TrainingImages/"
    click DB "https://github.com/manisha-v/face-recognition-based-employee-attendance-logger/blob/main/EmployeeDB.db"
    click ReportsCSV "https://github.com/manisha-v/face-recognition-based-employee-attendance-logger/blob/main/static/records.csv"
    click TodayCSV "https://github.com/manisha-v/face-recognition-based-employee-attendance-logger/blob/main/static/todayAttendance.csv"

    %% Styles
    classDef presentation fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef application fill:#90EE90,stroke:#333,stroke-width:1px
    classDef data fill:#FFA500,stroke:#333,stroke-width:1px
    classDef external fill:#f5f5f5,stroke:#333,stroke-width:1px
```
