# mohcinesafi/fittrack-mobile_app-expo architecture

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

- Interactive diagram: https://gitdiagram.com/mohcinesafi/fittrack-mobile_app-expo
- Repository: https://github.com/mohcinesafi/fittrack-mobile_app-expo

## Overview

##### Project type and purpose
- This is a front-end application built with Next.js (App Router) and TypeScript.
- Its domain is a fitness-tracking dashboard (pages: achievements, stats, workouts, profile), currently backed by mock data.

##### File structure
- app/ – Next.js route handlers and layouts
– (tabs)/_layout.tsx defines a shared tab bar, then one file per tab (achievements.tsx, index.tsx, etc.)
– +not-found.tsx, app/_layout.tsx for global shell
- components/ – reusable UI widgets (Card components, Progress circles, Profile section)
- hooks/ – custom React hooks (e.g. useFrameworkReady)
- utils/ – mockData generation and other utilities
- assets/images/ – static images or SVGs
- types/ – TypeScript type definitions (dataTypes, env vars)
- config files – package.json, tsconfig.json, .prettierrc, .bolt/config.json, etc.

##### README
- Only contains a preview image with no textual architecture guidance.

a. Main components to show
– Next.js App Layer
- Router & Layouts (app/_layout.tsx, app/(tabs)/_layout.tsx)
– UI Component Library (components/*)
– Data Layer
- MockData Service (utils/mockData.ts)
- Future Real API Endpoints (next/api or external REST)
– Hooks & Orchestration (hooks/useFrameworkReady.ts)
– Assets (images)
– Type System (types/*.ts)
– Build & Deployment (Node.js, TypeScript compiler, Prettier, Bolt config)

b. Relationships & interactions
- Browser → Next.js Router → Page Layout → Page Component
- Page Components → UI Components (cards, progress bars)
- UI Components & hooks call Data Layer → mockData or external API → Data returns to components
- Build pipeline compiles TSX to JS, lints, bundles assets, then deploys

c. Architectural patterns & principles
- Component-based UI composition
- App Router + nested layouts (Next.js recommended pattern)
- Separation of concerns:
– Pages vs. shared components vs. data utils vs. type definitions
– Presentation vs. data fetching versus business logic (hooks)

d. Key technologies & frameworks
- Next.js 13+ (App Router)
- React + TypeScript
- Bolt (monorepo/packager)
- ESLint/Prettier, Node.js, npm

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        Browser["Browser"]
        Router["Next.js Router"]:::frontend
        GlobalLayout["Global Layout"]:::frontend
        TabsLayout["Tabs Layout"]:::frontend
        AchievementsPage["Achievements Page"]:::frontend
        StatsPage["Stats Page"]:::frontend
        WorkoutsPage["Workouts Page"]:::frontend
        ProfilePage["Profile Page"]:::frontend
        HomePage["Home/Dashboard Page"]:::frontend
        NotFound["404 Not Found Handler"]:::frontend
    end

    Browser --> Router
    Router --> GlobalLayout
    GlobalLayout --> TabsLayout
    TabsLayout --> AchievementsPage
    TabsLayout --> StatsPage
    TabsLayout --> WorkoutsPage
    TabsLayout --> ProfilePage
    TabsLayout --> HomePage
    Router --> NotFound

    %% UI Components
    subgraph "UI Components" 
        AchievementCard["AchievementCard"]:::frontend
        ActivityCard["ActivityCard"]:::frontend
        CircularProgress["CircularProgress"]:::frontend
        ProfileSection["ProfileSection"]:::frontend
        StatsCard["StatsCard"]:::frontend
        WorkoutCard["WorkoutCard"]:::frontend
    end

    AchievementsPage --> AchievementCard
    StatsPage --> StatsCard
    WorkoutsPage --> WorkoutCard
    ProfilePage --> ProfileSection
    AchievementsPage --> CircularProgress
    StatsPage --> CircularProgress
    WorkoutsPage --> ActivityCard

    %% Orchestration Hooks
    subgraph "Orchestration / Hooks"
        UseFrameworkReady["useFrameworkReady"]:::orchestration
    end

    TabsLayout --> UseFrameworkReady
    UseFrameworkReady -->|initializes| Router

    %% Data Layer
    subgraph "Data Layer"
        MockDataService["Mock Data Service"]:::data
        ExternalAPI["Future API Endpoints"]:::data
    end

    AchievementCard --> MockDataService
    ActivityCard --> MockDataService
    StatsCard --> MockDataService
    WorkoutCard --> MockDataService
    ProfileSection --> MockDataService
    MockDataService -->|future| ExternalAPI

    %% Types & Assets
    subgraph "Types & Assets"
        DataTypes["Data Type Definitions"]:::types
        EnvTypes["Env Var Definitions"]:::types
        Images["Static Assets (images/SVGs)"]:::assets
    end

    MockDataService --> DataTypes
    AchievementCard --> DataTypes
    Images --> AchievementCard
    Images --> ProfileSection

    %% Build & Deployment
    subgraph "Build & Deployment"
        NpmNode["npm & Node.js"]:::build
        TSConfig["TypeScript Config"]:::build
        Prettier["Prettier Config"]:::build
        BoltConfig["Bolt Config"]:::build
    end

    TSConfig --> NpmNode
    Prettier --> NpmNode
    BoltConfig --> NpmNode
    NpmNode -->|builds| GlobalLayout
    NpmNode -->|builds| MockDataService

    %% Click Events
    click GlobalLayout "https://github.com/mohcinesafi/fittrack-mobile_app-expo/blob/main/app/_layout.tsx"
    click TabsLayout "https://github.com/mohcinesafi/fittrack-mobile_app-expo/blob/main/app/(tabs)/_layout.tsx"
    click AchievementsPage "https://github.com/mohcinesafi/fittrack-mobile_app-expo/blob/main/app/(tabs)/achievements.tsx"
    click StatsPage "https://github.com/mohcinesafi/fittrack-mobile_app-expo/blob/main/app/(tabs)/stats.tsx"
    click WorkoutsPage "https://github.com/mohcinesafi/fittrack-mobile_app-expo/blob/main/app/(tabs)/workouts.tsx"
    click ProfilePage "https://github.com/mohcinesafi/fittrack-mobile_app-expo/blob/main/app/(tabs)/profile.tsx"
    click HomePage "https://github.com/mohcinesafi/fittrack-mobile_app-expo/blob/main/app/(tabs)/index.tsx"
    click NotFound "https://github.com/mohcinesafi/fittrack-mobile_app-expo/blob/main/app/+not-found.tsx"

    click AchievementCard "https://github.com/mohcinesafi/fittrack-mobile_app-expo/blob/main/components/AchievementCard.tsx"
    click ActivityCard "https://github.com/mohcinesafi/fittrack-mobile_app-expo/blob/main/components/ActivityCard.tsx"
    click CircularProgress "https://github.com/mohcinesafi/fittrack-mobile_app-expo/blob/main/components/CircularProgress.tsx"
    click ProfileSection "https://github.com/mohcinesafi/fittrack-mobile_app-expo/blob/main/components/ProfileSection.tsx"
    click StatsCard "https://github.com/mohcinesafi/fittrack-mobile_app-expo/blob/main/components/StatsCard.tsx"
    click WorkoutCard "https://github.com/mohcinesafi/fittrack-mobile_app-expo/blob/main/components/WorkoutCard.tsx"

    click MockDataService "https://github.com/mohcinesafi/fittrack-mobile_app-expo/blob/main/utils/mockData.ts"
    click UseFrameworkReady "https://github.com/mohcinesafi/fittrack-mobile_app-expo/blob/main/hooks/useFrameworkReady.ts"

    click Images "https://github.com/mohcinesafi/fittrack-mobile_app-expo/tree/main/assets/images/"
    click DataTypes "https://github.com/mohcinesafi/fittrack-mobile_app-expo/blob/main/types/dataTypes.ts"
    click EnvTypes "https://github.com/mohcinesafi/fittrack-mobile_app-expo/blob/main/types/env.d.ts"

    click NpmNode "https://github.com/mohcinesafi/fittrack-mobile_app-expo/blob/main/package.json"
    click TSConfig "https://github.com/mohcinesafi/fittrack-mobile_app-expo/blob/main/tsconfig.json"
    click Prettier "https://github.com/mohcinesafi/fittrack-mobile_app-expo/blob/main/.prettierrc"
    click BoltConfig "https://github.com/mohcinesafi/fittrack-mobile_app-expo/blob/main/.bolt/config.json"

    %% Styles
    classDef frontend fill:#d0e8ff,stroke:#1f77b4,stroke-width:1px
    classDef data fill:#e0ffd8,stroke:#2ca02c,stroke-width:1px
    classDef orchestration fill:#fff2cc,stroke:#d4a017,stroke-width:1px
    classDef types fill:#f0f0f0,stroke:#808080,stroke-width:1px
    classDef assets fill:#f9e6ff,stroke:#af52bf,stroke-width:1px
    classDef build fill:#e8e8e8,stroke:#585858,stroke-width:1px
```
