# aitorpalleja/gestordivisas-myalbatross architecture

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

- Interactive diagram: https://gitdiagram.com/aitorpalleja/gestordivisas-myalbatross
- Repository: https://github.com/aitorpalleja/gestordivisas-myalbatross

## Overview

##### Main Components
- Mobile UI Frontend: Representing the React Native client that encompasses the user interface elements.
- Features Module:
- Currencies: Includes screens (CurrencyListScreen, CurrencyDetailScreen) and related components.
- Insights: Includes screens for daily insights such as gainers/losers and average changes.
- Trends: Focused on market trend visuals, interactive charts, and indicators.
- User Management: Screens for user profiles and setting preferences.
- Splash: The initial loading/transition screen.
- Navigation: The routing mechanism that ties these screens together (managed under the src/navigation folder).
- Global State Management: Provided by Zustand (located in the src/stores folder) to manage application state and theming.
- Internationalization: Represented by the i18n configuration and locales.
- API & Services: The services layer (src/services/apiClient) for network requests and data fetching, possibly using SWR.
- Testing: Include a note that the project is rigorously tested with Jest (with tests in the __tests__ and __mocks__ directories).

##### Relationships and Data Flows
- The main React Native Application acts as the container, orchestrating navigation and state management.
- Different feature modules communicate with the API layer to fetch currency data, market trends, and user profile information.
- Global state (via Zustand) influences UI rendering (e.g., dark mode, language preferences) and is accessed/updated from multiple components.
- Navigation routes flow between screens (e.g., listing currencies to detailed views, user profile updates, etc.).
- Data flows from services (API responses) into various screens/components, filtered and displayed based on the application's logic.

##### Architectural Patterns & Design Principles
- Modular / Feature-Based Structure: Clearly segmented features (currencies, insights, trends, user, splash) allow for isolated development and testing.
- Separation of Concerns: UI components, state management, navigation, and services are maintained in distinct directories.
- Reusability: Shared components (like CustomHeader) and interfaces help in uniform UI and data handling.
- Testability: Unit tests (with Jest & testing-library) emphasize reliability and separation of business logic.
- Use of state management (Zustand) and internationalization (i18n) improves scalability and adaptability.

##### Technologies & Frameworks Highlighted
- React Native & TypeScript for the mobile app foundation.
- Zustand for state management.
- SWR for data fetching (implying asynchronous API interactions).
- i18n for managing multiple locales.
- Jest & React Native Testing Library for testing.

a. Start by sketching the React Native Mobile App at the center.
c. Link the Navigation component, showing the routes that connect these modules.
d. External integrations – the API service (depicted as the data source) and how it feeds into the services layer.
e. Shared State Management (Zustand) as a central hub that interacts with the UI components.
f. Auxiliary components such as i18n for internationalization, and annotate any testing layers that validate the various components.
g. Optionally, include native-specific directories (android, ios) to indicate platform-specific configurations.

## Diagram (Mermaid)

