# naren004/fitness_react architecture

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

- Interactive diagram: https://gitdiagram.com/naren004/fitness_react
- Repository: https://github.com/naren004/fitness_react

## Overview

##### Project type and purpose
- This is a single-page React Fitness Application (“The Gym”) that runs entirely in the browser.
- It displays exercise data (over a thousand entries) fetched from external APIs (via RapidAPI), and integrates YouTube video results.
- It is built with React, hosted on Firebase Hosting, and uses GitHub Actions for CI/CD.

##### File structure
- Top-level folders and files
- public/ – static assets and index.html
- src/ – React source code
- .github/workflows – CI/CD pipeline definition
- firebase.json, .firebaserc – Firebase Hosting configuration
- package.json, package-lock.json – Node/npm dependencies and scripts
- .env – environment variables (API keys)
- src/ substructure
- src/pages – top-level pages: Home, ExerciseDetail
- src/components – reusable UI components (Navbar, Footer, ExerciseCard, etc.)
- src/utils/fetchData.js – HTTP client wrapper to call external APIs

##### Key insights from README
- Uses React for the UI
- Data and video content powered by RapidAPI (exercise database and YouTube)
- Hosted live at a Firebase URL
- No custom backend—pure frontend + external services

##### Blueprint
a. Main components
- Developer & GitHub repository
- GitHub Actions CI/CD workflow
- Firebase Hosting & CDN
- Client browser (end user)
- React application (static bundle)
– Modules: Routing layer (App.js)
– Pages: Home, ExerciseDetail
– UI components: Navbar, BodyPart, ExerciseCard, Loader, etc.
– Utility layer: fetchData.js
- External services
– Exercise database API (RapidAPI)
– YouTube Data API (RapidAPI)
b. Relationships and data flows
- Developer pushes code to GitHub → triggers GitHub Actions → builds and deploys to Firebase Hosting
- User’s browser requests the app → Firebase CDN serves static bundle
- React app initializes in browser → user interacts with pages/components → fetchData utility sends HTTP requests to external APIs → UI components render data and videos
c. Architectural patterns and design principles
- Component-based UI (React) with clear separation: pages vs. reusable components vs. utilities
- Static-hosting architecture—no custom server code
- External API integration abstracted behind a fetchData helper
- CI/CD pipeline for automated build & deployment
d. Key technologies and frameworks
- React (UI library)
- Node.js/npm (build and dependency management)
- GitHub Actions (CI/CD)
- Firebase Hosting (static site hosting + CDN)
- RapidAPI (third-party data services)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Global entities
    Developer["Developer"]:::external
    GitHubRepo["GitHub Repository"]:::external
    GitHubActions["GitHub Actions CI/CD"]:::cicd
    FirebaseHosting["Firebase Hosting"]:::hosting
    FirebaseCDN["Firebase CDN"]:::hosting
    Browser["Client Browser"]:::frontend

    %% Deployment Flow
    Developer -->|push code| GitHubRepo
    GitHubRepo -->|trigger| GitHubActions
    GitHubActions -->|build & deploy| FirebaseHosting
    FirebaseHosting --> FirebaseCDN
    FirebaseCDN -->|serve static bundle| Browser

    %% React App Initialization
    subgraph "React Application" 
        direction TB
        Entry["public/index.html"]:::frontend
        Init["src/index.js"]:::frontend
        AppRoot["src/App.js"]:::frontend
        Styles["src/App.css"]:::frontend
        Env[".env"]:::frontend

        subgraph "Pages" 
            Home["Home Page (src/pages/Home.js)"]:::frontend
            Detail["ExerciseDetail Page (src/pages/ExerciseDetail.js)"]:::frontend
        end

        subgraph "UI Components"
            Navbar["Navbar (src/components/Navbar.js)"]:::frontend
            Footer["Footer (src/components/Footer.js)"]:::frontend
            Hero["HeroBanner (src/components/HeroBanner.js)"]:::frontend
            BodyPart["BodyPart Filter (src/components/BodyPart.js)"]:::frontend
            ExerciseCard["ExerciseCard (src/components/ExerciseCard.js)"]:::frontend
            ExercisesList["Exercises List (src/components/Exercises.js)"]:::frontend
            SearchExercises["SearchExercises (src/components/SearchExercises.js)"]:::frontend
            ExerciseVideos["ExerciseVideos (src/components/ExerciseVideos.js)"]:::frontend
            SimilarExercises["SimilarExercises (src/components/SimilarExercises.js)"]:::frontend
            HorizontalScroll["HorizontalScrollbar (src/components/HorizontalScrollbar.js)"]:::frontend
            Loader["Loader (src/components/Loader.js)"]:::frontend
            DetailHelper["Detail (src/components/Detail.js)"]:::frontend
        end

        subgraph "Utilities"
            FetchData["fetchData.js (src/utils/fetchData.js)"]:::frontend
        end

        subgraph "Assets"
            Images["src/assets/images"]:::frontend
            Icons["src/assets/icons"]:::frontend
        end

        Entry --> Init --> AppRoot --> Styles
        Env --> FetchData
        AppRoot --> Pages
        AppRoot --> Toolbar["UI Components"] 
        Pages --> UIComponents["UI Components"]
        UIComponents --> FetchData
        FetchData -->|HTTP requests| ExternalAPIs
    end

    %% External Services
    subgraph "External APIs"
        direction TB
        ExerciseAPI["Exercise Database API (RapidAPI)"]:::external
        YouTubeAPI["YouTube Data API (RapidAPI)"]:::external
    end

    Browser -->|"loads bundle"| Entry
    Browser -->|interacts| AppRoot
    FetchData --> ExerciseAPI
    FetchData --> YouTubeAPI
    ExerciseAPI -->|data| UIComponents
    YouTubeAPI -->|videos| UIComponents

    %% Click Events
    click GitHubActions "https://github.com/naren004/fitness_react/blob/main/.github/workflows/firebase-hosting-pull-request.yml"
    click FirebaseHosting "https://github.com/naren004/fitness_react/blob/main/firebase.json"
    click FirebaseHosting "https://github.com/naren004/fitness_react/blob/main/.firebaserc"
    click Env "https://github.com/naren004/fitness_react/blob/main/.env"
    click Entry "https://github.com/naren004/fitness_react/blob/main/public/index.html"
    click Init "https://github.com/naren004/fitness_react/blob/main/src/index.js"
    click AppRoot "https://github.com/naren004/fitness_react/blob/main/src/App.js"
    click Styles "https://github.com/naren004/fitness_react/blob/main/src/App.css"
    click Home "https://github.com/naren004/fitness_react/blob/main/src/pages/Home.js"
    click Detail "https://github.com/naren004/fitness_react/blob/main/src/pages/ExerciseDetail.js"
    click Navbar "https://github.com/naren004/fitness_react/blob/main/src/components/Navbar.js"
    click Footer "https://github.com/naren004/fitness_react/blob/main/src/components/Footer.js"
    click Hero "https://github.com/naren004/fitness_react/blob/main/src/components/HeroBanner.js"
    click BodyPart "https://github.com/naren004/fitness_react/blob/main/src/components/BodyPart.js"
    click ExerciseCard "https://github.com/naren004/fitness_react/blob/main/src/components/ExerciseCard.js"
    click ExercisesList "https://github.com/naren004/fitness_react/blob/main/src/components/Exercises.js"
    click SearchExercises "https://github.com/naren004/fitness_react/blob/main/src/components/SearchExercises.js"
    click ExerciseVideos "https://github.com/naren004/fitness_react/blob/main/src/components/ExerciseVideos.js"
    click SimilarExercises "https://github.com/naren004/fitness_react/blob/main/src/components/SimilarExercises.js"
    click HorizontalScroll "https://github.com/naren004/fitness_react/blob/main/src/components/HorizontalScrollbar.js"
    click Loader "https://github.com/naren004/fitness_react/blob/main/src/components/Loader.js"
    click DetailHelper "https://github.com/naren004/fitness_react/blob/main/src/components/Detail.js"
    click FetchData "https://github.com/naren004/fitness_react/blob/main/src/utils/fetchData.js"
    click Images "https://github.com/naren004/fitness_react/tree/main/src/assets/images"
    click Icons "https://github.com/naren004/fitness_react/tree/main/src/assets/icons"

    %% Styles
    classDef cicd fill:#f9c74f,stroke:#e9a841,color:#000
    classDef hosting fill:#90caf9,stroke:#64b5f6,color:#000
    classDef frontend fill:#a5d6a7,stroke:#81c784,color:#000
    classDef external fill:#ce93d8,stroke:#ba68c8,color:#000
```
