# christophe-chausseray/camps-react-native-app architecture

> Architecture diagram of the GitHub repository christophe-chausseray/camps-react-native-app, 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/christophe-chausseray/camps-react-native-app
- Repository: https://github.com/christophe-chausseray/camps-react-native-app

## Overview

##### Project type and purpose
- This is a full-stack mobile client (React Native) whose sole responsibility is to fetch and display camping sites around Paris on iOS and Android. It does not include the backend source code, but relies on an external GraphQL API and the Google Maps API.

##### File structure
- Top-level platform folders:
- android/ – Android native project (Java, Gradle, native modules)
- ios/ – iOS native project (Objective-C/Swift, Xcode, CocoaPods)
- src/ – JavaScript/TypeScript client code
- ApolloClient.ts – Apollo GraphQL client setup
- components/ – reusable UI pieces (Header, etc.)
- views/ – feature screens, separated into Camping/List and Camping/Details
- models/ – TypeScript types for domain objects (e.g. campingItem)
- mocks/ – Apollo mocks for tests
- App.tsx, index.js – application entry point and root component
- Config & infra: metro.config.js, babel.config.js, tsconfig.json, .env.dist, GitHub Actions workflows in .github/workflows/

##### README for additional insights
- Uses React Native CLI (Metro bundler + Babel)
- Uses Apollo Client to fetch from a GraphQL endpoint (CAMPS_API_HOST)
- Integrates Google Maps via a JS API key
- Testing with React Native Testing Library + Apollo MockedProvider
- CI: GitHub Actions triggers lint, tests, builds; deploys documentation to GitHub Pages

##### Essential architectural elements
- Don’t just show screens; show how they hook into Apollo, how the network layer is configured, and how native modules (maps) integrate
- Bundler step (Metro) and the build pipelines for each platform
- Testing & CI as part of the overall system lifecycle
- Environment variable injection (.env → Google Maps API key, CAMPS_API_HOST)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Mobile App Container
    subgraph "Mobile App"
        direction TB

        subgraph "Platform / Native Layers"
            direction TB
            Android["Android Native Layer"]:::platform
            iOS["iOS Native Layer"]:::platform
        end

        subgraph "Bundler & Config"
            direction TB
            MetroConfig["metro.config.js"]:::config
            BabelConfig["babel.config.js"]:::config
            RNConfig["react-native.config.js"]:::config
        end

        subgraph "JS Runtime"
            direction TB
            Metro["Metro Bundler"]:::runtime
            JSBridge["JavaScriptCore Bridge"]:::runtime
        end

        subgraph "Application Entry"
            direction TB
            IndexJS["index.js"]:::app
            AppTS["App.tsx"]:::app
        end

        subgraph "UI Layer"
            direction TB
            Components["Reusable Components"]:::ui
            ListView["Camping List View"]:::ui
            DetailsView["Camping Details View"]:::ui
        end

        subgraph "State & Data Layer"
            direction TB
            ApolloClient["ApolloClient.ts"]:::data
            Models["Domain Models"]:::data
        end

        subgraph "Testing & Mocks"
            direction TB
            Mocks["Apollo Mocks & Test Utils"]:::test
            AppTest["App.test.tsx"]:::test
        end

        subgraph "Network Layer"
            direction TB
            GraphQLTransport["GraphQL HTTP Transport"]:::network
        end
    end

    %% External Services
    subgraph "External Services"
        direction TB
        GraphQLAPI["External GraphQL API"]:::external
        GoogleMaps["Google Maps API"]:::external
    end

    %% CI/CD Pipeline
    subgraph "CI/CD Pipeline"
        direction TB
        GitHubActions["GitHub Actions"]:::ci
        Docs["Documentation (GitHub Pages)"]:::ci
    end

    %% Data Flow & Relationships
    Android -->|hosts| Metro
    iOS -->|hosts| Metro

    MetroConfig --> Metro
    BabelConfig --> Metro
    RNConfig --> Metro

    Metro --> JSBridge
    JSBridge --> IndexJS
    IndexJS --> AppTS

    AppTS --> Components
    AppTS --> ListView
    AppTS --> DetailsView

    ListView -->|"uses hook"| ApolloClient
    DetailsView -->|"uses hook"| ApolloClient

    ApolloClient --> Models
    ApolloClient --> GraphQLTransport

    GraphQLTransport -->|queries| GraphQLAPI
    ListView -->|renders map| GoogleMaps
    DetailsView -->|renders map| GoogleMaps

    GitHubActions -->|runs lint/tests/builds| MetroConfig
    GitHubActions -->|deploys docs| Docs

    %% Click Events
    click Android "https://github.com/christophe-chausseray/camps-react-native-app/tree/main/android/"
    click iOS "https://github.com/christophe-chausseray/camps-react-native-app/tree/main/ios/"
    click MetroConfig "https://github.com/christophe-chausseray/camps-react-native-app/blob/main/metro.config.js"
    click BabelConfig "https://github.com/christophe-chausseray/camps-react-native-app/blob/main/babel.config.js"
    click RNConfig "https://github.com/christophe-chausseray/camps-react-native-app/blob/main/react-native.config.js"
    click IndexJS "https://github.com/christophe-chausseray/camps-react-native-app/blob/main/index.js"
    click AppTS "https://github.com/christophe-chausseray/camps-react-native-app/blob/main/src/App.tsx"
    click Components "https://github.com/christophe-chausseray/camps-react-native-app/tree/main/src/components/"
    click ListView "https://github.com/christophe-chausseray/camps-react-native-app/blob/main/src/views/Camping/List/ListView.tsx"
    click DetailsView "https://github.com/christophe-chausseray/camps-react-native-app/blob/main/src/views/Camping/Details/DetailsView.tsx"
    click ApolloClient "https://github.com/christophe-chausseray/camps-react-native-app/blob/main/src/ApolloClient.ts"
    click Models "https://github.com/christophe-chausseray/camps-react-native-app/tree/main/src/models/"
    click Mocks "https://github.com/christophe-chausseray/camps-react-native-app/blob/main/src/mocks/index.ts"
    click AppTest "https://github.com/christophe-chausseray/camps-react-native-app/blob/main/src/App.test.tsx"
    click Docs "https://github.com/christophe-chausseray/camps-react-native-app/tree/main/documentation/"
    click GitHubActions "https://github.com/christophe-chausseray/camps-react-native-app/blob/main/.github/workflows/build.yml"

    %% Styles
    classDef platform fill:#d3d3d3,stroke:#333,stroke-width:1px
    classDef config fill:#bdd7ee,stroke:#2f5597,stroke-width:1px
    classDef runtime fill:#c6efce,stroke:#2e7d32,stroke-width:1px
    classDef app fill:#a4c2f4,stroke:#073763,stroke-width:1px
    classDef ui fill:#ffe699,stroke:#bf9000,stroke-width:1px
    classDef data fill:#b6d7a8,stroke:#38761d,stroke-width:1px
    classDef network fill:#d9d2e9,stroke:#5b0fbe,stroke-width:1px
    classDef external fill:#f4cccc,stroke:#cc0000,stroke-width:1px
    classDef test fill:#fce5cd,stroke:#b45f06,stroke-width:1px
    classDef ci fill:#f9cb9c,stroke:#c65d00,stroke-width:1px
```
