# manthanguptaa/fitme architecture

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

- Interactive diagram: https://gitdiagram.com/manthanguptaa/fitme
- Repository: https://github.com/manthanguptaa/fitme

## Overview

##### Project Type and Purpose
- FitMe is a frontend-heavy, single-page application built with React. Its main purpose is to provide an AI-enabled fitness experience by leveraging TensorFlow’s PoseNet to estimate and compare user poses.
- It integrates Firebase for authentication and potentially for data storage. The real-time aspects (logged-in sessions, state management) are handled on the client side.

##### File Structure for Architectural Clues
- The top-level directories include “public” and “src”, which is typical of a React single-page application.
- The “src” folder contains the main application code:
- React components (inside /components and /views) that construct the UI.
- “posenet” folder with modules for loading and using TensorFlow’s PoseNet. This module handles the pose detection, image processing, and any associated utility functions.
- “firebase.js” and “contexts/AuthContext.js” indicate integration with Firebase for user authentication and perhaps real-time data.
- The presence of “api_utils.js” shows that there are abstracted utilities likely handling any API calls or abstraction for backend interactions.
- A well-organized SCSS and assets folder suggests a focus on a modular, maintainable design for styling.
- Build configuration and package management are handled by package.json and package-lock.json. Additionally, .github files indicate GitHub workflows and potential deployment infrastructure.

##### Elements
- Each major React component (grouped logically, e.g., Header, Footer, Dashboard) with a label.
- The PoseNet module block indicating its internal hooks, components, and utilities.
- Utility classes (API utilities, contexts) as supporting modules, linking to multiple components.
- A clear delineation between user interaction points (browser) and backend/external services (Firebase).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Client
    subgraph "Frontend Client"
        BHTML("Browser HTML"):::frontend
        BJS("Browser JS"):::frontend
    end

    %% UI Components
    subgraph "UI Components"
        UIC("UI Components"):::frontend
        Home("Home View"):::frontend
    end

    %% Pose Estimation Module
    subgraph "Pose Estimation Module"
        PM("PoseNet Module"):::ai
        PNC("PoseNet Component"):::ai
        LP("LogPose Utility"):::ai
        IP("ImagePose Component"):::ai
    end

    %% Firebase Integration
    subgraph "Firebase Integration"
        FB("Firebase"):::backend
        AC("Auth Context"):::backend
    end

    %% API Utilities & Helpers
    subgraph "API Utilities"
        APIU("API Utilities"):::util
        UTILS("Utils Modules"):::util
    end

    %% Connections between components
    BHTML -->|"loads"| UIC
    BJS -->|"loads"| UIC
    UIC -->|"rendersView"| Home
    UIC -->|"invokesPoseDetection"| PM
    PM -->|"includes"| PNC
    PM -->|"uses"| LP
    PM -->|"triggers"| IP
    UIC -->|"authData"| FB
    UIC -->|"callsAPI"| APIU
    APIU -->|"utilizes"| UTILS
    FB -->|"provides"| AC
    PM -->|"returnsPoseData"| UIC

    %% Click Events
    click BHTML "https://github.com/manthanguptaa/fitme/blob/main/public/index.html"
    click BJS "https://github.com/manthanguptaa/fitme/blob/main/src/index.js"
    click UIC "https://github.com/manthanguptaa/fitme/tree/main/src/components"
    click Home "https://github.com/manthanguptaa/fitme/blob/main/src/views/Home.js"
    click PM "https://github.com/manthanguptaa/fitme/tree/main/src/posenet"
    click PNC "https://github.com/manthanguptaa/fitme/blob/main/src/posenet/components/PoseNet.js"
    click LP "https://github.com/manthanguptaa/fitme/blob/main/src/LogPose.js"
    click IP "https://github.com/manthanguptaa/fitme/blob/main/src/components/ImagePose.js"
    click FB "https://github.com/manthanguptaa/fitme/blob/main/src/firebase.js"
    click AC "https://github.com/manthanguptaa/fitme/blob/main/src/contexts/AuthContext.js"
    click APIU "https://github.com/manthanguptaa/fitme/blob/main/src/api_utils.js"
    click UTILS "https://github.com/manthanguptaa/fitme/tree/main/src/utils"

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#333,stroke-width:2px;
    classDef ai fill:#d4edda,stroke:#333,stroke-width:2px;
    classDef backend fill:#ffeeba,stroke:#333,stroke-width:2px;
    classDef util fill:#d1ecf1,stroke:#333,stroke-width:2px;
```
