# deepshah232004/fitnest architecture

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

- Interactive diagram: https://gitdiagram.com/deepshah232004/fitnest
- Repository: https://github.com/deepshah232004/fitnest

## Overview

##### Project type and purpose
- This is a full-stack, fitness-focused web application (FitNest) that combines:
- A single-page front-end (React + Vite) for user interaction,
- One or more back-end services (Node.js & Python) for data persistence, chat functionality, and pose-estimation,
- A MongoDB database for storing user profiles, workouts, etc.

##### File structure
Top-level folders and their roles:
- fitNest/ – the React-Vite front-end (JSX, CSS, assets, routing, stateful UI)
- mongoDB/ – Node-based API server (Express, Mongoose models, REST endpoints)
- model/ – Python service (Flask or FastAPI) exposing pose_estimation endpoints, using a YOLOv8 model
- chatbot/ – dual Node.js and Python chatbot service interacting with products.csv, possibly calling the model or DB
- root package.json & package-lock.json – monorepo scripts or shared dependencies
- venv/ & fitNest/node_modules/ & mongoDB/node_modules/ – language-specific environments

Patterns & hints:
- Microservices style: separate folders → separate containers/services
- SPA front-end talking to back-ends over HTTP/REST
- Data persistence via MongoDB

##### README for additional insights
- Minimal README (“# FitNest”) but folder names and files reveal tech stack and service boundaries.

##### Detail without over-splitting
- Service as its own component
- Don’t break UI further than “FitNest SPA” unless you want separate “Authentication” and “Dashboard” sub-components

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client
    Browser((Browser / Client)):::client

    %% Front-end SPA
    subgraph "Front-end SPA"
        FitNestSPA["FitNest SPA\n(React, Vite)"]:::frontend
        indexHTML["index.html"]:::frontend
        spaPkg["package.json"]:::frontend
        spaSrc["src/"]:::frontend
        spaPub["public/"]:::frontend
        FitNestSPA --> indexHTML
        FitNestSPA --> spaPkg
        FitNestSPA --> spaSrc
        FitNestSPA --> spaPub
    end

    %% User Data Service
    subgraph "User Data Service"
        DataService["User Data Service\nNode.js, Express, Mongoose"]:::backend
        serverJS["server.js"]:::backend
        modelJS["models/fitnest.js"]:::backend
        dbPkg["package.json"]:::backend
        DataService --> serverJS
        DataService --> modelJS
        DataService --> dbPkg
    end

    %% Pose Estimation Service
    subgraph "Pose Estimation Service"
        PoseService["Pose Estimation Service\nPython (Flask/FastAPI)"]:::ml
        webapp["webapp.py"]:::ml
        poseEst["pose_estimation.py"]:::ml
        yoloModel["yolov8n-pose.pt"]:::ml
        uploads["uploads_dir/"]:::ml
        PoseService --> webapp
        PoseService --> poseEst
        PoseService --> yoloModel
        PoseService --> uploads
    end

    %% Chatbot Service
    subgraph "Chatbot Service"
        ChatService["Chatbot Service\nNode.js + Python"]:::chat
        botjs["bot.js"]:::chat
        botpy["bot.py"]:::chat
        productsCSV["products.csv"]:::chat
        productsPy["products.py"]:::chat
        ChatService --> botjs
        ChatService --> botpy
        ChatService --> productsCSV
        ChatService --> productsPy
    end

    %% Database
    MongoDB[(MongoDB)]:::database

    %% Monorepo Config
    subgraph "Monorepo Config"
        rootPkg["package.json"]:::config
        rootLock["package-lock.json"]:::config
    end

    %% Relationships
    Browser -->|HTTPS| FitNestSPA
    FitNestSPA -->|REST POST/GET| DataService
    FitNestSPA -->|POST /infer| PoseService
    FitNestSPA -->|POST chat| ChatService
    DataService -->|CRUD| MongoDB
    ChatService -->|logs/interactions| MongoDB
    ChatService -->|optional invoke| PoseService

    %% Click Events
    click indexHTML "https://github.com/deepshah232004/fitnest/blob/main/fitNest/index.html"
    click spaPkg "https://github.com/deepshah232004/fitnest/blob/main/fitNest/package.json"
    click spaSrc "https://github.com/deepshah232004/fitnest/tree/main/fitNest/src/"
    click spaPub "https://github.com/deepshah232004/fitnest/tree/main/fitNest/public/"
    click serverJS "https://github.com/deepshah232004/fitnest/blob/main/mongoDB/server.js"
    click modelJS "https://github.com/deepshah232004/fitnest/blob/main/mongoDB/models/fitnest.js"
    click dbPkg "https://github.com/deepshah232004/fitnest/blob/main/mongoDB/package.json"
    click webapp "https://github.com/deepshah232004/fitnest/blob/main/model/webapp.py"
    click poseEst "https://github.com/deepshah232004/fitnest/blob/main/model/pose_estimation.py"
    click yoloModel "https://github.com/deepshah232004/fitnest/blob/main/model/yolov8n-pose.pt"
    click uploads "https://github.com/deepshah232004/fitnest/tree/main/model/uploads_dir/"
    click botjs "https://github.com/deepshah232004/fitnest/blob/main/chatbot/bot.js"
    click botpy "https://github.com/deepshah232004/fitnest/blob/main/chatbot/bot.py"
    click productsCSV "https://github.com/deepshah232004/fitnest/blob/main/chatbot/products.csv"
    click productsPy "https://github.com/deepshah232004/fitnest/blob/main/chatbot/products.py"
    click rootPkg "https://github.com/deepshah232004/fitnest/blob/main/package.json"
    click rootLock "https://github.com/deepshah232004/fitnest/blob/main/package-lock.json"

    %% Styles
    classDef frontend fill:#AEDBFA,stroke:#036
    classDef backend fill:#C8E6C9,stroke:#256
    classDef ml fill:#FFE0B2,stroke:#F57C00
    classDef chat fill:#FFF9C4,stroke:#F9A825
    classDef database fill:#ECEFF1,stroke:#90A4AE,stroke-width:2px,shape:cylinder
    classDef client fill:#B3E5FC,stroke:#0288D1
    classDef config fill:#E1BEE7,stroke:#7B1FA2
```
