# tauanmartins/frontend-techarena architecture

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

- Interactive diagram: https://gitdiagram.com/tauanmartins/frontend-techarena
- Repository: https://github.com/tauanmartins/frontend-techarena

## Overview

##### Project Type and Purpose
- This is a React Native mobile‐frontend (“Frontend‐TechArena”) for the TechArena application.
- It targets both Android and iOS (via the `android/` and `ios/` folders) and provides UI screens, navigation, theming, authentication contexts, and API integrations with a backend service.

##### File‐Structure Analysis
- Top‐level entries:
- `App.tsx` & `index.js`: entry point of the React Native JS application.
- `android/` & `ios/`: native platform projects for Android (Gradle) and iOS (Xcode).
- `src/`: all JS/TS source code, subdivided into:
– `components/`: reusable UI widgets (buttons, avatars, dialogs, etc.)
– `pages/`: full‐screen views (Login, Home, CreateMatch, League, Social, Settings)
– `navigation/`: routing and navigator definitions (stack/tab navigators, types)
– `utils/`: network/API calls, authentication & model contexts, theming, token utilities.
– `assets/`: static images and fonts.
- Configuration & tooling:
- `babel.config.js`, `metro.config.js`: Metro bundler configuration.
- `jest.config.js` and `__tests__/`: test setup.
- `.eslintrc.js`, `.prettierrc.js`: linting and formatting.

##### Key Architectural Components
a. React Native JS Layer
– **Entrypoint** (`index.js` → `App.tsx`) initializes ContextProviders (Auth, Theme) and mounts the root Navigator.
– **Navigation Layer** (`src/navigation/`): organizes screens into stacks and tabs.
– **UI Components** (`src/components/`): building blocks used by pages.
– **Pages** (`src/pages/`): combine UI components to render full screens and handle user interactions.
b. State & Context Management
– **AuthContext**: provides authentication state and methods (login/logout, token storage).
– **ThemeContext**: handles light/dark theming across the app.
– **Localization & Model Contexts**: optional, for multi‐language support and shared models.
c. Network/API Layer
– **API Utils** (`src/utils/API/`): modules grouping REST calls by domain (Users, Teams, Chats, Arenas, etc.).
– Underlying HTTP client (fetch or Axios).
d. Native Bridges
– Android native code under `android/app/src/...` and iOS code under `ios/app_techarena/`: handle platform‐specific modules (e.g., Flipper debugging).
e. External Services
– **Backend REST API**: a remote server providing data for appointments, matches, chat, user profiles, etc.
– Potential third‐party services (analytics, push notifications) – not present now but typical in mobile apps.

