# dannyhw/react-native-storybook-starter architecture

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

- Interactive diagram: https://gitdiagram.com/dannyhw/react-native-storybook-starter
- Repository: https://github.com/dannyhw/react-native-storybook-starter

## Overview

##### Main Components

a. Development Environment Layer:
- Metro Bundler (React Native packager)
- Storybook Server
- Yarn Package Manager

b. Platform Layers:
- iOS Runtime Environment
- Android Runtime Environment
- Web Browser Environment (via react-native-web)

c. Application Components:
- React Native Core
- Component Library (starting with Button component)
- Storybook Integration
- Testing Infrastructure (Jest)

**┌─────────────────────────────────────────┐**
- Development Environment                 │
- ┌─────────┐ ┌──────────┐ ┌──────────┐  │
- Yarn   │ │  Metro   │ │Storybook │  │
- Package │ │ Bundler  │ │  Server  │  │
- ┘ └──────────┘ └──────────┘  │
- ┘

**┌─────────────────────────────────────────┐**
- Application Core                        │
- ┌─────────────┐ ┌───────────────────┐  │
- React Native│ │ Component Library  │  │
- Core     │ │  - Button         │  │
- ┘ └───────────────────┘  │
- ┘

**┌───────────┐ ┌───────────┐ ┌───────────┐**
- iOS     │ │ Android   │ │   Web     │
- Runtime   │ │ Runtime   │ │ Browser   │
- ┘ └───────────┘ └───────────┘

##### Connection Flows

- Metro Bundler → Platform Runtimes (bundle delivery)
- Storybook Server → All Platforms (component preview)
- Component Library → Storybook (story generation)

##### Additional Details

- File structure organization
- Build processes
- Development workflows
- Testing procedures

- The dual nature of the project (development/preview via Storybook and actual app runtime)
- Cross-platform capabilities
- Component development workflow
- The relationship between Metro bundler and Storybook

Remember to include version numbers for key dependencies:
- React Native: 0.75.3
- Storybook: 8.x
- React Native Web Addon

This will help other developers understand the compatibility requirements and technical constraints of the system.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef devtools fill:#2196F3,stroke:#1565C0,color:white
    classDef core fill:#4CAF50,stroke:#388E3C,color:white
    classDef platform fill:#FF9800,stroke:#F57C00,color:white
    classDef storybook fill:#9C27B0,stroke:#7B1FA2,color:white
    classDef testing fill:#795548,stroke:#5D4037,color:white

    %% Development Environment Layer
    subgraph DevEnv[Development Environment]
        Yarn[Yarn Package Manager]:::devtools
        Metro[Metro Bundler]:::devtools
        Storybook[Storybook Server]:::storybook
    end

    %% Application Core Layer
    subgraph AppCore[Application Core]
        RNCore[React Native Core]:::core
        CompLib[Component Library]:::core
        Testing[Testing Infrastructure]:::testing
    end

    %% Platform Layer
    subgraph Platforms[Platform Runtimes]
        iOS[iOS Runtime]:::platform
        Android[Android Runtime]:::platform
        Web[Web Browser]:::platform
    end

    %% Connections
    Metro --> iOS
    Metro --> Android
    Metro --> Web
    Storybook --> iOS
    Storybook --> Android
    Storybook --> Web
    CompLib --> Storybook
    Testing --> CompLib
    RNCore --> CompLib

    %% Click Events
    click Metro "https://github.com/dannyhw/react-native-storybook-starter/blob/main/metro.config.js"
    click Storybook "https://github.com/dannyhw/react-native-storybook-starter/tree/main/.storybook/"
    click Yarn "https://github.com/dannyhw/react-native-storybook-starter/tree/main/.yarn/"
    click iOS "https://github.com/dannyhw/react-native-storybook-starter/tree/main/ios/"
    click Android "https://github.com/dannyhw/react-native-storybook-starter/tree/main/android/"
    click CompLib "https://github.com/dannyhw/react-native-storybook-starter/tree/main/components/"
    click Testing "https://github.com/dannyhw/react-native-storybook-starter/tree/main/__tests__/"
    click RNCore "https://github.com/dannyhw/react-native-storybook-starter/blob/main/App.tsx"

    %% Legend
    subgraph Legend
        Dev[Development Tools]:::devtools
        Core[Core Components]:::core
        Plat[Platform Runtimes]:::platform
        Story[Storybook Integration]:::storybook
        Test[Testing Infrastructure]:::testing
    end
```
