# iamgideonidoko/bio-attendance-sys architecture

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

- Interactive diagram: https://gitdiagram.com/iamgideonidoko/bio-attendance-sys
- Repository: https://github.com/iamgideonidoko/bio-attendance-sys

## Overview

##### Project Type and Purpose
- The project is a full‐stack biometric attendance system.
- Its purpose is to track attendance by leveraging fingerprint biometrics, specifically with a DigitalPersona U.are.U 4500 scanner.
- The system uses a hybrid approach with a MERN-stack-based client and NodeJS/Express backend (in the “server” directory) for core API and database management. A separate Python backend (“server-py”) handles computer vision and fingerprint matching using OpenCV and Flask (or similar), ensuring accurate biometric processing.

##### Analyzing the File Structure – Key Components
A. Client:
- Located in the “client” directory.
- Contains a React/TypeScript application (files like App.tsx, index.html, and various UI components).
- Organizes API calls (found under client/src/api) and uses libraries such as axios (axios-client.ts) for HTTP requests.
- Contains environment configuration files and styling (SCSS files).
- Uses Vite for build configuration (vite.config.ts).

B. Core Backend (“server”):
- Written in NodeJS (TypeScript) with an Express-based architecture.
- Contains controllers, routes, services, and middlewares to manage business logic (e.g., authentication, attendance, course, and student handling).
- Uses Prisma as the ORM for database interactions with a MySQL database (directory “prisma” and migration files).
- Configuration and helper modules (JWT, logger, password, etc.) add to the robustness of the backend.

C. Biometric (Matching) Backend (“server-py”):
- A Python-based backend responsible for computer vision, fingerprint processing, and matching.
- Likely uses the DigitalPersona scanner's SDK and OpenCV for image processing.
- Contains a “requirements.txt” for dependency management, and supporting folder “fingerprints” for storing fingerprint images/templates.

A. Main Components to Represent:
- Client (Frontend): Show the React application running on Windows, equipped with the DigitalPersona client for fingerprint scanning.
- Core Backend: Display the NodeJS server handling RESTful API endpoints. Include its primary modules (controllers, routes, services) and configuration components.
- Database: Represent the MySQL database that is accessed via Prisma in the core backend.
- External Hardware: Include the DigitalPersona U.are.U 4500 scanner as an external input device connecting to the client.

B. Relationships and Interactions:
- If applicable, show a direct link between the DigitalPersona scanner and the Client.

C. Architectural Patterns and Design Principles:
- Separation of concerns by illustrating distinct layers: presentation (client), application/service layer (backend controllers and services), and data layer (database).
- RESTful API or controller-service patterns in the server.
- For the biometric processing, note the middleware process between hardware capture (client) and the matching logic in the Python server.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Hardware
    DP["DigitalPersona Scanner"]:::hardware

    %% Client (Frontend)
    subgraph "Client (Frontend)"
        RC["React Client"]:::frontend
        FL["Fingerprint Lib"]:::frontend
        WS["WebSDK Module"]:::frontend
    end

    %% Define integration inside Client
    FL -->|"integrated_in"| RC
    WS -->|"integrated_in"| RC

    %% Core Backend (NodeJS API Server)
    subgraph "Core Backend (NodeJS API Server)"
        API["NodeJS API Server"]:::backend
        CT["Controllers"]:::backend
        RT["Routes"]:::backend
        SV["Services"]:::backend
        CF["Configuration"]:::backend
        PR["Prisma ORM"]:::backend
    end

    %% Define internal modules relationships in Core Backend
    API -->|"manages"| CT
    API -->|"manages"| RT
    API -->|"manages"| SV
    API -->|"manages"| CF
    API -->|"manages"| PR

    %% Biometric Backend (Python Fingerprint Matcher)
    subgraph "Biometric Backend (Python Fingerprint Matcher)"
        PS["Python Server"]:::python
        DPY["Dependencies"]:::python
        FS["Fingerprint Storage"]:::python
    end

    PS -->|"uses"| DPY
    PS -->|"uses"| FS

    %% Database Component
    DB["MySQL Database"]:::database

    %% System Interactions
    DP -->|"Capture_Fingerprint"| RC
    RC -->|"API_Call"| API
    API -->|"Data_Query"| DB
    API -->|"Fingerprint_Matching"| PS

    %% Click Events for Client
    click RC "https://github.com/iamgideonidoko/bio-attendance-sys/tree/master/client/"
    click FL "https://github.com/iamgideonidoko/bio-attendance-sys/blob/master/client/src/lib/fingerprint.ts"
    click WS "https://github.com/iamgideonidoko/bio-attendance-sys/blob/master/client/public/modules/websdkv1.js"

    %% Click Events for Core Backend
    click API "https://github.com/iamgideonidoko/bio-attendance-sys/tree/master/server/"
    click CT "https://github.com/iamgideonidoko/bio-attendance-sys/tree/master/server/src/controllers"
    click RT "https://github.com/iamgideonidoko/bio-attendance-sys/tree/master/server/src/routes"
    click SV "https://github.com/iamgideonidoko/bio-attendance-sys/tree/master/server/src/services"
    click CF "https://github.com/iamgideonidoko/bio-attendance-sys/tree/master/server/src/config"
    click PR "https://github.com/iamgideonidoko/bio-attendance-sys/tree/master/server/prisma"

    %% Click Events for Biometric Backend
    click PS "https://github.com/iamgideonidoko/bio-attendance-sys/blob/master/server-py/server.py"
    click DPY "https://github.com/iamgideonidoko/bio-attendance-sys/blob/master/server-py/requirements.txt"
    click FS "https://github.com/iamgideonidoko/bio-attendance-sys/tree/master/server-py/fingerprints"

    %% Styles
    classDef frontend fill:#BBDEFB,stroke:#0D47A1,stroke-width:2px;
    classDef backend fill:#FFCCBC,stroke:#E64A19,stroke-width:2px;
    classDef python fill:#C8E6C9,stroke:#388E3C,stroke-width:2px;
    classDef database fill:#FFF9C4,stroke:#F9A825,stroke-width:2px;
    classDef hardware fill:#E0E0E0,stroke:#424242,stroke-width:2px;
```
