# goaliath-app/goaliath architecture

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

- Interactive diagram: https://gitdiagram.com/goaliath-app/goaliath
- Repository: https://github.com/goaliath-app/goaliath

## Overview

##### Main System Components

a. Presentation Layer
- Components (src/components/)
- Screens (src/screens/)
- Theme (src/theme/)
- i18n (src/i18n/)

b. State Management Layer
- Redux Store (src/redux/)
- Activity Management (src/activityHandler/)

c. Platform Services Layer
- Notifications (src/notifications.js)
- Storage (AsyncStorage)
- File System (expo-file-system)

##### Key Architectural Elements to Highlight

a. Frontend Architecture:
- Navigation flow between screens
- Theme system (light/dark modes)

b. State Management:
- Redux store with different slices:
- Activities
- Goals
- Tasks
- Logs
- Settings
- Guide

c. External Services Integration:
- Expo services
- Notification system
- File system operations
- Localization services

**┌─────────────────────────────────────────────────────┐**
- UI Layer (React Native)            │
- ┬─────────────────┬────────────────┤
- Screens      │   Components    │     Theme      │
- ┬────────┴────────┬────────┴───────┬────────┘

- ▼                 ▼                 ▼
**┌─────────────────────────────────────────────────────┐**
- State Management (Redux)               │
- ┬──────────┬──────────┬──────────┬────────┤
- Activities│  Goals   │  Tasks   │   Logs   │Settings│
- ┬─┴────────┬─┴────────┬─┴────────┬─┴────────┘

- ▼          ▼          ▼          ▼
**┌─────────────────────────────────────────────────────┐**
- Platform Services                    │
- ┬─────────────┬─────────────┬──────────┤
- Notifications│  Storage    │ File System │   i18n   │
- ┴─────────────┴─────────────┴──────────┘

##### Data Flow Indicators

→ Unidirectional data flow (Redux actions)
↔ Bidirectional communication
⇢ External service calls

##### Implementation Details

- Redux store structure and state management
- Screen navigation patterns
- Component reusability
- Activity type handling system
- Internationalization setup
- Theme system implementation

##### External Dependencies

External services:
- Expo services
- Sentry for error tracking
- React Native Paper UI components
- AsyncStorage for data persistence

Remember to maintain a balance between showing the high-level architecture while including enough detail to understand the system's core functionality around goal and time management.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles and classes
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef state fill:#2ecc71,stroke:#27ae60,color:white
    classDef platform fill:#e67e22,stroke:#d35400,color:white
    classDef external fill:#95a5a6,stroke:#7f8c8d,color:white

    %% UI Layer
    subgraph UI
        Components["Components"]:::ui
        Screens["Screens"]:::ui
        Theme["Theme System"]:::ui
        Navigation["Navigation"]:::ui
        Stats["Stats & Analytics"]:::ui
        
        subgraph ThemeSystem
            LightTheme["Light Theme"]:::ui
            DarkTheme["Dark Theme"]:::ui
        end
        
        subgraph CoreScreens
            TodayScreen["Today Screen"]:::ui
            GoalsScreen["Goals Screen"]:::ui
            CalendarScreen["Calendar Screen"]:::ui
            StatsScreen["Stats Screen"]:::ui
        end
        
        subgraph NavComponents
            Drawer["Drawer"]:::ui
            Header["Header"]:::ui
        end
        
        subgraph StatsComponents
            BarCharts["Bar Charts"]:::ui
            CalendarHeatmap["Calendar Heatmap"]:::ui
        end
    end

    %% State Management Layer
    subgraph StateManagement
        ReduxStore["Redux Store"]:::state
        ActivityHandler["Activity Handler"]:::state
        
        subgraph ReduxSlices
            ActivitiesSlice["Activities Slice"]:::state
            GoalsSlice["Goals Slice"]:::state
            TasksSlice["Tasks Slice"]:::state
            LogsSlice["Logs Slice"]:::state
            SettingsSlice["Settings Slice"]:::state
            GuideSlice["Guide Slice"]:::state
        end
        
        subgraph ActivityTypes
            ActivityTypeHandler["Activity Types"]:::state
        end
    end

    %% Platform Services Layer
    subgraph PlatformServices
        Notifications["Notifications"]:::platform
        Storage["AsyncStorage"]:::platform
        FileSystem["File System"]:::platform
        i18n["Internationalization"]:::platform
        
        subgraph Languages
            English["English"]:::platform
            Spanish["Spanish"]:::platform
        end
    end

    %% Relationships
    Components --> ReduxStore
    Screens --> ReduxStore
    Theme --> SettingsSlice
    Navigation --> ReduxStore
    Stats --> LogsSlice
    ActivityHandler --> Notifications
    ReduxStore --> Storage
    i18n --> Components
    i18n --> Screens

    %% Click events
    click Components "https://github.com/goaliath-app/goaliath/tree/master/src/components/"
    click Screens "https://github.com/goaliath-app/goaliath/tree/master/src/screens/"
    click Theme "https://github.com/goaliath-app/goaliath/tree/master/src/theme/"
    click LightTheme "https://github.com/goaliath-app/goaliath/blob/master/src/theme/light.js"
    click DarkTheme "https://github.com/goaliath-app/goaliath/blob/master/src/theme/dark.js"
    click i18n "https://github.com/goaliath-app/goaliath/tree/master/src/i18n/"
    click English "https://github.com/goaliath-app/goaliath/blob/master/src/i18n/english.js"
    click Spanish "https://github.com/goaliath-app/goaliath/blob/master/src/i18n/spanish.js"
    click ReduxStore "https://github.com/goaliath-app/goaliath/blob/master/src/redux/store.js"
    click ActivitiesSlice "https://github.com/goaliath-app/goaliath/blob/master/src/redux/ActivitySlice.js"
    click GoalsSlice "https://github.com/goaliath-app/goaliath/blob/master/src/redux/GoalsSlice.js"
    click TasksSlice "https://github.com/goaliath-app/goaliath/blob/master/src/redux/TasksSlice.js"
    click LogsSlice "https://github.com/goaliath-app/goaliath/tree/master/src/redux/LogSlice/"
    click SettingsSlice "https://github.com/goaliath-app/goaliath/blob/master/src/redux/SettingsSlice.js"
    click GuideSlice "https://github.com/goaliath-app/goaliath/blob/master/src/redux/GuideSlice.js"
    click ActivityHandler "https://github.com/goaliath-app/goaliath/tree/master/src/activityHandler/"
    click ActivityTypeHandler "https://github.com/goaliath-app/goaliath/tree/master/src/activityHandler/activityTypes/"
    click Notifications "https://github.com/goaliath-app/goaliath/blob/master/src/notifications.js"
    click Drawer "https://github.com/goaliath-app/goaliath/blob/master/src/components/Drawer.js"
    click Header "https://github.com/goaliath-app/goaliath/blob/master/src/components/Header.js"
    click StatsScreen "https://github.com/goaliath-app/goaliath/blob/master/src/screens/StatsScreen.js"
    click BarCharts "https://github.com/goaliath-app/goaliath/blob/master/src/components/BarCharts.js"
    click CalendarHeatmap "https://github.com/goaliath-app/goaliath/blob/master/src/components/CalendarHeatmap.js"
    click TodayScreen "https://github.com/goaliath-app/goaliath/blob/master/src/screens/TodayScreen.js"
    click GoalsScreen "https://github.com/goaliath-app/goaliath/blob/master/src/screens/GoalsScreen.js"
    click CalendarScreen "https://github.com/goaliath-app/goaliath/blob/master/src/screens/CalendarScreen.js"
```
