# giavinh79/gymtrack architecture

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

- Interactive diagram: https://gitdiagram.com/giavinh79/gymtrack
- Repository: https://github.com/giavinh79/gymtrack

## Overview

##### Main System Components

a) Frontend Layer (React Application)
- Feature Modules (Authentication, Home, Exercise Details, Landing)
- Shared Components
- State Management (Redux Store)
- Routing Layer
- i18n System

b) Backend Integration
- Connection to the Spring Boot backend (external system)
- Firebase Authentication service

c) External Services
- Sentry (Error Tracking)
- Mixpanel (Analytics)
- Netlify (Hosting)

##### Component Relationships

a) Client-Side Flow:
**User Interface → React Router → Feature Components → Redux Store ↔ RTK Query → API Calls**

b) Data Flow:
**Frontend ↔ Spring Boot API ↔ Database**
**Frontend ↔ Firebase Auth**

##### Detailed Component Breakdown

Create sub-sections showing:

a) Feature Modules Organization:
- Authentication (login/signup modals)
- Home (routine management, visualization)
- Exercise Details
- Landing Page

b) State Management Layer:
- Redux Store
- Context Slice
- General Slice
- Modal Slice
- RTK Query Services
- Auth Service
- Exercise Service
- Routine Service

##### Technical Stack Indicators

- React.js with TypeScript
- Mantine UI Components
- Redux Toolkit & RTK Query
- i18next for internationalization
- Vite as build tool

##### Important Details

Annotations for:
- Protected vs Public routes
- Internationalization flow
- Error boundary implementation
- Modal management system
- Theme switching capability

##### Deployment Flow

A separate section showing:
- GitHub Actions CI/CD pipeline
- Netlify deployment process
- Environment configurations

Guidelines for Creation:

##### Creating separate views for
- High-level architecture
- Component interaction
- Data flow
- Deployment pipeline

Tools Recommendation:

Remember to emphasize:
- The separation of concerns in the feature-based architecture
- The role of RTK Query in data management
- The internationalization system's integration
- The authentication flow with Firebase
- The error handling and monitoring setup with Sentry

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Frontend
        UI[User Interface]
        Router[React Router]:::router
        click Router "https://github.com/giavinh79/GymTrack/blob/master/src/routes/index.tsx"
        
        subgraph Features
            Auth[Authentication Module]:::auth
            click Auth "https://github.com/giavinh79/GymTrack/tree/master/src/features/authentication"
            Home[Home Feature]:::feature
            click Home "https://github.com/giavinh79/GymTrack/tree/master/src/features/home"
            Exercise[Exercise Details]:::feature
            click Exercise "https://github.com/giavinh79/GymTrack/tree/master/src/features/exercise-details"
            Landing[Landing Page]:::feature
            click Landing "https://github.com/giavinh79/GymTrack/tree/master/src/features/landing"
        end
        
        subgraph "State Management"
            Redux[Redux Store]:::state
            click Redux "https://github.com/giavinh79/GymTrack/blob/master/src/stores/rootStore.ts"
            ContextSlice[Context Slice]:::state
            click ContextSlice "https://github.com/giavinh79/GymTrack/blob/master/src/slices/context/contextSlice.ts"
            GeneralSlice[General Slice]:::state
            click GeneralSlice "https://github.com/giavinh79/GymTrack/blob/master/src/slices/general/loadingSlice.ts"
            ModalSlice[Modal Slice]:::state
            click ModalSlice "https://github.com/giavinh79/GymTrack/blob/master/src/slices/modal/modalSlice.ts"
            RTKQuery[RTK Query]:::state
        end
        
        subgraph "Shared Components"
            BaseComps[Base Components]:::component
            click BaseComps "https://github.com/giavinh79/GymTrack/tree/master/src/shared/components/common"
            ErrorHandling[Error Handling]:::component
            click ErrorHandling "https://github.com/giavinh79/GymTrack/tree/master/src/shared/components/error"
            Navigation[Navigation]:::component
            click Navigation "https://github.com/giavinh79/GymTrack/tree/master/src/shared/components/navigation"
            ModalSystem[Modal System]:::component
            click ModalSystem "https://github.com/giavinh79/GymTrack/tree/master/src/shared/components/modal"
            Loaders[Loaders]:::component
            click Loaders "https://github.com/giavinh79/GymTrack/tree/master/src/shared/components/loaders"
        end
        
        subgraph "API Services"
            AuthService[Auth Service]:::api
            click AuthService "https://github.com/giavinh79/GymTrack/blob/master/src/services/auth.ts"
            ExerciseService[Exercise Service]:::api
            click ExerciseService "https://github.com/giavinh79/GymTrack/blob/master/src/services/exercise.ts"
            RoutineService[Routine Service]:::api
            click RoutineService "https://github.com/giavinh79/GymTrack/blob/master/src/services/routine.ts"
        end
        
        subgraph "Internationalization"
            I18N[i18n System]:::i18n
            click I18N "https://github.com/giavinh79/GymTrack/blob/master/src/i18n.ts"
            Translations[Translations]:::i18n
            click Translations "https://github.com/giavinh79/GymTrack/tree/master/public/locales"
        end
    end
    
    subgraph "External Services"
        SpringBoot[Spring Boot API]:::external
        Firebase[Firebase Auth]:::external
        click Firebase "https://github.com/giavinh79/GymTrack/blob/master/src/auth/firebase.ts"
        Sentry[Sentry]:::external
        Mixpanel[Mixpanel]:::external
        Netlify[Netlify]:::external
    end
    
    subgraph "CI/CD"
        GithubActions[GitHub Actions]:::cicd
        click GithubActions "https://github.com/giavinh79/GymTrack/blob/master/.github/workflows/main.yml"
        PlaywrightTests[Playwright Tests]:::cicd
        click PlaywrightTests "https://github.com/giavinh79/GymTrack/blob/master/.github/workflows/playwright.yml"
    end
    
    UI --> Router
    Router --> Auth
    Router --> Home
    Router --> Exercise
    Router --> Landing
    
    Features --> Redux
    Redux --> RTKQuery
    RTKQuery --> AuthService
    RTKQuery --> ExerciseService
    RTKQuery --> RoutineService
    
    AuthService --> SpringBoot
    ExerciseService --> SpringBoot
    RoutineService --> SpringBoot
    
    Auth --> Firebase
    UI --> I18N
    I18N --> Translations
    
    ErrorHandling --> Sentry
    UI --> Mixpanel
    GithubActions --> Netlify
    
    classDef auth fill:#9f7aea
    classDef feature fill:#4299e1
    classDef state fill:#ed8936
    classDef component fill:#4299e1
    classDef api fill:#48bb78
    classDef i18n fill:#ecc94b
    classDef external fill:#718096
    classDef cicd fill:#f56565
    classDef router fill:#805ad5
```
