# aya-alsakkaf/rn-expo-router-navigation-prac architecture

> Architecture diagram of the GitHub repository aya-alsakkaf/rn-expo-router-navigation-prac, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aya-alsakkaf/rn-expo-router-navigation-prac
- Repository: https://github.com/aya-alsakkaf/rn-expo-router-navigation-prac

## Overview

##### Project type and purpose
- This is a React Native mobile application built with Expo and the Expo Router (file-based routing).
- Its primary function is to display a list of products (from a local data module) and allow navigation to product details.

##### File structure
- Top-level:
– app/ – contains entry point, layout, and route files
– components/ – reusable UI components (ProductList, ProductItem)
– data/ – product data source (products.ts)
– assets/ – static assets (fonts, images)
– config: app.json, tsconfig.json, eslint.config.js
- Routing pattern:
– app/index.tsx → home screen (probably product list)
– app/product/_layout.tsx → layout wrapper for product screens
– app/product/ProductDetails.tsx → detail screen

##### README for additional insights
- Confirms usage of file-based routing via Expo Router.
- No external backend; all data is local.

1. Expo Dev Server / Metro Bundler (development environment)
2. Mobile App (React Native + Expo runtime)
3. Expo Router (file-based navigation layer)
4. Screens:
– HomeScreen (app/index.tsx)
– ProductListScreen (could be same as Home)
– ProductDetailsScreen (app/product/ProductDetails.tsx)
5. UI Components (components/ProductList.tsx, ProductItem.tsx)
6. Local Data Store (data/products.ts)
7. Static Assets (assets/images, assets/fonts)
8. Native Device (iOS Simulator, Android Emulator, or Expo Go)

- Mobile App ↔ Expo Dev Server: bundler & live reload
- Mobile App → Expo Router: resolves URL → renders matching Screen
- Screens → UI Components: compose UI
- Screens → Local Data Store: read product data
- Screens → Static Assets: load images & fonts
- User (on device) → Screens: touch events trigger navigation

c. Architectural patterns and design principles:
- Component-based architecture (atomic UI components)
- File-based routing for navigation
- Single-source data (local module for products)
- Separation of concerns: routing, presentation (screens), data, assets

d. Technologies and frameworks:
- React Native + Expo runtime
- Expo Router for navigation
- TypeScript (tsconfig.json)
- Metro Bundler (built into Expo)
- ESLint for code quality

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Device and User
    User["User"]:::device -->|interacts via taps| MobileApp["Mobile App\n(React Native + Expo Runtime)"]:::runtime

    %% Development Server
    ExpoServer["Metro Bundler\n& Expo Dev Server"]:::server
    ExpoServer <-->|bundles & live reload| MobileApp

    %% Navigation Layer
    MobileApp --> ExpoRouter["Expo Router\n(file-based routing)"]:::router

    %% Application Layouts and Screens
    subgraph "App Routing" 
        direction TB
        RootLayout["Root Layout"]:::module
        ProductRouteLayout["Product Route Layout"]:::module
        RootLayout --> HomeScreen["HomeScreen\n(app/index.tsx)"]:::screen
        RootLayout --> ProductRouteLayout
        ProductRouteLayout --> ProductDetailsScreen["ProductDetailsScreen\n(app/product/ProductDetails.tsx)"]:::screen
    end

    %% UI Components
    subgraph "UI Components" 
        direction TB
        ProductList["ProductList"]:::component
        ProductItem["ProductItem"]:::component
    end
    HomeScreen -->|renders| ProductList
    ProductList -->|uses| ProductItem
    ProductDetailsScreen -->|renders| ProductItem

    %% Data Module
    LocalData["Local Data Store\n(data/products.ts)"]:::data
    HomeScreen -->|reads data| LocalData
    ProductDetailsScreen -->|reads data| LocalData

    %% Static Assets
    subgraph "Static Assets"
        direction TB
        Images["Images"]:::asset
        Fonts["Fonts"]:::asset
    end
    HomeScreen -->|loads assets| Images
    HomeScreen -->|loads assets| Fonts
    ProductDetailsScreen -->|loads assets| Images
    ProductDetailsScreen -->|loads assets| Fonts

    %% Configuration Files
    subgraph "Configurations"
        direction TB
        AppConfig["app.json"]:::config
        TSConfig["tsconfig.json"]:::config
        ESLintConfig["eslint.config.js"]:::config
        PackageJSON["package.json"]:::config
        README["README.md"]:::config
    end

    %% Click Events
    click ExpoRouter "https://github.com/aya-alsakkaf/rn-expo-router-navigation-prac/blob/main/app/_layout.tsx"
    click RootLayout "https://github.com/aya-alsakkaf/rn-expo-router-navigation-prac/blob/main/app/_layout.tsx"
    click ProductRouteLayout "https://github.com/aya-alsakkaf/rn-expo-router-navigation-prac/blob/main/app/product/_layout.tsx"
    click HomeScreen "https://github.com/aya-alsakkaf/rn-expo-router-navigation-prac/blob/main/app/index.tsx"
    click ProductDetailsScreen "https://github.com/aya-alsakkaf/rn-expo-router-navigation-prac/blob/main/app/product/ProductDetails.tsx"
    click ProductList "https://github.com/aya-alsakkaf/rn-expo-router-navigation-prac/blob/main/components/ProductList.tsx"
    click ProductItem "https://github.com/aya-alsakkaf/rn-expo-router-navigation-prac/blob/main/components/ProductItem.tsx"
    click LocalData "https://github.com/aya-alsakkaf/rn-expo-router-navigation-prac/blob/main/data/products.ts"
    click Images "https://github.com/aya-alsakkaf/rn-expo-router-navigation-prac/tree/main/assets/images"
    click Fonts "https://github.com/aya-alsakkaf/rn-expo-router-navigation-prac/tree/main/assets/fonts"
    click AppConfig "https://github.com/aya-alsakkaf/rn-expo-router-navigation-prac/blob/main/app.json"
    click TSConfig "https://github.com/aya-alsakkaf/rn-expo-router-navigation-prac/blob/main/tsconfig.json"
    click ESLintConfig "https://github.com/aya-alsakkaf/rn-expo-router-navigation-prac/blob/main/eslint.config.js"
    click PackageJSON "https://github.com/aya-alsakkaf/rn-expo-router-navigation-prac/blob/main/package.json"
    click README "https://github.com/aya-alsakkaf/rn-expo-router-navigation-prac/blob/main/README.md"

    %% Styles
    classDef device fill:#f9f,stroke:#333,stroke-width:1px
    classDef runtime fill:#b2ebf2,stroke:#333,stroke-width:1px
    classDef server fill:#c8e6c9,stroke:#333,stroke-width:1px
    classDef router fill:#ffe0b2,stroke:#333,stroke-width:1px
    classDef module fill:#bbdefb,stroke:#333,stroke-width:1px
    classDef screen fill:#f8bbd0,stroke:#333,stroke-width:1px
    classDef component fill:#d1c4e9,stroke:#333,stroke-width:1px
    classDef data fill:#e1bee7,stroke:#333,stroke-width:1px
    classDef asset fill:#ffcc80,stroke:#333,stroke-width:1px
    classDef config fill:#eeeeee,stroke:#333,stroke-width:1px
```
