# kirbi96/appleoffortune architecture

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

- Interactive diagram: https://gitdiagram.com/kirbi96/appleoffortune
- Repository: https://github.com/kirbi96/appleoffortune

## Overview

##### Project type and purpose
- This is a React Native mobile application (“appleoffortune”), a slot-machine game targeting both Android and iOS.
- It contains platform-specific native projects (android/, ios/) plus a shared JavaScript/TypeScript codebase (src/).

##### File structure
- Top-level:
- android/ – Android native project (Gradle build scripts, Java entry points, resource folders).
- ios/ – iOS native project (Xcode workspace, Objective-C entry points, asset catalogs).
- src/ – Shared React Native code:
· components/ – reusable UI widgets
· screens/ – screen components (Home, etc.)
· static/ – style definitions, constants, text
· utils/ – helper functions (responsiveFontSize, pluralize)
- index.js – JS entry point that registers the root App component.
- babel.config.js, metro.config.js – bundler/transpiler configuration.
- __tests__/ – unit tests (Jest).
- No separate backend—game logic and state live entirely in the client.

##### README
- Confirms the purpose: “apple of fortune slot game.”
- No further architectural notes, so infer architecture from code organization.

a. Main components
- Presentation Layer (React Native JS)
- Game Logic Layer (stateful components + utils)
- Native Bridge/Runtime (Metro Bundler + React Native runtime)
- Platform Runtimes (Android JVM + iOS Objective-C/Swift)
- Build Toolchain (Gradle for Android, Xcode/Pods for iOS)
- Testing Layer (Jest)
b. Relationships & interactions
- Presentation Layer → Native Bridge/Runtime → Platform Runtimes
- Build Toolchain → Native Projects (android/, ios/)
- Metro Bundler sits between JS code and Native Bridge
c. Architectural patterns
- Component-based UI (React)
- Single codebase for cross-platform UI/business logic
- Platform adapters (native entry points in MainActivity.java/AppDelegate)
d. Key technologies
- React Native
- Metro Bundler
- Babel
- Android (Gradle, Java)
- iOS (Xcode, Objective-C, CocoaPods)
- Jest (testing)
##### Detailed call-outs
- Call out index.js as the bootstrap.
- MainActivity.java/AppDelegate.m as boundary between JS and native.
- Static/ folder as a resource bundle consumed by code.
- __tests__ off to the side illustrating unit test coverage.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Presentation Layer
    subgraph "Presentation Layer (React Native UI)"
        direction TB
        IDX["index.js"]:::jsModule
        APP["src/App.tsx"]:::jsModule
        COMPS["src/components/"]:::jsModule
        SCREENS["src/screens/"]:::jsModule
    end

    %% Game Logic Layer
    subgraph "Game Logic Layer"
        direction TB
        HOME["src/screens/Main/Home/Home.tsx"]:::jsModule
        PLURAL["src/utils/pluralize.ts"]:::jsModule
        RFONT["src/utils/responsiveFontSize.ts"]:::jsModule
    end

    %% Asset Layer
    subgraph "Asset Layer"
        direction TB
        STATIC["src/static/"]:::jsModule
        AND_RES["android/app/src/main/res/"]:::native
        IOS_ACC["ios/rntsPizza/Images.xcassets/"]:::native
    end

    %% Native Bridge / Runtime
    subgraph "Native Bridge / Runtime"
        direction TB
        METRO["Metro Bundler"]:::tooling
        BABEL["Babel (babel.config.js/ts)"]:::tooling
        BRIDGE["React Native Bridge"]:::native
    end

    %% Platform Runtimes
    subgraph "Platform Runtimes"
        direction TB
        subgraph Android
            direction TB
            MA["MainActivity.java"]:::native
            MQ["MainApplication.java"]:::native
        end
        subgraph iOS
            direction TB
            AD_M["AppDelegate.m"]:::native
            AD_H["AppDelegate.h"]:::native
            MAINM["main.m"]:::native
        end
    end

    %% Build Toolchain
    subgraph "Build Toolchain"
        direction TB
        subgraph Android Build
            direction TB
            GRADEX["android/build.gradle"]:::tooling
            APPGRADLE["android/app/build.gradle"]:::tooling
            WRAPPER["android/gradle/wrapper/gradle-wrapper.properties"]:::tooling
            GRADLEW["android/gradlew & gradlew.bat"]:::tooling
            SETTINGS["android/settings.gradle"]:::tooling
        end
        subgraph iOS Build
            direction TB
            POD["ios/Podfile"]:::tooling
            XCODEPROJ["ios/rntsPizza.xcodeproj/"]:::tooling
        end
    end

    %% Testing Layer
    subgraph "Testing Layer (Jest)"
        direction TB
        TESTS["__tests__/App-test.js"]:::test
    end

    %% Relationships
    IDX -->|"boots| METRO
    METRO -->|"transpiles| BABEL
    BABEL -->|"feeds| BRIDGE
    APP -->|"renders| COMPS
    COMPS -->|"uses| SCREENS
    SCREENS -->|"invokes| HOME
    HOME -->|"calls| PLURAL
    HOME -->|"calls| RFONT
    HOME -->|"loads| STATIC
    STATIC -->|"packages| AND_RES
    STATIC -->|"packages| IOS_ACC
    BRIDGE -->|"bridges to| MA
    BRIDGE -->|"bridges to| MQ
    BRIDGE -->|"bridges to| AD_M
    BRIDGE -->|"bridges to| MAINM
    GRADEX -->|"builds| MA
    APPGRADLE -->|"builds| MQ
    WRAPPER -->|"wraps| GRADEX
    SETTINGS -->|"configures| GRADEX
    POD -->|"installs pods for| AD_M
    XCODEPROJ -->|"builds| AD_M
    TESTS -->|"tests| APP

    %% Click Events
    click IDX "https://github.com/kirbi96/appleoffortune/blob/main/index.js"
    click APP "https://github.com/kirbi96/appleoffortune/blob/main/src/App.tsx"
    click COMPS "https://github.com/kirbi96/appleoffortune/tree/main/src/components/"
    click SCREENS "https://github.com/kirbi96/appleoffortune/tree/main/src/screens/"
    click HOME "https://github.com/kirbi96/appleoffortune/blob/main/src/screens/Main/Home/Home.tsx"
    click PLURAL "https://github.com/kirbi96/appleoffortune/blob/main/src/utils/pluralize.ts"
    click RFONT "https://github.com/kirbi96/appleoffortune/blob/main/src/utils/responsiveFontSize.ts"
    click STATIC "https://github.com/kirbi96/appleoffortune/tree/main/src/static/"
    click AND_RES "https://github.com/kirbi96/appleoffortune/tree/main/android/app/src/main/res/"
    click IOS_ACC "https://github.com/kirbi96/appleoffortune/tree/main/ios/rntsPizza/Images.xcassets/"
    click METRO "https://github.com/kirbi96/appleoffortune/blob/main/metro.config.js"
    click BABEL "https://github.com/kirbi96/appleoffortune/blob/main/babel.config.js"
    click MA "https://github.com/kirbi96/appleoffortune/blob/main/android/app/src/main/java/com/rntspizza/MainActivity.java"
    click MQ "https://github.com/kirbi96/appleoffortune/blob/main/android/app/src/main/java/com/rntspizza/MainApplication.java"
    click AD_M "https://github.com/kirbi96/appleoffortune/blob/main/ios/rntsPizza/AppDelegate.m"
    click AD_H "https://github.com/kirbi96/appleoffortune/blob/main/ios/rntsPizza/AppDelegate.h"
    click MAINM "https://github.com/kirbi96/appleoffortune/blob/main/ios/rntsPizza/main.m"
    click GRADEX "https://github.com/kirbi96/appleoffortune/blob/main/android/build.gradle"
    click APPGRADLE "https://github.com/kirbi96/appleoffortune/blob/main/android/app/build.gradle"
    click WRAPPER "https://github.com/kirbi96/appleoffortune/blob/main/android/gradle/wrapper/gradle-wrapper.properties"
    click GRADLEW "https://github.com/kirbi96/appleoffortune/tree/main/android/gradlew"
    click SETTINGS "https://github.com/kirbi96/appleoffortune/blob/main/android/settings.gradle"
    click POD "https://github.com/kirbi96/appleoffortune/tree/main/ios/Podfile"
    click XCODEPROJ "https://github.com/kirbi96/appleoffortune/tree/main/ios/rntsPizza.xcodeproj/"
    click TESTS "https://github.com/kirbi96/appleoffortune/blob/main/__tests__/App-test.js"

    %% Styles
    classDef jsModule fill:#d0e7ff,stroke:#333,stroke-width:1px
    classDef native fill:#e2f0d9,stroke:#333,stroke-width:1px
    classDef tooling fill:#fff2cc,stroke:#333,stroke-width:1px
    classDef test fill:#fce4d6,stroke:#333,stroke-width:1px
```
