# chitrakshtarun/hexsplash architecture

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

- Interactive diagram: https://gitdiagram.com/chitrakshtarun/hexsplash
- Repository: https://github.com/chitrakshtarun/hexsplash

## Overview

##### Main Components
- Mobile Frontend (React Native/Expo App): Represent the main app, including screens (from the “app” folder), layout configurations, and UI components.
- Components & Modules: Highlight sub-components in the “components” directory (e.g., EditScreenInfo, PaletteImage, etc.) that build the user interface and handle interactions.
- Native Android Integration: Display the native Android layer (in the “android” folder) that integrates with React Native. This includes the Android project structure with its Gradle builds, MainActivity.kt, and configuration files that bootstrap the app on Android devices.
- External Libraries/Dependencies: List key libraries such as expo-router (for navigation), expo-linear-gradient (for backgrounds), react-native-reanimated (for animations), react-native-gesture-handler, react-native-view-shot, and react-native-share. These are not only external dependencies but also influence how data flows (e.g., for transitions or sharing functionalities).

##### Relationships and Interactions
- User interactions on various screens (handled by components) invoke functions that update state and eventually re-render the palette.

##### Architectural Patterns & Design Principles
- File-Based Routing: Emphasize how Expo’s file-based routing (located in the “app” directory) governs navigation between different screens.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        MF["Mobile Frontend (React Native/Expo App)"]:::frontend
        S1["Layout Screen (app/_layout.tsx)"]:::frontend
        S2["Generator Screen (app/generator.tsx)"]:::frontend
        S3["Home Screen (app/index.tsx)"]:::frontend
        S4["Settings Screen (app/settings.tsx)"]:::frontend
        S5["Share Palette Screen (app/sharepalette.tsx)"]:::frontend
        UI["UI Components (components)"]:::ui
    end

    %% Business Logic Layer
    subgraph "Business Logic"
        RL["Randomiser Logic (app/generator.tsx)"]:::logic
    end

    %% Assets & Constants
    subgraph "Assets & Constants"
        Assets["Assets (assets)"]:::assets
        Const["Constants (constants/Colors.ts)"]:::assets
    end

    %% Native Integration
    subgraph "Native Integration"
        Android["Android Native Integration"]:::native
    end

    %% External Dependencies
    subgraph "External Libraries"
        Libs["External Dependencies (package.json)"]:::external
    end

    %% User Interaction Node (Entry point)
    User["User Interaction"]:::user

    %% Relationships
    User -->|"taps"| MF
    MF -->|"navigates via file-based routing"| S1
    MF --> S2
    MF --> S3
    MF --> S4
    MF --> S5

    %% UI & Business Logic Interactions
    S2 -->|"triggers"| RL
    RL -->|"updates palette"| UI
    MF -->|"renders"| UI

    %% UI integration with External Libraries
    UI -->|"utilizes"| Libs

    %% Assets & Constants support UI
    Assets -->|"provide resources"| UI
    Const -->|"provide theme"| UI

    %% Expo Bridge Native Integration
    MF ---|"communicates via native bridge"| Android

    %% Styles
    classDef frontend fill:#CEF2FF,stroke:#007ACC,stroke-width:2px;
    classDef logic fill:#D2F8D2,stroke:#28A745,stroke-width:2px;
    classDef ui fill:#FFF7CC,stroke:#D4AC0D,stroke-width:2px;
    classDef assets fill:#FFE6CC,stroke:#D35400,stroke-width:2px;
    classDef native fill:#FFD6CC,stroke:#C0392B,stroke-width:2px;
    classDef external fill:#E6CCFF,stroke:#8E44AD,stroke-width:2px;
    classDef user fill:#F0F0F0,stroke:#7F8C8D,stroke-width:2px;

    %% Click Events
    click MF "https://github.com/chitrakshtarun/hexsplash/tree/main/app"
    click S1 "https://github.com/chitrakshtarun/hexsplash/blob/main/app/_layout.tsx"
    click S2 "https://github.com/chitrakshtarun/hexsplash/blob/main/app/generator.tsx"
    click S3 "https://github.com/chitrakshtarun/hexsplash/blob/main/app/index.tsx"
    click S4 "https://github.com/chitrakshtarun/hexsplash/blob/main/app/settings.tsx"
    click S5 "https://github.com/chitrakshtarun/hexsplash/blob/main/app/sharepalette.tsx"
    click UI "https://github.com/chitrakshtarun/hexsplash/tree/main/components"
    click RL "https://github.com/chitrakshtarun/hexsplash/blob/main/app/generator.tsx"
    click Assets "https://github.com/chitrakshtarun/hexsplash/tree/main/assets"
    click Const "https://github.com/chitrakshtarun/hexsplash/blob/main/constants/Colors.ts"
    click Android "https://github.com/chitrakshtarun/hexsplash/tree/main/android"
    click Libs "https://github.com/chitrakshtarun/hexsplash/blob/main/package.json"
```
