# gitzak/expo-app-react-native-coffee-app architecture

> Architecture diagram of the GitHub repository gitzak/expo-app-react-native-coffee-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/gitzak/expo-app-react-native-coffee-app
- Repository: https://github.com/gitzak/expo-app-react-native-coffee-app

## Overview

##### Project Type and Purpose
- This is a single-code-base mobile application built with React Native/Expo.
- It uses file-based routing to render screens, fetches coffee data from a remote API, and applies custom theming and design via shared components.

##### File Structure
- Top-level “app” directory: contains screen components and layout (`_layout.tsx`), file-based routing (`index.tsx`, `coffee/[id].tsx`).
- “components”: reusable UI pieces (Card, CoffeeCard, ThemedText).
- “hooks”: business logic hooks (`useFetchQuery` for data fetching, `useThemeColors` for theming).
- “assets”: fonts & images packaged with the app.

##### README for Insights
- Built with Expo (so you have an Expo runtime, bundler, and optional native modules).
- File-based router powering navigation.
- No backend code here—data comes from external coffee-store API.

##### Main Components & Their Relationships
a. Mobile Client (Expo App)
- Screens:
– Home screen (app/index.tsx)
– Coffee detail screen (app/coffee/[id].tsx)
- Layout: Common wrapper (_layout.tsx)
- UI Components: Card, CoffeeCard, ThemedText, others
- Hooks/Data Layer: useFetchQuery (calls REST API), useThemeColors
- Assets: images & fonts
b. External Services
- Coffee Data API (REST endpoint)
- Optional Analytics / Crash Reporting (e.g., Expo’s services)
c. Platform & Build Tools
- Expo runtime & bundler (Metro)
- VSCode / CLI (npm, eas.json for EAS builds)

##### Architectural Patterns & Design Principles
- Separation of concerns: UI vs. data fetching vs. styling vs. navigation.
- File-based routing = navigation mapping.
- Custom hooks encapsulate side effects (data + theme).
- Component reusability: small Card components used across screens.
- Constants for design tokens ensure consistency.

- Inside, subdivide into layers (top to bottom):
1. Navigation/File-Based Routing
2. Screen Components
3. Reusable Components (Card, CoffeeCard, ThemedText)
4. Hooks/Data Layer
5. Constants & Assets
- UseFetchQuery → HTTP GET → API
- At the bottom or side, add “Expo Services” (optional) for analytics, builds.
- User taps Screen → triggers Hooks → fetches data → returns JSON → passes to components → renders UI.
- Blue for UI layers, green for data layers, orange for external services, gray for assets/constants.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Expo App (React Native)"
        subgraph "Navigation / File-Based Routing"
            Layout["Layout (_layout.tsx)"]:::ui
        end
        subgraph "Screens"
            Home["Home Screen"]:::ui
            Detail["Coffee Detail Screen"]:::ui
        end
        subgraph "Reusable UI Components"
            Card["Card Component"]:::ui
            CoffeeCard["CoffeeCard Component"]:::ui
            ThemedText["ThemedText Component"]:::ui
        end
        subgraph "Hooks / Data Layer"
            FetchHook["useFetchQuery"]:::data
            ThemeHook["useThemeColors"]:::data
        end
        subgraph "Constants & Assets"
            Colors["Color Tokens"]:::const
            Shadows["Shadow Tokens"]:::const
            Fonts["Fonts"]:::const
            Images["Images"]:::const
        end
    end

    API["Coffee Store REST API"]:::external

    subgraph "Expo Services & Build Tools"
        ExpoRuntime["Expo Runtime"]:::external
        EAS["EAS Build Config"]:::external
    end

    Layout --> Home
    Layout --> Detail

    Home -->|uses| FetchHook
    Detail -->|uses| FetchHook
    Home -->|uses| ThemeHook
    Detail -->|uses| ThemeHook

    Home -->|renders| CoffeeCard
    Detail -->|renders| Card
    CoffeeCard -->|uses| ThemedText
    Card -->|uses| ThemedText

    FetchHook -->|GET /coffees| API
    ThemeHook --> Colors
    ThemeHook --> Shadows

    ExpoRuntime --> Layout
    EAS --> ExpoRuntime

    classDef ui fill:#D0E8FF,stroke:#0366D6
    classDef data fill:#DFFFE0,stroke:#228B22
    classDef external fill:#FFE0B2,stroke:#FF8C00
    classDef const fill:#E0E0E0,stroke:#A9A9A9

    click Layout "https://github.com/gitzak/expo-app-react-native-coffee-app/blob/main/app/_layout.tsx"
    click Home "https://github.com/gitzak/expo-app-react-native-coffee-app/blob/main/app/index.tsx"
    click Detail "https://github.com/gitzak/expo-app-react-native-coffee-app/blob/main/app/coffee/[id].tsx"
    click Card "https://github.com/gitzak/expo-app-react-native-coffee-app/blob/main/components/Card.tsx"
    click CoffeeCard "https://github.com/gitzak/expo-app-react-native-coffee-app/blob/main/components/Coffee/CoffeeCard.tsx"
    click ThemedText "https://github.com/gitzak/expo-app-react-native-coffee-app/blob/main/components/ThemedText.tsx"
    click FetchHook "https://github.com/gitzak/expo-app-react-native-coffee-app/blob/main/hooks/useFetchQuery.ts"
    click ThemeHook "https://github.com/gitzak/expo-app-react-native-coffee-app/blob/main/hooks/useThemeColors.ts"
    click Colors "https://github.com/gitzak/expo-app-react-native-coffee-app/blob/main/constants/Colors.ts"
    click Shadows "https://github.com/gitzak/expo-app-react-native-coffee-app/blob/main/constants/Shadows.ts"
    click Fonts "https://github.com/gitzak/expo-app-react-native-coffee-app/tree/main/assets/fonts/"
    click Images "https://github.com/gitzak/expo-app-react-native-coffee-app/tree/main/assets/images/"
    click ExpoRuntime "https://github.com/gitzak/expo-app-react-native-coffee-app/blob/main/app.json"
    click EAS "https://github.com/gitzak/expo-app-react-native-coffee-app/blob/main/eas.json"
```
