# bhalchandraop/smart-attendance-system architecture

> Architecture diagram of the GitHub repository bhalchandraop/smart-attendance-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bhalchandraop/smart-attendance-system
- Repository: https://github.com/bhalchandraop/smart-attendance-system

## Overview

##### Project type and purpose
- This is a full-stack, real-time web application (“Smart Attendance System”) that uses RFID hardware to track student entry/exit, pushes live updates to a browser UI via WebSocket, and persists data in MongoDB with Redis caching.

##### File structure
- Top-level:
- assets/ – images for docs
- backend/ – Node.js Express server, data models, configurations
- frontend/ – static HTML/CSS/JS client
- backend/models/Student.js indicates an MVC-style model layer
- server.js is the main entry point for HTTP + WebSocket
- .env implies configurable credentials (Mongo URI, Redis config)
- No separate “routes/” folder, so server.js likely wires all API and WS endpoints inline

##### README for additional insights
- Tech stack: Node.js + Express, WebSocket, MongoDB (via Mongoose), Redis cache, vanilla HTML/CSS/JS
- Hardware components: RFID reader (entry/exit scans), optional LCD display interface
- Core features: real-time attendance, scan history, student management UI

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Hardware Layer
    subgraph "Hardware Layer"
        RFID["RFID Reader & Tags"]:::hardware
        LCD["LCD Display (Optional)"]:::hardware
    end

    %% Backend Layer
    subgraph "Backend Layer"
        Server["Express Server\n(WS & REST API)"]:::backend
        StudentModel["Student Model\n(Mongoose)"]:::model
        EnvConfig["Environment Config\n(.env)"]:::config
        Package["Dependencies & Scripts\n(package.json)"]:::config
    end

    %% Data Stores
    subgraph "Data Stores"
        Redis["Redis Cache"]:::db
        Mongo["MongoDB Atlas"]:::db
    end

    %% Frontend Layer
    subgraph "Frontend Layer"
        Frontend["Browser Client\n(index.html, style.css)"]:::frontend
    end

    %% Documentation & Assets
    subgraph "Documentation & Assets"
        Readme["Documentation & Assets\nREADME.md, SOP, docs"]:::docs
    end

    %% Connections
    RFID -->|"scan data"| Server
    Server -->|"push via WS"| Frontend
    Frontend -->|"REST API calls"| Server
    Server -->|"cache read/write"| Redis
    Redis -->|"cache-miss fetch"| Mongo
    Server -->|"persistence"| Mongo
    Server -->|"control signals"| LCD

    EnvConfig --> Server
    Package --> Server
    StudentModel --> Server

    %% Click Events
    click Server "https://github.com/bhalchandraop/smart-attendance-system/blob/main/backend/server.js"
    click StudentModel "https://github.com/bhalchandraop/smart-attendance-system/blob/main/backend/models/Student.js"
    click EnvConfig "https://github.com/bhalchandraop/smart-attendance-system/blob/main/backend/.env"
    click Package "https://github.com/bhalchandraop/smart-attendance-system/blob/main/backend/package.json"
    click Frontend "https://github.com/bhalchandraop/smart-attendance-system/blob/main/frontend/index.html"
    click Frontend "https://github.com/bhalchandraop/smart-attendance-system/blob/main/frontend/style.css"
    click Readme "https://github.com/bhalchandraop/smart-attendance-system/blob/main/README.md"
    click Readme "https://github.com/bhalchandraop/smart-attendance-system/blob/main/Smart Attendance System - Project SOP.pdf"
    click Readme "https://github.com/bhalchandraop/smart-attendance-system/blob/main/Smart Attendance System.docx"
    click Readme "https://github.com/bhalchandraop/smart-attendance-system/tree/main/assets/"

    %% Styles
    classDef hardware fill:#f9f,stroke:#333,stroke-width:1px
    classDef backend fill:#bbf,stroke:#333,stroke-width:1px
    classDef db fill:#bfb,stroke:#333,stroke-width:1px
    classDef frontend fill:#ffb,stroke:#333,stroke-width:1px
    classDef model fill:#fbf,stroke:#333,stroke-width:1px
    classDef config fill:#ffe,stroke:#333,stroke-width:1px
    classDef docs fill:#ddd,stroke:#333,stroke-width:1px
```
