# orelchalfon/tutiai architecture

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

- Interactive diagram: https://gitdiagram.com/orelchalfon/tutiai
- Repository: https://github.com/orelchalfon/tutiai

## Overview

##### Project type and purpose
- This is a cross-platform mobile (and web) application scaffolded with Expo’s “create-expo-app.”
- It uses React Native + Expo SDK for UI and device APIs, and employs file-based routing under the **app/** directory.

##### File structure
- Top-level directories/files:
- **app/** – the routing and screen definitions (with a `(tabs)` subfolder for tab-based navigation).
- **assets/images/** – static image assets.
- **constants/** – theme definitions.
- **scripts/** – utility scripts (e.g., reset-project).
- Config/build files: **app.json**, **tsconfig.json**, **eslint.config.js**, **package.json**, **pnpm-*.yaml**.
- No backend code; this is strictly the client side.

##### README for additional insights
- Confirms Expo CLI is used for local development (Metro Bundler → bundling JS/TSX → serving to devices).
- File-based routing (React Navigation under the hood).
- Offers emulator/simulator/Expo Go as targets.

##### Main components and their interactions
a. Developer Toolchain
- Terminal & IDE (VS Code) → runs `npx expo start`
- Expo CLI & Metro Bundler
b. Runtime Hosts
- Android emulator / iOS simulator / Expo Go / Web browser
c. The React Native App
- Navigation Layer (file-based routes in **app/**)
- Screen Components (TSX files under **app/**)
- UI Component Library (**components/**)
- Theming & Styling (**constants/** + **hooks/**)
- Asset Store (**assets/images/**)
d. External/Native Modules
- Expo SDK modules (camera, file-system, sensors, etc., if used)
- Third-party libraries from node_modules

##### Architectural patterns and design principles
- Modular separation: screens vs. generic components vs. utilities/hooks.
- File-based routing implements a declarative navigation graph.
- Theme & hook abstraction centralizes styling decisions.
- Static assets are co-located under **assets/** for bundling.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Developer Environment
    subgraph "Developer Environment"
        direction TB
        DevWorkstation["Developer Workstation<br/>(IDE & Terminal)"]:::dev
        DevWorkstation -->|"runs expo start"| ExpoCLI
    end

    %% Build Pipeline
    subgraph "Build Pipeline"
        direction TB
        ExpoCLI["Expo CLI"]:::build
        MetroBundler["Metro Bundler"]:::build
        ExpoCLI --> MetroBundler
    end

    %% Runtime Hosts
    subgraph "Runtime Hosts"
        direction TB
        AndroidEmulator["Android Emulator"]:::runtime
        iOSSimulator["iOS Simulator"]:::runtime
        ExpoGo["Expo Go"]:::runtime
        WebBrowser["Web Browser"]:::runtime
        MetroBundler --> AndroidEmulator
        MetroBundler --> iOSSimulator
        MetroBundler --> ExpoGo
        MetroBundler --> WebBrowser
    end

    %% React Native App
    subgraph "React Native App" 
        direction TB
        subgraph "Navigation Layer"
            direction TB
            NavLayer["Navigation Layer<br/>(file-based routing)"]:::nav
            NavLayer --> RootLayout
            NavLayer --> TabLayout
            NavLayer --> ModalScreen
        end

        subgraph "Screen Components"
            direction TB
            ExploreScreen["Screen: explore.tsx"]:::ui
            HomeScreen["Screen: index.tsx"]:::ui
            ModalScreen["Screen: modal.tsx"]:::ui
        end

        subgraph "UI Components Library"
            direction TB
            Collapsible["Collapsible"]:::ui
            IconSymbol["Icon Symbol"]:::ui
            ThemedText["Themed Text"]:::ui
            ThemedView["Themed View"]:::ui
            ExternalLink["External Link"]:::ui
            HapticTab["Haptic Tab"]:::ui
            HelloWave["Hello Wave"]:::ui
        end

        subgraph "Theming & Hooks"
            direction TB
            ThemeConstants["Theme Constants"]:::hooks
            ColorSchemeNative["use-color-scheme.ts"]:::hooks
            ColorSchemeWeb["use-color-scheme.web.ts"]:::hooks
            ThemeColorHook["use-theme-color.ts"]:::hooks
        end

        subgraph "Assets"
            direction TB
            AssetStore["Asset Store (images)"]:::assets
        end

        %% Internal flows
        AndroidEmulator -->|renders| NavLayer
        iOSSimulator -->|renders| NavLayer
        ExpoGo -->|renders| NavLayer
        WebBrowser -->|renders| NavLayer

        NavLayer --> ExploreScreen
        NavLayer --> HomeScreen
        NavLayer --> ModalScreen

        ExploreScreen --> Collapsible
        ExploreScreen --> IconSymbol
        ExploreScreen --> ThemedText
        HomeScreen --> HapticTab
        ModalScreen --> HelloWave

        Collapsible --> ThemeConstants
        IconSymbol --> ThemeColorHook
        ThemedText --> ColorSchemeNative
        ThemedText --> ColorSchemeWeb
        ThemedView --> ThemeColorHook
    end

    %% Config Files
    subgraph "Project Configurations"
        direction TB
        AppJSON["app.json"]:::config
        TSConfig["tsconfig.json"]:::config
        PackageJSON["package.json"]:::config
        ResetScript["reset-project.js"]:::config
    end

    DevWorkstation --> ResetScript
    DevWorkstation --> AppJSON
    DevWorkstation --> TSConfig
    DevWorkstation --> PackageJSON

    %% Click Events
    click NavLayer "https://github.com/orelchalfon/tutiai/tree/main/app/"
    click RootLayout "https://github.com/orelchalfon/tutiai/blob/main/app/_layout.tsx"
    click TabLayout "https://github.com/orelchalfon/tutiai/blob/main/app/(tabs)/_layout.tsx"
    click ExploreScreen "https://github.com/orelchalfon/tutiai/blob/main/app/(tabs)/explore.tsx"
    click HomeScreen "https://github.com/orelchalfon/tutiai/blob/main/app/(tabs)/index.tsx"
    click ModalScreen "https://github.com/orelchalfon/tutiai/blob/main/app/modal.tsx"
    click Collapsible "https://github.com/orelchalfon/tutiai/blob/main/components/ui/collapsible.tsx"
    click IconSymbol "https://github.com/orelchalfon/tutiai/blob/main/components/ui/icon-symbol.tsx"
    click ThemedText "https://github.com/orelchalfon/tutiai/blob/main/components/themed-text.tsx"
    click ThemedView "https://github.com/orelchalfon/tutiai/blob/main/components/themed-view.tsx"
    click ExternalLink "https://github.com/orelchalfon/tutiai/blob/main/components/external-link.tsx"
    click HapticTab "https://github.com/orelchalfon/tutiai/blob/main/components/haptic-tab.tsx"
    click HelloWave "https://github.com/orelchalfon/tutiai/blob/main/components/hello-wave.tsx"
    click ThemeConstants "https://github.com/orelchalfon/tutiai/blob/main/constants/theme.ts"
    click ColorSchemeNative "https://github.com/orelchalfon/tutiai/blob/main/hooks/use-color-scheme.ts"
    click ColorSchemeWeb "https://github.com/orelchalfon/tutiai/blob/main/hooks/use-color-scheme.web.ts"
    click ThemeColorHook "https://github.com/orelchalfon/tutiai/blob/main/hooks/use-theme-color.ts"
    click AssetStore "https://github.com/orelchalfon/tutiai/tree/main/assets/images/"
    click AppJSON "https://github.com/orelchalfon/tutiai/blob/main/app.json"
    click TSConfig "https://github.com/orelchalfon/tutiai/blob/main/tsconfig.json"
    click PackageJSON "https://github.com/orelchalfon/tutiai/blob/main/package.json"
    click ResetScript "https://github.com/orelchalfon/tutiai/blob/main/scripts/reset-project.js"

    %% Styles
    classDef dev fill:#D0E6FF,stroke:#0366d6,color:#000;
    classDef build fill:#D0FFD6,stroke:#2e7d32,color:#000;
    classDef runtime fill:#FFE0B2,stroke:#ef6c00,color:#000;
    classDef nav fill:#C8E6C9,stroke:#388e3c,color:#000;
    classDef ui fill:#A5D6A7,stroke:#2e7d32,color:#000;
    classDef hooks fill:#81C784,stroke:#1b5e20,color:#000;
    classDef assets fill:#C5E1A5,stroke:#558b2f,color:#000;
    classDef config fill:#F0F4C3,stroke:#9e9d24,color:#000;
```
