# blackhat955/wellness-tracking architecture

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

- Interactive diagram: https://gitdiagram.com/blackhat955/wellness-tracking
- Repository: https://github.com/blackhat955/wellness-tracking

## Overview

##### Project Type and Purpose
- From the file tree and README, this is a React single-page application (SPA) written in JavaScript, built and served by Node.js (npm start).
- The application, “WellnessTrackingSystem,” provides user authentication (login, registration, password reset, OTP), user and admin dashboards, workout plan browsing, chat-bot support, and analytics (line bars, donuts, class graphs).

##### File Structure Analysis
- Top Level
- public/ : static HTML (index.html) and meta files (manifest.json, robots.txt).
- src/ : all React code – entry point (index.js, App.js), global styles (index.css, App.css), and Web Vitals/test setups.
- src/components/ : reusable UI components grouped by feature (authentication flows, navigation bars, charts, cards, chatbot).
- src/pages/ : route-level containers that assemble components into full screens (loginPage, registrationPage, adminPage, userProfile, workoutPlans, etc.).
- src/assets/ : static images and professional’s data.
- src/connection.js : likely API client setup (Axios or fetch wrapper).

##### Architectural Patterns & Tech Stack
- Component-based front-end (React) with React Router for page navigation.
- CSS modules or scoped styles alongside each component/page.
- A single HTTP API layer (connection.js) for communicating with a back-end server (not in repo).
- Charts and visualizations (Linebar, Donut, ClassGraph) as domain-specific child components.
- State management is likely local to components or via context/hooks (no redux folder).

##### Main Components
a. Client-Side React SPA
- Entry & Routing: index.js → App.js → React Router → src/pages
- UI Components: grouped into Authentication, Navigation, Dashboard, Analytics, Chatbot, Cards
- Static Assets: images, manifest, robots.txt
b. API Layer
- connection.js: HTTP client configured with base URL, interceptors for auth token
c. External Services (not in repo but implied)
- Authentication Service (e.g., /auth/login, /auth/register, /auth/otp)
- Data Service / RESTful Endpoints (e.g., /users, /workouts, /analytics)
d. Database
- Underlying persistent store (e.g., MongoDB, PostgreSQL) accessed by back end
e. Hosting & CDN
- Node.js process hosting the SPA (Heroku, Vercel, AWS S3 + CloudFront)

##### Relationships and Data Flows
- Browser → React SPA: initial page load (HTTP GET)
- SPA → API Server: REST calls via connection.js for authentication, data fetch, analytics
- API Server → Database: queries and mutations
- SPA ←→ External Services: (e.g., OAuth provider, email/OTP service, analytics)

##### Architectural Patterns & Principles
- Layered Architecture:
- Presentation Layer (React UI)
- API Client Layer (connection.js)
- Service Layer (Back-end controllers & business logic)
- Persistence Layer (Database)
- Component Reuse & Separation of Concerns: UI split into pages vs. reusable components
- Single Responsibility: each page/component handles one feature (e.g., register.js, chat.js)
- Scalability: adding new features by dropping in new components/pages

## Diagram (Mermaid)