1. **User Device** (Phone)
2. **React Native Runtime**
- JSCore / Hermes (for Android/iOS)
- Native Modules Bridge
3. **JavaScript Layer**
- App Entrypoint & Providers
- Navigation
- UI Components / Pages
- Context Providers (Auth, Theme)
- API Utilities
4. **Native Platform**
- Android (Gradle, Activities, Application)
- iOS (Xcode Project, AppDelegate)
5. **External Backend** (REST API)
- User touches UI → Navigation events → Page logic
- Page logic → Context (read/write state)
- API call initiation → API Utils → Network → Backend
- Backend response → API Utils → update Context → UI re‐render
- Native events (push notifications, device APIs) → Native → JS via Bridge
c. Architectural Patterns:
- **Unidirectional Data Flow**: UI → Actions → Context/State → UI.
- **Layered Architecture**: Presentation (Components/Pages), State (Contexts), Services (API), Platform (Native).
d. Technologies:
- React Native, TypeScript
- React Navigation
- Metro Bundler
- Jest (testing)
- Native platform languages (Java/Kotlin for Android, Objective-C/Swift for iOS)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Device
    subgraph "User Device"
        Phone(("Phone")):::grey
    end

    %% React Native Runtime
    subgraph "React Native Runtime"
        Metro["Metro Bundler"]:::grey
        JSC["JSCore / Hermes"]:::grey
        Bridge["Native Modules Bridge"]:::grey
    end

    %% JavaScript Layer
    subgraph "JavaScript Layer"
        subgraph "Entrypoint"
            Index["index.js"]:::grey
            App["App.tsx"]:::grey
        end
        subgraph "Navigation Layer"
            AppNav["AppNavigator"]:::blue
            TabNav["TabNavigator"]:::blue
            NavTypes["NavigationTypes"]:::blue
            NavUtils["NavigationUtils"]:::blue
            ScreenProps["ScreenProps"]:::blue
        end
        subgraph "UI Components"
            ComponentsDir["src/components/"]:::blue
        end
        subgraph "Pages"
            Login["Login"]:::blue
            Home["Home"]:::blue
            CreateMatch["CreateMatch"]:::blue
            League["League"]:::blue
            Social["Social"]:::blue
            Settings["Settings"]:::blue
        end
        subgraph "State & Context"
            AuthContext["AuthContext"]:::green
            AuthProvider["AuthProvider"]:::green
            ModelAuthCtx["Model AuthContext"]:::green
            ThemeContext["ThemeContext"]:::green
            ModelThemeCtx["Model ThemeContext"]:::green
            LightTheme["Light Theme"]:::green
            DarkTheme["Dark Theme"]:::green
            ThemeUtils["ThemeUtils"]:::green
        end
        subgraph "API Utilities"
            APIIndex["API/index"]:::orange
            AppointmentsAPI["API/Appointments"]:::orange
            ArenasAPI["API/Arenas"]:::orange
            ChatsAPI["API/Chats"]:::orange
            FriendsAPI["API/Friends"]:::orange
            HoraryAPI["API/Horary"]:::orange
            MessagesAPI["API/Messages"]:::orange
            SportsAPI["API/Sports"]:::orange
            SportsArenaAPI["API/SportsArena"]:::orange
            TeamsAPI["API/Teams"]:::orange
            UsersAPI["API/Users"]:::orange
            UserSensitiveAPI["API/UserSensitiveInformation"]:::orange
        end
    end

    %% Native Platform
    subgraph "Native Platform"
        subgraph Android
            MainActivity["MainActivity.java"]:::grey
            MainApplication["MainApplication.java"]:::grey
            FlipperDebug["ReactNativeFlipper (debug)"]:::grey
            FlipperRelease["ReactNativeFlipper (release)"]:::grey
        end
        subgraph iOS
            AppDelegateH["AppDelegate.h"]:::grey
            AppDelegateMM["AppDelegate.mm"]:::grey
            MainM["main.m"]:::grey
        end
    end

    %% External Backend
    External["Backend REST API"]:::orange

    %% Connections
    Phone -->|"onPress → navigate()"| Index
    Index -->|"renders"| App
    App -->|"wraps"| AuthProvider
    AuthProvider --> AuthContext
    App --> ThemeContext
    App -->|"mounts"| AppNav
    AppNav --> TabNav
    TabNav --> Login
    TabNav --> Home
    TabNav --> CreateMatch
    TabNav --> League
    TabNav --> Social
    TabNav --> Settings
    Login --> ComponentsDir
    Home --> ComponentsDir
    CreateMatch --> ComponentsDir
    League --> ComponentsDir
    Social --> ComponentsDir
    Settings --> ComponentsDir
    Login --> AuthContext
    Home --> AuthContext
    CreateMatch --> AuthContext
    League --> AuthContext
    Social --> AuthContext
    Settings --> AuthContext
    Login --> APIIndex
    Home --> APIIndex
    CreateMatch --> APIIndex
    League --> APIIndex
    Social --> APIIndex
    Settings --> APIIndex
    APIIndex --> External
    Metro --> App
    Metro --> JSC
    App --> Bridge
    Bridge --> MainActivity
    Bridge --> MainApplication
    Bridge --> FlipperDebug
    Bridge --> FlipperRelease
    Bridge --> AppDelegateH
    Bridge --> AppDelegateMM
    Bridge --> MainM

    %% Click Events
    click Index "https://github.com/tauanmartins/frontend-techarena/blob/main/index.js"
    click App "https://github.com/tauanmartins/frontend-techarena/blob/main/App.tsx"
    click AppNav "https://github.com/tauanmartins/frontend-techarena/blob/main/src/navigation/AppNavigator.tsx"
    click TabNav "https://github.com/tauanmartins/frontend-techarena/blob/main/src/navigation/TabNavigator.tsx"
    click NavTypes "https://github.com/tauanmartins/frontend-techarena/blob/main/src/navigation/NavigationTypes.ts"
    click NavUtils "https://github.com/tauanmartins/frontend-techarena/blob/main/src/navigation/NavigationUtils.tsx"
    click ScreenProps "https://github.com/tauanmartins/frontend-techarena/blob/main/src/navigation/ScreenProps.ts"
    click ComponentsDir "https://github.com/tauanmartins/frontend-techarena/tree/main/src/components/"
    click Login "https://github.com/tauanmartins/frontend-techarena/blob/main/src/pages/Login/index.tsx"
    click Home "https://github.com/tauanmartins/frontend-techarena/blob/main/src/pages/Home/index.tsx"
    click CreateMatch "https://github.com/tauanmartins/frontend-techarena/blob/main/src/pages/CreateMatch/index.tsx"
    click League "https://github.com/tauanmartins/frontend-techarena/blob/main/src/pages/League/index.tsx"
    click Social "https://github.com/tauanmartins/frontend-techarena/blob/main/src/pages/Social/index.tsx"
    click Settings "https://github.com/tauanmartins/frontend-techarena/blob/main/src/pages/Settings/index.tsx"
    click AuthContext "https://github.com/tauanmartins/frontend-techarena/blob/main/src/utils/Auth/AuthContext/index.tsx"
    click AuthProvider "https://github.com/tauanmartins/frontend-techarena/blob/main/src/utils/Auth/AuthProvider/index.tsx"
    click ModelAuthCtx "https://github.com/tauanmartins/frontend-techarena/blob/main/src/utils/Model/Context/AuthContext/index.tsx"
    click ThemeContext "https://github.com/tauanmartins/frontend-techarena/blob/main/src/utils/Theme/ThemeContext/index.tsx"
    click ModelThemeCtx "https://github.com/tauanmartins/frontend-techarena/blob/main/src/utils/Model/Context/ThemeContext/index.tsx"
    click LightTheme "https://github.com/tauanmartins/frontend-techarena/blob/main/src/utils/Theme/Light/index.tsx"
    click DarkTheme "https://github.com/tauanmartins/frontend-techarena/blob/main/src/utils/Theme/Dark/index.tsx"
    click ThemeUtils "https://github.com/tauanmartins/frontend-techarena/blob/main/src/utils/Theme/ThemeUtils/index.tsx"
    click APIIndex "https://github.com/tauanmartins/frontend-techarena/blob/main/src/utils/API/index.tsx"
    click AppointmentsAPI "https://github.com/tauanmartins/frontend-techarena/blob/main/src/utils/API/Appointments/index.tsx"
    click ArenasAPI "https://github.com/tauanmartins/frontend-techarena/blob/main/src/utils/API/Arenas/index.tsx"
    click ChatsAPI "https://github.com/tauanmartins/frontend-techarena/blob/main/src/utils/API/Chats/index.tsx"
    click FriendsAPI "https://github.com/tauanmartins/frontend-techarena/blob/main/src/utils/API/Friends/index.tsx"
    click HoraryAPI "https://github.com/tauanmartins/frontend-techarena/blob/main/src/utils/API/Horary/index.tsx"
    click MessagesAPI "https://github.com/tauanmartins/frontend-techarena/blob/main/src/utils/API/Messages/index.tsx"
    click SportsAPI "https://github.com/tauanmartins/frontend-techarena/blob/main/src/utils/API/Sports/index.tsx"
    click SportsArenaAPI "https://github.com/tauanmartins/frontend-techarena/blob/main/src/utils/API/SportsArena/index.tsx"
    click TeamsAPI "https://github.com/tauanmartins/frontend-techarena/blob/main/src/utils/API/Teams/index.tsx"
    click UsersAPI "https://github.com/tauanmartins/frontend-techarena/blob/main/src/utils/API/Users/index.tsx"
    click UserSensitiveAPI "https://github.com/tauanmartins/frontend-techarena/blob/main/src/utils/API/UserSensitiveInformation/index.tsx"
    click MainActivity "https://github.com/tauanmartins/frontend-techarena/blob/main/android/app/src/main/java/com/app_techarena/MainActivity.java"
    click MainApplication "https://github.com/tauanmartins/frontend-techarena/blob/main/android/app/src/main/java/com/app_techarena/MainApplication.java"
    click FlipperDebug "https://github.com/tauanmartins/frontend-techarena/blob/main/android/app/src/debug/java/com/app_techarena/ReactNativeFlipper.java"
    click FlipperRelease "https://github.com/tauanmartins/frontend-techarena/blob/main/android/app/src/release/java/com/app_techarena/ReactNativeFlipper.java"
    click AppDelegateH "https://github.com/tauanmartins/frontend-techarena/blob/main/ios/app_techarena/AppDelegate.h"
    click AppDelegateMM "https://github.com/tauanmartins/frontend-techarena/blob/main/ios/app_techarena/AppDelegate.mm"
    click MainM "https://github.com/tauanmartins/frontend-techarena/blob/main/ios/app_techarena/main.m"

    %% Styles
    classDef blue fill:#D0E8FF,stroke:#0052CC,color:#0052CC;
    classDef green fill:#DFF2BF,stroke:#4F8A10,color:#4F8A10;
    classDef orange fill:#FFE1B3,stroke:#D9822B,color:#D9822B;
    classDef grey fill:#EEEEEE,stroke:#888888,color:#333333;
```
