# hiteshchoudhary/react-native-projects architecture

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

- Interactive diagram: https://gitdiagram.com/hiteshchoudhary/react-native-projects
- Repository: https://github.com/hiteshchoudhary/react-native-projects

## Overview

##### Project type and purpose
- This repository is a “React Native Learning Guide” containing a series of standalone sample mobile apps (Awesome01, bgChanger04, shopping10, spotifymusic08, appwriteauth11, etc.).
- Each subfolder is a self-contained React Native project that exercises a particular feature (UI styling, navigation, authentication, asset handling, state management).

##### File structure
- At the top level you see multiple folders, each named with a project and number, e.g., “shopping10”, “appwriteauth11”, “tictactoe07”.
- Inside each project:
- package.json, tsconfig.json, babel.config.js, metro.config.js – configuration for the JavaScript toolchain and bundler
- index.js or App.tsx at root – entry point for the JS app
- /android and /ios – native projects and platform-specific code (Java, Gradle, Xcode project)
- __tests__ – unit/JS tests
- src or components or screens – React components, UI screens, navigation stacks, service modules (e.g., AppwriteContext.tsx, service.ts)
- assets or music-asset – static resources (images, audio)
- Some projects include extra directories:
- appwriteauth11/src/appwrite – context and API service module connecting to Appwrite backend
- spotifymusic08/src/assets/audio – embedded MP3 files and musicPlayerServices.js

##### README for additional insights
- Describes this repo as a guided series sponsored by Hashnode, with video tutorials and learner contributions.

a. Main components (generic RN app)
- Developer Machine (Node.js, Watchman, Xcode, Android SDK)
- Metro Bundler – transforms and serves the JS bundle at runtime (dev mode)
- JavaScript Layer – App.tsx, React components, state management, navigation, service modules
- React Native Bridge – message channel between JS thread and native modules
- Native Modules & Runtime
– iOS: Objective-C/Swift code (AppDelegate, native UI elements), CocoaPods dependencies
– Android: Java/Kotlin code (MainActivity, MainApplication), Gradle config
- Platform-specific UI Rendering and Hardware (UIKit/Android Views)
- External Services (optional per project)
– appwriteauth11 → Appwrite server (authentication, database)
– spotifymusic08 → local audio assets playback via native modules

b. Relationships and interactions
- Developer triggers “react-native run-ios/android” → Metro Bundler compiles JS → serves bundle to emulator/device
- JS bundle runs in JS engine (JSC or Hermes) → issues UI update commands through the bridge → native UI rendered
- JS calls service modules (e.g., fetch to Appwrite API) → network → external backend
- Native modules callback events (e.g., audio playback status) → bridge → JS listeners

c. Architectural patterns and design principles
- Single-Page App pattern: Navigation stacks (React Navigation) in each project
- Separation of concerns:
– Presentation (screens, components)
– Business logic (services, context providers)
– Assets (images, audio)
- Dependency management: node_modules, CocoaPods, Gradle wrappers

d. Technologies and frameworks
- React Native core
- React (with hooks and context)
- TypeScript (in many projects)
- ESLint, Prettier, Ruby versioning for environment consistency
- Metro Bundler, Babel
- Platform toolchains: Xcode (iOS), Android SDK & Gradle

##### Detail
- Per-project custom folders under the JS layer (e.g., src/routes, src/components, src/appwrite)
- Environment files (.env, sample-env) for Appwrite project
- Don’t overcrowd: create one master template for “generic RN app” then overlay project-specific components on it.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Developer Environment
    subgraph "Developer Environment"
        DevMachine["Developer Machine\n(Node.js, Watchman, Xcode,\nAndroid SDK)"]:::dev
    end

    %% JS Runtime
    subgraph "JS Runtime"
        MetroBundler["Metro Bundler"]:::jsLayer
        JSEngine["JS Engine\n(JSC / Hermes)"]:::jsLayer

        subgraph "JavaScript Layer"
            EntryPoints["Entry Points\n(App.tsx / index.js)"]:::jsLayer
            Presentation["Presentation Layer\n(Screens & Components)"]:::jsLayer
            BusinessLogic["Business Logic & Services"]:::jsLayer
            Navigation["Navigation Stacks & Routing"]:::jsLayer
            Context["Context & State Management"]:::jsLayer
            Assets["Assets (images, audio)"]:::jsLayer
            Tests["Tests (__tests__)"]:::jsLayer
            Config["Configuration & Tooling\n(package.json, babel, tsconfig)"]:::jsLayer
        end
    end

    %% Native Runtime
    subgraph "Native Runtime"
        RNBridge["React Native Bridge"]:::native
        NativeModules["Native Modules\n(Android & iOS)"]:::native
        UIRendering["Platform-specific UI Rendering\n(UIKit / Android Views)"]:::native
    end

    %% External Services
    subgraph "External Services"
        AppwriteServer["Appwrite Server"]:::external
        LocalAudio["Local Audio Playback"]:::external
    end

    %% Connections
    DevMachine -->|"run-ios / run-android"| MetroBundler
    MetroBundler -->|"serves JS bundle"| JSEngine
    JSEngine -->|"executes JS"| EntryPoints
    EntryPoints --> Presentation
    Presentation --> BusinessLogic
    BusinessLogic --> Navigation
    Navigation --> Context
    Context --> Assets
    Assets --> Tests
    Tests --> Config
    JSEngine -->|"via Bridge"| RNBridge
    RNBridge --> NativeModules
    NativeModules --> UIRendering
    BusinessLogic -->|"\nfirebase / Appwrite API"| AppwriteServer
    Presentation -->|"\naudio control"| LocalAudio
    LocalAudio --> RNBridge
    AppwriteServer --> RNBridge

    %% Click Events
    click MetroBundler "https://github.com/hiteshchoudhary/react-native-projects/blob/main/shopping10/metro.config.js"
    click EntryPoints "https://github.com/hiteshchoudhary/react-native-projects/blob/main/shopping10/src/App.tsx"
    click Presentation "https://github.com/hiteshchoudhary/react-native-projects/blob/main/shopping10/src/screens/Home.tsx"
    click BusinessLogic "https://github.com/hiteshchoudhary/react-native-projects/blob/main/shopping10/src/data/contants.ts"
    click Navigation "https://github.com/hiteshchoudhary/react-native-projects/blob/main/appwriteauth11/src/routes/Router.tsx"
    click Context "https://github.com/hiteshchoudhary/react-native-projects/blob/main/appwriteauth11/src/appwrite/AppwriteContext.tsx"
    click Assets "https://github.com/hiteshchoudhary/react-native-projects/tree/main/spotifymusic08/src/assets/audio/"
    click Tests "https://github.com/hiteshchoudhary/react-native-projects/blob/main/shopping10/__tests__/App-test.tsx"
    click Config "https://github.com/hiteshchoudhary/react-native-projects/blob/main/shopping10/package.json"
    click AppwriteServer "https://github.com/hiteshchoudhary/react-native-projects/blob/main/appwriteauth11/src/appwrite/service.ts"
    click LocalAudio "https://github.com/hiteshchoudhary/react-native-projects/blob/main/spotifymusic08/musicPlayerServices.js"

    %% Styles
    classDef jsLayer fill:#D0E6FF,stroke:#3399FF,color:#000
    classDef native fill:#DFF2D8,stroke:#33CC33,color:#000
    classDef external fill:#FFEAC3,stroke:#FF9933,color:#000
    classDef dev fill:#F0F0F0,stroke:#666,color:#000
```