```mermaid
flowchart TD
    Browser["Browser"]:::external
    Browser -->|"Initial GET"| IndexJS

    subgraph "Presentation Layer (React SPA)"
        direction TB
        IndexJS["src/index.js"]:::presentation
        AppJS["src/App.js"]:::presentation
        IndexJS -->|"bootstrap App"| AppJS

        subgraph "Pages"
            direction TB
            LoginPage["LogPage"]:::presentation
            RegPage["ResPage"]:::presentation
            OTPPage["OtpPage"]:::presentation
            ResetPage["ResetPage"]:::presentation
            ForgotPage["ForgotPage"]:::presentation
            AdminPage["AdminPage"]:::presentation
            UserProfile["UserProf"]:::presentation
            WorkoutPlans["WorkoutPlans"]:::presentation
            FindPro["FindProfessional"]:::presentation
            Session["Session"]:::presentation
        end
        AppJS -->|"routes to"| LoginPage & RegPage & OTPPage & ResetPage & ForgotPage & AdminPage & UserProfile & WorkoutPlans & FindPro & Session

        subgraph "Components"
            direction TB
            LoginForm["Login Form"]:::presentation
            RegistrationForm["Registration Form"]:::presentation
            OTPInput["OTP Input"]:::presentation
            ForgotForm["Forgot Password Form"]:::presentation
            ResetForm["Reset Password Form"]:::presentation
            MainNavbar["Main Navbar"]:::presentation
            NavLogRes["Nav (Login/Registration)"]:::presentation
            SearchNav["Search Navigation"]:::presentation
            Footer["Footer"]:::presentation
            AdminElement["Admin Element/Card"]:::presentation
            PopulateCard["Card Populate"]:::presentation
            GenericCards["Generic Cards"]:::presentation
            WorkoutCard["Workout Card"]:::presentation
            VideoCard["Workout Videos Card"]:::presentation
            LineBar["Line Bar Chart"]:::presentation
            Donut["Donut Chart"]:::presentation
            ClassGraph["Class Graph"]:::presentation
            ChatbotNode["Chatbot Interface"]:::presentation
            Spinner["Spinner/Loader"]:::presentation
            FilterComp["Filter Component"]:::presentation
            SearchComp["Search Component"]:::presentation
        end
        LoginPage -->|uses| LoginForm
        RegPage -->|uses| RegistrationForm
        OTPPage -->|uses| OTPInput
        ForgotPage -->|uses| ForgotForm
        ResetPage -->|uses| ResetForm
        LoginPage & RegPage & AdminPage & UserProfile -->|renders| MainNavbar & Footer
        WorkoutPlans & FindPro & Session -->|renders| SearchNav & GenericCards
        AdminPage -->|renders| AdminElement & PopulateCard
        WorkoutPlans -->|renders| WorkoutCard & VideoCard
        AdminPage & UserProfile -->|renders| LineBar & Donut & ClassGraph
        AppJS -->|provides| ChatbotNode & Spinner & FilterComp & SearchComp
        AppJS -->|serves assets| Assets

        Assets["public/index.html\nmanifest.json\nrobots.txt\nsrc/assets"]:::presentation
    end

    subgraph "Client/Transport Layer"
        direction TB
        connectionJS["connection.js"]:::transport
    end
    AppJS -->|HTTP/HTTPS calls| connectionJS

    subgraph "Backend Services" 
        direction TB
        AuthAPI["Auth Service (/auth/*)"]:::business
        UserAPI["User Service (/users)"]:::business
        WorkoutAPI["Workout Service (/workouts)"]:::business
        AnalyticsAPI["Analytics Service (/analytics)"]:::business
    end
    connectionJS -->|REST calls| AuthAPI & UserAPI & WorkoutAPI & AnalyticsAPI

    subgraph "Persistence Layer"
        Database["MongoDB/Postgres"]:::persistence
    end
    AuthAPI & UserAPI & WorkoutAPI & AnalyticsAPI -->|queries/mutations| Database

    subgraph "External Services"
        direction TB
        EmailService["Email/OTP Service"]:::external
        OAuthService["OAuth Provider"]:::external
        CDN["CDN Hosting"]:::external
    end
    AuthAPI -->|sends email| EmailService
    AppJS -->|served via| CDN

    classDef presentation fill:#D0E8FF,stroke:#0366d6;
    classDef transport fill:#DFFFE0,stroke:#28a745;
    classDef business fill:#FFE0B3,stroke:#D97706;
    classDef persistence fill:#E5D0FF,stroke:#6B21A8;
    classDef external fill:#F0F0F0,stroke:#6B7280;

    click IndexJS "https://github.com/blackhat955/wellness-tracking/blob/main/src/index.js"
    click AppJS "https://github.com/blackhat955/wellness-tracking/blob/main/src/App.js"
    click connectionJS "https://github.com/blackhat955/wellness-tracking/blob/main/src/components/connection.js"

    click LoginPage "https://github.com/blackhat955/wellness-tracking/blob/main/src/pages/loginPages/logPage.js"
    click RegPage "https://github.com/blackhat955/wellness-tracking/blob/main/src/pages/registrationPages/resPage.js"
    click OTPPage "https://github.com/blackhat955/wellness-tracking/blob/main/src/pages/optpage/otpPage.js"
    click ResetPage "https://github.com/blackhat955/wellness-tracking/blob/main/src/pages/resetPage/reset.js"
    click ForgotPage "https://github.com/blackhat955/wellness-tracking/blob/main/src/pages/forgetPassword/forgotPage.js"
    click AdminPage "https://github.com/blackhat955/wellness-tracking/blob/main/src/pages/adminPage/adminPage.js"
    click UserProfile "https://github.com/blackhat955/wellness-tracking/blob/main/src/pages/useprofile/userprof.js"
    click WorkoutPlans "https://github.com/blackhat955/wellness-tracking/blob/main/src/pages/workoutPlans.js"
    click FindPro "https://github.com/blackhat955/wellness-tracking/blob/main/src/pages/findProfessional.js"
    click Session "https://github.com/blackhat955/wellness-tracking/blob/main/src/pages/session.js"

    click LoginForm "https://github.com/blackhat955/wellness-tracking/blob/main/src/components/login/login.js"
    click RegistrationForm "https://github.com/blackhat955/wellness-tracking/blob/main/src/components/RegistrationPage/register.js"
    click OTPInput "https://github.com/blackhat955/wellness-tracking/blob/main/src/components/otp/otp.js"
    click ForgotForm "https://github.com/blackhat955/wellness-tracking/blob/main/src/components/forget/forgot.js"
    click ResetForm "https://github.com/blackhat955/wellness-tracking/blob/main/src/components/resetpassword/reset.js"
    click MainNavbar "https://github.com/blackhat955/wellness-tracking/blob/main/src/components/navbar/navbar.js"
    click NavLogRes "https://github.com/blackhat955/wellness-tracking/blob/main/src/components/navbarLogResPage/nav.js"
    click SearchNav "https://github.com/blackhat955/wellness-tracking/blob/main/src/components/searchnav/searchnav.js"
    click Footer "https://github.com/blackhat955/wellness-tracking/blob/main/src/components/footer/footer.js"
    click AdminElement "https://github.com/blackhat955/wellness-tracking/blob/main/src/components/adminElement/admin.js"
    click PopulateCard "https://github.com/blackhat955/wellness-tracking/blob/main/src/components/cardPopulate/populate.js"
    click GenericCards "https://github.com/blackhat955/wellness-tracking/blob/main/src/components/cards/cards.js"
    click WorkoutCard "https://github.com/blackhat955/wellness-tracking/blob/main/src/components/workoutcard/workcard.js"
    click VideoCard "https://github.com/blackhat955/wellness-tracking/blob/main/src/components/workplasvideosCard/videoComponent.js"
    click LineBar "https://github.com/blackhat955/wellness-tracking/blob/main/src/components/Linebar/linebar.js"
    click Donut "https://github.com/blackhat955/wellness-tracking/blob/main/src/components/donut/donut.js"
    click ClassGraph "https://github.com/blackhat955/wellness-tracking/blob/main/src/components/classgraph/classgraph.js"
    click ChatbotNode "https://github.com/blackhat955/wellness-tracking/blob/main/src/components/chatbot/chat.js"
    click Spinner "https://github.com/blackhat955/wellness-tracking/blob/main/src/components/spinner/spinner.js"
    click FilterComp "https://github.com/blackhat955/wellness-tracking/blob/main/src/components/fiter/fiter.js"
    click SearchComp "https://github.com/blackhat955/wellness-tracking/blob/main/src/components/search/search.js"

    click Assets "https://github.com/blackhat955/wellness-tracking/blob/main/public/index.html"
    click Assets "https://github.com/blackhat955/wellness-tracking/blob/main/public/manifest.json"
    click Assets "https://github.com/blackhat955/wellness-tracking/blob/main/public/robots.txt"
    click Assets "https://github.com/blackhat955/wellness-tracking/tree/main/src/assets"
```
