# fxbresson/polaris-app architecture

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

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

## Overview

##### Project type and purpose
- This is a React Native mobile application (Expo) focused purely on the client side.
- There is no backend folder in the tree, so assume all business logic lives on the client, and any server interactions are via external APIs or services.

##### File structure
- Top-level entry: App.js (the root component).
- assets/: static assets (fonts, images).
- components/: reusable UI pieces and context provider.
– GlobalContext.js: app-wide state management.
– Other subfolders (doodle, matchs, strats) for feature-specific components.
- navigation/: React Navigation setup (AuthNavigator, MainTabNavigator, AppNavigator).
- screens/: high-level views (AuthLoadingScreen, AuthScreen, HomeScreen, LinksScreen, SettingsScreen).
- __tests__/: unit tests for components and App.

##### README
- All architectural cues must come from the structure.

##### Main components and their relationships
a. Mobile App (React Native / Expo)
b. Global Context Layer (GlobalContext.js) – injects state & actions
c. Navigation Layer
– AppNavigator: top-level switch between Auth flow and Main flow
– AuthNavigator: login/signup screens
– MainTabNavigator: bottom tab bar (Home, Links, Settings)
d. Screens: each Tab or Stack screen consumes context and renders feature components
e. Feature Components: doodle/*, matchs/*, strats/* – small UI building blocks
g. Assets: fonts & images used by components
h. (Optional) External Services: REST API or WebSocket endpoints (not in code but implied)

##### Architectural patterns & principles
- Single-page application pattern on native: one root App.js
- Context API for global state (avoids prop-drilling)
- Clear separation between navigation (in /navigation), screen logic (in /screens), and pure UI (in /components)
- Constants folder centralizes theme and layout data
- Atomic component organization by feature (doodle, matchs, strats)

##### Detail without over-splitting
- Every folder as a component group
- How they connect up to the root
- Avoid drilling into every .js file—group by folder unless a single file is a critical standalone module (e.g., GlobalContext)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Root and Provider
    subgraph "Root Layer"
        App["App.js"]:::root
        GlobalContext["GlobalContext.Provider"]:::provider
    end

    App -->|"wraps with"| GlobalContext

    %% Navigation Layer
    subgraph "Navigation Layer"
        AppNavigator["AppNavigator"]:::navigation
        AuthNavigator["AuthNavigator"]:::navigation
        MainTabNavigator["MainTabNavigator"]:::navigation
    end

    GlobalContext -->|"provides state to"| AppNavigator
    AppNavigator -->|"switch flow"| AuthNavigator
    AppNavigator -->|"switch flow"| MainTabNavigator

    %% Authentication Flow
    subgraph "Auth Flow"
        AuthLoading["AuthLoadingScreen"]:::screen
        AuthScreen["AuthScreen"]:::screen
    end

    AuthNavigator -->|initializes| AuthLoading
    AuthNavigator -->|navigates to| AuthScreen

    %% Main Flow
    subgraph "Main Flow"
        HomeScreen["HomeScreen"]:::screen
        LinksScreen["LinksScreen"]:::screen
        SettingsScreen["SettingsScreen"]:::screen
    end

    MainTabNavigator -->|tab| HomeScreen
    MainTabNavigator -->|tab| LinksScreen
    MainTabNavigator -->|tab| SettingsScreen

    %% Feature Components
    subgraph "Feature Components"
        subgraph "Doodle"
            DoodleLine["DoodleLine"]:::component
            DoodleTeam["DoodleTeam"]:::component
            DoodleUser["DoodleUser"]:::component
        end
        subgraph "Matchs"
            MatchItem["MatchItem"]:::component
        end
        subgraph "Strats"
            MapItem["MapItem"]:::component
            StratPhase["StratPhase"]:::component
        end
    end

    %% Shared UI Components
    subgraph "Shared UI Components"
        HeaderRight["HeaderRight"]:::component
        StyledText["StyledText"]:::component
        TabBarIcon["TabBarIcon"]:::component
    end

    %% Screens to Components
    HomeScreen -->|"uses"| DoodleLine
    HomeScreen -->|"uses"| DoodleTeam
    HomeScreen -->|"uses"| StyledText
    LinksScreen -->|"uses"| MatchItem
    SettingsScreen -->|"uses"| MapItem
    SettingsScreen -->|"uses"| StratPhase
    SettingsScreen -->|"uses"| HeaderRight

    %% Constants and Assets
    subgraph "Constants"
        Colors["Colors"]:::constant
        Layout["Layout"]:::constant
    end

    subgraph "Assets"
        Fonts["Fonts"]:::asset
        Images["Images"]:::asset
    end

    HomeScreen -->|"styled by"| Colors
    LinksScreen -->|"layout from"| Layout
    AllScreensViewport[/"All Screens"/]:::screen
    AllScreensViewport -->|loads assets| Fonts
    AllScreensViewport -->|loads assets| Images

    %% External Services
    ExternalAPI["External API Service"]:::external
    GlobalContext -->|"API call"| ExternalAPI
    HomeScreen -->|"fetch data"| ExternalAPI

    %% Click Events
    click App "https://github.com/fxbresson/polaris-app/blob/master/App.js"
    click GlobalContext "https://github.com/fxbresson/polaris-app/blob/master/components/GlobalContext.js"
    click AppNavigator "https://github.com/fxbresson/polaris-app/blob/master/navigation/AppNavigator.js"
    click AuthNavigator "https://github.com/fxbresson/polaris-app/blob/master/navigation/AuthNavigator.js"
    click MainTabNavigator "https://github.com/fxbresson/polaris-app/blob/master/navigation/MainTabNavigator.js"
    click AuthLoading "https://github.com/fxbresson/polaris-app/blob/master/screens/AuthLoadingScreen.js"
    click AuthScreen "https://github.com/fxbresson/polaris-app/blob/master/screens/AuthScreen.js"
    click HomeScreen "https://github.com/fxbresson/polaris-app/blob/master/screens/HomeScreen.js"
    click LinksScreen "https://github.com/fxbresson/polaris-app/blob/master/screens/LinksScreen.js"
    click SettingsScreen "https://github.com/fxbresson/polaris-app/blob/master/screens/SettingsScreen.js"
    click DoodleLine "https://github.com/fxbresson/polaris-app/blob/master/components/doodle/DoodleLine.js"
    click DoodleTeam "https://github.com/fxbresson/polaris-app/blob/master/components/doodle/DoodleTeam.js"
    click DoodleUser "https://github.com/fxbresson/polaris-app/blob/master/components/doodle/DoodleUser.js"
    click MatchItem "https://github.com/fxbresson/polaris-app/blob/master/components/matchs/MatchItem.js"
    click MapItem "https://github.com/fxbresson/polaris-app/blob/master/components/strats/MapItem.js"
    click StratPhase "https://github.com/fxbresson/polaris-app/blob/master/components/strats/StratPhase.js"
    click HeaderRight "https://github.com/fxbresson/polaris-app/blob/master/components/HeaderRight.js"
    click StyledText "https://github.com/fxbresson/polaris-app/blob/master/components/StyledText.js"
    click TabBarIcon "https://github.com/fxbresson/polaris-app/blob/master/components/TabBarIcon.js"
    click Colors "https://github.com/fxbresson/polaris-app/blob/master/constants/Colors.js"
    click Layout "https://github.com/fxbresson/polaris-app/blob/master/constants/Layout.js"
    click Fonts "https://github.com/fxbresson/polaris-app/tree/master/assets/fonts/"
    click Images "https://github.com/fxbresson/polaris-app/tree/master/assets/images/"

    %% Styles
    classDef root fill:#D0E8FF,stroke:#0366D6,color:#0366D6;
    classDef provider fill:#BEE3F8,stroke:#3182CE,color:#3182CE;
    classDef navigation fill:#E6FFFA,stroke:#2C7A7B,color:#2C7A7B;
    classDef screen fill:#FFF5E6,stroke:#DD6B20,color:#C05621;
    classDef component fill:#EDF2F7,stroke:#A0AEC0,color:#2D3748;
    classDef constant fill:#F7FAFC,stroke:#718096,color:#4A5568;
    classDef asset fill:#F0FFF4,stroke:#38A169,color:#2F855A;
    classDef external fill:#FAF5FF,stroke:#805AD5,color:#6B46C1;
```