```mermaid
flowchart TD
    A["Mobile UI Frontend"]:::ui

    subgraph "Navigation"
        C1["App Navigator"]:::nav
        C2["Navigation Types"]:::nav
    end

    subgraph "Features Modules"
        subgraph "Currencies Module"
            CU1["CurrencyListScreen"]:::module
            CU2["CurrencyDetailScreen"]:::module
            CU3["CurrencyCard"]:::module
        end
        I["Insights Module"]:::module
        T["Trends Module"]:::module
        U["User Management Module"]:::module
        S["Splash Module"]:::module
    end

    D["Global State Management (Zustand)"]:::state
    subgraph "Internationalization"
        E1["i18n Index"]:::intl
        E2["Locales"]:::intl
    end
    F["API & Services"]:::service

    subgraph "Testing"
        T1["Tests"]:::testing
        T2["Mocks"]:::testing
    end

    A -->|"controls"| C1
    A -->|"controls"| C2

    A -->|"loads"| CU1
    A -->|"loads"| I
    A -->|"loads"| T
    A -->|"loads"| U
    A -->|"loads"| S

    C1 -->|"routes_to"| CU1
    C1 -->|"routes_to"| I
    C1 -->|"routes_to"| T
    C1 -->|"routes_to"| U
    C1 -->|"routes_to"| S

    D -->|"manages_state"| CU1
    D -->|"manages_state"| I
    D -->|"manages_state"| T
    D -->|"manages_state"| U
    D -->|"manages_state"| S

    E1 -->|"localizes"| CU1
    E1 -->|"localizes"| I
    E1 -->|"localizes"| T
    E1 -->|"localizes"| U
    E1 -->|"localizes"| S

    F -->|"supplies_data"| CU1
    F -->|"supplies_data"| I
    F -->|"supplies_data"| T
    F -->|"supplies_data"| U
    F -->|"supplies_data"| S

    T1 -.->|"verifies"| A
    T1 -.->|"verifies"| CU1
    T1 -.->|"verifies"| I
    T1 -.->|"verifies"| T
    T1 -.->|"verifies"| U
    T1 -.->|"verifies"| S

    %% Click Events
    click A "https://github.com/aitorpalleja/gestordivisas-myalbatross/blob/main/App.tsx"
    click CU1 "https://github.com/aitorpalleja/gestordivisas-myalbatross/blob/main/src/features/currencies/screens/CurrencyListScreen.tsx"
    click CU2 "https://github.com/aitorpalleja/gestordivisas-myalbatross/blob/main/src/features/currencies/screens/CurrencyDetailScreen.tsx"
    click CU3 "https://github.com/aitorpalleja/gestordivisas-myalbatross/blob/main/src/features/currencies/components/CurrencyCard.tsx"
    click I "https://github.com/aitorpalleja/gestordivisas-myalbatross/blob/main/src/features/insights/screens/InsightsScreen.tsx"
    click T "https://github.com/aitorpalleja/gestordivisas-myalbatross/blob/main/src/features/trends/screens/TrendsScreen.tsx"
    click U "https://github.com/aitorpalleja/gestordivisas-myalbatross/blob/main/src/features/user/screens/UserProfileScreen.tsx"
    click S "https://github.com/aitorpalleja/gestordivisas-myalbatross/blob/main/src/features/splash/screens/SplashScreen.tsx"
    click C1 "https://github.com/aitorpalleja/gestordivisas-myalbatross/blob/main/src/navigation/AppNavigator.tsx"
    click C2 "https://github.com/aitorpalleja/gestordivisas-myalbatross/blob/main/src/navigation/types.ts"
    click D "https://github.com/aitorpalleja/gestordivisas-myalbatross/blob/main/src/stores/themeStore.ts"
    click E1 "https://github.com/aitorpalleja/gestordivisas-myalbatross/blob/main/src/i18n/index.ts"
    click E2 "https://github.com/aitorpalleja/gestordivisas-myalbatross/tree/main/src/i18n/locales/"
    click F "https://github.com/aitorpalleja/gestordivisas-myalbatross/blob/main/src/services/apiClient.ts"
    click T1 "https://github.com/aitorpalleja/gestordivisas-myalbatross/tree/main/__tests__/"
    click T2 "https://github.com/aitorpalleja/gestordivisas-myalbatross/tree/main/__mocks__/"

    %% Styles
    classDef ui fill:#f9e79f,stroke:#7d6608,stroke-width:2px;
    classDef module fill:#aed6f1,stroke:#1b4f72,stroke-width:2px;
    classDef nav fill:#a9dfbf,stroke:#196f3d,stroke-width:2px;
    classDef state fill:#f9e79f,stroke:#7d6608,stroke-width:2px;
    classDef intl fill:#f5cba7,stroke:#935116,stroke-width:2px;
    classDef service fill:#d2b4de,stroke:#512e5f,stroke-width:2px;
    classDef testing fill:#f5b7b1,stroke:#78281f,stroke-width:2px;
```
