# bboatman/fumiesreact architecture

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

- Interactive diagram: https://gitdiagram.com/bboatman/fumiesreact
- Repository: https://github.com/bboatman/fumiesreact

## Overview

##### Project Type & Purpose
- This is a mobile application built with React Native, targeting Android and iOS. The main purpose is to deliver a cross-platform mobile experience, as reflected by the dual platform folders (android and ios) and the React Native code in files like App.tsx and index.js.
- The project uses a porting approach to adapt the fumies project functionalities to the native mobile environment.

##### Key Components
a. UI/Presentation Layer:
- "src/screens" – contains individual screens such as AllPerfumes.tsx and Perfume.tsx.
- "src/components" – holds smaller, re-usable UI components and route configurations (routes.ts) governing navigation.

b. State & Application Logic:
- "src/app/store.ts" – likely sets up application-wide state management.
- "src/slices" – includes domain-specific state slices (e.g., perfume.ts) which infer a Redux (or Redux Toolkit) pattern for managing application state.

c. Native Platform Integration:
- Android ("android" directory) – contains native Android configurations, build files, and Java classes (e.g., MainActivity.java, MainApplication.java). Also includes specific debugging and release configurations.
- iOS ("ios" directory) – houses the Xcode project, source files, and configuration files (e.g., AppDelegate, Info.plist).
- Bridge between JavaScript and native code is implicit in the project’s structure, as custom native modules might be implemented or bridged in the Android and iOS subdirectories.

d. Assets and Configuration:
- "assets" – provides media and animation assets (like splash.lottie.json), influencing the visual and interactive parts of the app.
- Project configuration files such as package.json, babel.config.js, and metro.config.js which define dependencies, build behaviours, and bundler settings.

##### Relationships & Interactions
- The React Native bundle (initiated at index.js) serves as the entry point that integrates the UI layers with the underlying state logic.
- The UI layer (screens and components) dispatches actions to the state management store (set up in store.ts), and state changes influence component rendering.
- The bridge (React Native’s native modules) ties in the native code present in the Android and iOS directories, facilitating platform-specific operations.
- Configuration and asset files support both the development and production environments, influencing build processes and look-and-feel.

##### Architectural Patterns & Principles
- Separation of Concerns: Notice the clear distinction between presentation (screens/components), state management (store and slices), and platform-specific native code.
- Use of a Flux/Redux-like pattern with slices to encapsulate domain-specific logic.
- Cross-platform architecture inherent in React Native, as the shared JavaScript code is abstracted from native implementation details.
- Modular file structure aiding scalability and maintainability.

## Diagram (Mermaid)

```mermaid
flowchart TD
    Main["FumiesReact Mobile App"]:::main
    RN["React Native Bundle (index.js)"]:::rn

    Main --> RN

    subgraph "UI Layer"
        UI1["Screens"]:::ui
        UI2["Components & Routing"]:::ui
    end

    subgraph "State Management"
        ST["Store"]:::state
        SL["State Slices"]:::state
    end

    subgraph "Native Integration"
        subgraph Android
            A1["MainActivity"]:::native
            A2["MainApplication"]:::native
        end
        subgraph iOS
            I1["AppDelegate"]:::native
            I2["Info.plist"]:::native
        end
    end

    subgraph "Assets & Configurations"
        AS["splash.lottie.json"]:::config
        PK["package.json"]:::config
        BA["babel.config.js"]:::config
        ME["metro.config.js"]:::config
        AC["app.json"]:::config
    end

    %% Relationships
    RN -->|"initiates UI"| UI1
    RN -->|"initiates UI"| UI2
    RN -->|"sets up State"| ST
    RN -->|"bridges to Native"| A1
    RN -->|"bridges to Native"| I1

    UI1 -->|"dispatchAction"| ST
    ST -->|"updateView"| UI2

    %% Assets & Configurations support the overall app
    AS -->|"support assets"| RN
    PK --- BA
    PK --- ME
    PK --- AC

    %% Click Events
    click UI1 "https://github.com/bboatman/fumiesreact/tree/main/Fumies/src/screens/"
    click UI2 "https://github.com/bboatman/fumiesreact/blob/main/Fumies/src/components/routes.ts"
    click ST "https://github.com/bboatman/fumiesreact/blob/main/Fumies/src/app/store.ts"
    click SL "https://github.com/bboatman/fumiesreact/blob/main/Fumies/src/slices/perfume.ts"
    click A1 "https://github.com/bboatman/fumiesreact/blob/main/Fumies/android/app/src/main/java/com/fumies/MainActivity.java"
    click A2 "https://github.com/bboatman/fumiesreact/blob/main/Fumies/android/app/src/main/java/com/fumies/MainApplication.java"
    click I1 "https://github.com/bboatman/fumiesreact/blob/main/Fumies/ios/Fumies/AppDelegate.h"
    click I2 "https://github.com/bboatman/fumiesreact/blob/main/Fumies/ios/Fumies/Info.plist"
    click AS "https://github.com/bboatman/fumiesreact/blob/main/Fumies/assets/splash.lottie.json"
    click PK "https://github.com/bboatman/fumiesreact/blob/main/Fumies/package.json"
    click BA "https://github.com/bboatman/fumiesreact/blob/main/Fumies/babel.config.js"
    click ME "https://github.com/bboatman/fumiesreact/blob/main/Fumies/metro.config.js"
    click AC "https://github.com/bboatman/fumiesreact/blob/main/Fumies/app.json"

    %% Styles
    classDef main fill:#cff,stroke:#333,stroke-width:2px;
    classDef rn fill:#fc9,stroke:#333,stroke-width:2px;
    classDef ui fill:#f9f,stroke:#333,stroke-width:2px;
    classDef state fill:#ff9,stroke:#333,stroke-width:2px;
    classDef native fill:#9f9,stroke:#333,stroke-width:2px;
    classDef config fill:#9ff,stroke:#333,stroke-width:2px;
```
