# yafa91/warascore architecture

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

- Interactive diagram: https://gitdiagram.com/yafa91/warascore
- Repository: https://github.com/yafa91/warascore

## Overview

##### Project type and purpose
- This is a cross-platform mobile app built with Expo and React Native (TypeScript).
- It uses file-based routing (under the **app/** directory) to define screens for news, live scores, user profiles, settings, notifications, articles, and match details.
- Native / platform code lives under **android/** and **ios/** for bundling and low-level integrations.

##### File structure
- **app/**
– Holds route-based screens (tabs, dynamic parameters, layouts).
– Example: `app/(tabs)/news.tsx`, `app/MatchDetailsScreen/[matchId].tsx`
- **components/**
- **context/** and **utils/context/**
– Context providers for favorites and theme.
- **hooks/**
- **utils/**
– Helpers for notifications, favorite persistence, network overlays.
- **assets/** and **constants/**
- **android/** & **ios/**
– Native projects, Gradle/Gradle-wrapper, Xcode project files, Podfiles.

##### README for additional insights
- Confirms Expo setup, commands for building/running on iOS/Android/emulator.
- Indicates the use of Expo’s file-based router.
- No backend code is present, so the app relies on external APIs/services.

##### Main components
a. Mobile App Client
– UI Layer: Screens (file-based routes), Custom Components, Assets.
– State Layer: React Contexts (FavoritesContext, ThemeContext), Hooks.
– Business Logic / Data Layer: utils for network requests, notifications, favorite logic.
– Routing Layer: Expo Router (file-based routing under **app/**).
b. Native Platform Integrations
– Android (Gradle build, native modules), iOS (Xcode, CocoaPods, native modules).
– Expo runtime bridging JS and native.
c. External Services
– RESTful sports data API (live scores, articles).
– Push notification service (Expo Notifications or FCM/APNs).
– (Optional) Authentication provider if login/signup uses OAuth or email.

##### Relationships and interactions
- UI screens dispatch actions or call hooks/contexts.
- Contexts manage shared state (favorites, theme) and persist via AsyncStorage or native modules.
- Data layer functions invoke REST API endpoints to fetch match details, news, etc.
- Notification utilities register with Expo’s notification SDK and external APNs/FCM.
- Native modules (camera, storage, notifications) are exposed to JS via Expo’s bridge.

##### Architectural patterns & design principles
- Layered architecture: Presentation (UI) → State (Context/Hooks) → Data (utils/API) → Native Integration.
- File-based routing enforces clear mapping between URLs/paths and screen components.
- Separation of concerns: UI components vs. business logic vs. platform code.
- Reusability: Centralized components, hooks, and contexts.

##### Detail
- How contexts wrap the entire app (e.g., ThemeContext at root layout).
- Build flow: TSX → JS bundle → Expo runtime → Android/iOS deployment.
- Both JS-side and native-side modules where necessary.

## Diagram (Mermaid)

```mermaid
flowchart TD
  %% Presentation Tier
  subgraph "Presentation Tier"
    subgraph "File-based Routing (app/)"
      News["News Screen"]:::screens
      Live["Live Scores Screen"]:::screens
      Favoris["Favorites Screen"]:::screens
      Profil["Profile Screen"]:::screens
      TabsIndex["Tabs Index"]:::screens
      Home["Home Screen"]:::screens
      Article["Article Screen"]:::screens
      MatchDetails["MatchDetails Screen"]:::screens
      Login["Login Screen"]:::screens
      Signup["Signup Screen"]:::screens
      EmailLogin["Email Login Screen"]:::screens
      About["About Screen"]:::screens
    end
    subgraph "Settings & Parameters"
      MatchNotif["MatchNotificationSettings"]:::screens
      WaraPlus["WaraScorePlus"]:::screens
      Avis["Avis"]:::screens
      Lien["LienRapide"]:::screens
      NotificationsParam["NotificationsParamater"]:::screens
      ProgrammeTV["ProgrammeTV"]:::screens
      Pronos["Pronos"]:::screens
    end
    Components["UI Components"]:::components
  end

  %% Application Tier
  subgraph "Application Tier"
    Contexts["Context Providers"]:::contexts
    Hooks["Custom Hooks"]:::hooks
    Routing["Expo Router\n(app/_layout.tsx & app/(tabs)/_layout.tsx)"]:::routing
  end

  %% Data Tier
  subgraph "Data Tier"
    Utils["Utilities & API Clients"]:::data
    Constants["Constants & Assets"]:::data
  end

  %% Platform Tier
  subgraph "Platform Tier"
    ExpoRuntime["Expo Runtime"]:::platform
    Android["Android Project"]:::platform
    iOS["iOS Project"]:::platform
    Config["App Configuration\n(app.json, tsconfig.json, package.json)"]:::platform
  end

  %% External Services
  subgraph "External Services"
    SportsAPI["Sports Data API"]:::external
    PushService["Push Notification Service"]:::external
    AuthProvider["Authentication Provider"]:::external
  end

  %% Relationships
  News -->|uses route| Routing
  Live -->|uses route| Routing
  Favoris -->|uses route| Routing
  Profil -->|uses route| Routing
  TabsIndex -->|uses route| Routing
  Home -->|uses route| Routing
  Article -->|uses route| Routing
  MatchDetails -->|uses route| Routing
  Login -->|uses route| Routing
  Signup -->|uses route| Routing
  EmailLogin -->|uses route| Routing
  About -->|uses route| Routing
  MatchNotif -->|uses route| Routing
  WaraPlus -->|uses route| Routing
  Avis -->|uses route| Routing
  Lien -->|uses route| Routing
  NotificationsParam -->|uses route| Routing
  ProgrammeTV -->|uses route| Routing
  Pronos -->|uses route| Routing

  News -->|renders| Components
  Live -->|renders| Components
  Favoris -->|renders| Components

  News -->|consumes| Contexts
  Live -->|consumes| Contexts
  Favoris -->|consumes| Contexts

  Contexts -->|provides state to| Hooks
  Routing -->|wraps with| Contexts

  News -->|calls| Utils
  Live -->|calls| Utils
  Favoris -->|calls| Utils

  Utils -->|fetches data from| SportsAPI
  Utils -->|registers with| PushService
  Utils -->|could call| AuthProvider

  ExpoRuntime -->|bridges JS to native| Android
  ExpoRuntime -->|bridges JS to native| iOS

  Routing -->|bundles via| ExpoRuntime
  Utils -->|uses native modules via| ExpoRuntime
  Components -->|styled by| Constants

  %% Click Events
  click News "https://github.com/yafa91/warascore/blob/main/app/(tabs)/news.tsx"
  click Live "https://github.com/yafa91/warascore/blob/main/app/(tabs)/live.tsx"
  click Favoris "https://github.com/yafa91/warascore/blob/main/app/(tabs)/favoris.tsx"
  click Profil "https://github.com/yafa91/warascore/blob/main/app/(tabs)/profil.tsx"
  click TabsIndex "https://github.com/yafa91/warascore/blob/main/app/(tabs)/index.tsx"
  click Home "https://github.com/yafa91/warascore/blob/main/app/HomeScreen/index.tsx"
  click Article "https://github.com/yafa91/warascore/blob/main/app/ArticleScreen.tsx"
  click MatchDetails "https://github.com/yafa91/warascore/blob/main/app/MatchDetailsScreen/[matchId].tsx"
  click Login "https://github.com/yafa91/warascore/blob/main/app/login.tsx"
  click Signup "https://github.com/yafa91/warascore/blob/main/app/signup.tsx"
  click EmailLogin "https://github.com/yafa91/warascore/blob/main/app/email-login.tsx"
  click About "https://github.com/yafa91/warascore/blob/main/app/about.tsx"
  click MatchNotif "https://github.com/yafa91/warascore/blob/main/app/paramater/MatchNotificationSettings.tsx"
  click WaraPlus "https://github.com/yafa91/warascore/blob/main/app/paramater/WaraScorePlus.tsx"
  click Avis "https://github.com/yafa91/warascore/blob/main/app/paramater/avis.tsx"
  click Lien "https://github.com/yafa91/warascore/blob/main/app/paramater/lienrapide.tsx"
  click NotificationsParam "https://github.com/yafa91/warascore/blob/main/app/paramater/notificationsParamater.tsx"
  click ProgrammeTV "https://github.com/yafa91/warascore/blob/main/app/paramater/programmeTV.tsx"
  click Pronos "https://github.com/yafa91/warascore/blob/main/app/paramater/pronos.tsx"
  click Components "https://github.com/yafa91/warascore/tree/main/components/"
  click Contexts "https://github.com/yafa91/warascore/blob/main/context/FavoritesContext.tsx"
  click Contexts "https://github.com/yafa91/warascore/blob/main/context/ThemeContext.tsx"
  click Hooks "https://github.com/yafa91/warascore/tree/main/hooks/"
  click Routing "https://github.com/yafa91/warascore/blob/main/app/_layout.tsx"
  click Routing "https://github.com/yafa91/warascore/blob/main/app/(tabs)/_layout.tsx"
  click Utils "https://github.com/yafa91/warascore/blob/main/utils/Notifications.tsx"
  click Utils "https://github.com/yafa91/warascore/blob/main/utils/favoriteUtils.tsx"
  click Constants "https://github.com/yafa91/warascore/blob/main/constants/Colors.ts"
  click Constants "https://github.com/yafa91/warascore/tree/main/assets/"
  click Android "https://github.com/yafa91/warascore/tree/main/android/"
  click iOS "https://github.com/yafa91/warascore/tree/main/ios/"
  click Config "https://github.com/yafa91/warascore/blob/main/app.json"
  click Config "https://github.com/yafa91/warascore/blob/main/tsconfig.json"
  click Config "https://github.com/yafa91/warascore/blob/main/package.json"

  %% Styles
  classDef screens fill:#D0E8FF,stroke:#0366D6,color:#0366D6;
  classDef components fill:#E8F3FF,stroke:#1D70B8,color:#1D70B8;
  classDef contexts fill:#DFFFE0,stroke:#28A745,color:#22863A;
  classDef hooks fill:#E6FFED,stroke:#34D058,color:#22863A;
  classDef routing fill:#F0E6FF,stroke:#6F42C1,color:#6F42C1;
  classDef data fill:#FFF5B1,stroke:#D29922,color:#735C0F;
  classDef platform fill:#F5E1FF,stroke:#8250DF,color:#6F42C1;
  classDef external fill:#FFE1E1,stroke:#D73A49,color:#CB2431;
```
