# bradleylund/passportpalsd3react architecture

> Architecture diagram of the GitHub repository bradleylund/passportpalsd3react, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bradleylund/passportpalsd3react
- Repository: https://github.com/bradleylund/passportpalsd3react

## Overview

##### Project Type and Purpose
- PassportPals is a client‐side, single‐page web application built with React.

##### File Structure
Top‑Level Files
- package.json / package-lock.json: Node.js dependencies and build scripts.
- postcss.config.js, tailwind.config.js: CSS build pipeline.
- README.md: High‑level description.

public/
- Static assets served at runtime:
– index.html (entry point)
– countries‑land‑10km.geo.json (map geometry)
– passport-index-tidy-iso3.csv (visa data)
– manifest.json, robots.txt, CNAME

src/
- React components and styling:
– index.js → App.js → component tree
– ChoroplethMap.js, LeafLetMap.js (map rendering)
– SelectComponent.js, SelectBoxComponent.js, ParentComponentSelectAndMap.js (UI controls + state)
– VisaRequirementsTable.js (data table)
– App.css, index.css

Build & Test
- App.test.js, setupTests.js, reportWebVitals.js

##### Extract Additional Insights from README
- No mention of a separate backend or external API → all data is pre‐packaged in public.
- And table visualizations drive the core user experience.

##### Main Components and Their Interactions
a. Client / Browser
– Hosts the React application.
– Downloads HTML, JS bundle, CSS, geoJSON, CSV.

b. Static File Server / CDN
– Serves public assets (index.html, JS bundles, data files).

c. React Frontend
– App Shell (App.js)
– State container (ParentComponentSelectAndMap)
– UI Components:
- SelectComponent(s) for origin/friend country
- ChoroplethMap / LeafLetMap for map visualization
- VisaRequirementsTable for tabular display

d. Data Sources (All local assets)
– CSV (visa requirements)

e. Build Toolchain (Dev / CI)
– Node.js / npm scripts (build, test)
– PostCSS / TailwindCSS for styling

##### Architectural Patterns & Design Principles
- Component‐based UI: each visual or control element lives in its own React component.
- Unidirectional data flow: ParentComponent holds selected countries in state → passes props down to Map and Table → UI updates on user interaction.
- Static‐first deployment: no runtime backend; ideal for GitHub Pages or any static‐site host.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Build Toolchain
    subgraph "Build & CI Toolchain"
        direction TB
        PostCSS["postcss.config.js"]:::build
        Tailwind["tailwind.config.js"]:::build
        Package["package.json / package-lock.json"]:::build
        SetupTests["src/setupTests.js"]:::build
        AppTest["src/App.test.js"]:::build
        ReportMetrics["src/reportWebVitals.js"]:::build
        README["README.md"]:::build
    end

    %% Static Infrastructure
    StaticCDN["Static File Server / CDN"]:::infra

    %% User Browser
    Browser["User Browser"]:::external

    %% React Application
    subgraph "React Application"
        direction TB
        EntryPoint["src/index.js"]:::frontend
        AppShell["src/App.js"]:::frontend
        StateContainer["src/ParentComponentSelectAndMap.js"]:::frontend
        Selector1["src/SelectComponent.js"]:::frontend
        Selector2["src/SelectBoxComponent.js"]:::frontend
        ChoroplethMap["src/ChoroplethMap.js"]:::frontend
        LeafLetMap["src/LeafLetMap.js"]:::frontend
        VisaTable["src/VisaRequirementsTable.js"]:::frontend
        GlobalStyles["src/index.css"]:::frontend
        AppStyles["src/App.css"]:::frontend
    end

    %% Data Sources
    subgraph "Data Sources"
        direction TB
        GeoJSON["countries-land-10km.geo.json"]:::data
        CSVData["passport-index-tidy-iso3.csv"]:::data
        HTML["public/index.html"]:::data
    end

    %% Relationships
    Browser -->|"requests assets"| StaticCDN
    StaticCDN -->|"serves HTML, JS, CSS, data"| Browser
    Browser -->|"loads bundle"| EntryPoint
    EntryPoint -->|"renders"| AppShell
    AppShell -->|"mounts"| StateContainer
    StateContainer -->|"props"| Selector1
    StateContainer -->|"props"| Selector2
    StateContainer -->|"props"| ChoroplethMap
    StateContainer -->|"props"| LeafLetMap
    StateContainer -->|"props"| VisaTable
    StateContainer -->|"GET geoJSON"| GeoJSON
    StateContainer -->|"GET CSV"| CSVData

    %% Click Events
    click StaticCDN "https://github.com/bradleylund/passportpalsd3react/tree/main/public/"
    click HTML "https://github.com/bradleylund/passportpalsd3react/blob/main/public/index.html"
    click GeoJSON "https://github.com/bradleylund/passportpalsd3react/blob/main/public/countries-land-10km.geo.json"
    click CSVData "https://github.com/bradleylund/passportpalsd3react/blob/main/public/passport-index-tidy-iso3.csv"
    click EntryPoint "https://github.com/bradleylund/passportpalsd3react/blob/main/src/index.js"
    click AppShell "https://github.com/bradleylund/passportpalsd3react/blob/main/src/App.js"
    click StateContainer "https://github.com/bradleylund/passportpalsd3react/blob/main/src/ParentComponentSelectAndMap.js"
    click Selector1 "https://github.com/bradleylund/passportpalsd3react/blob/main/src/SelectComponent.js"
    click Selector2 "https://github.com/bradleylund/passportpalsd3react/blob/main/src/SelectBoxComponent.js"
    click ChoroplethMap "https://github.com/bradleylund/passportpalsd3react/blob/main/src/ChoroplethMap.js"
    click LeafLetMap "https://github.com/bradleylund/passportpalsd3react/blob/main/src/LeafLetMap.js"
    click VisaTable "https://github.com/bradleylund/passportpalsd3react/blob/main/src/VisaRequirementsTable.js"
    click GlobalStyles "https://github.com/bradleylund/passportpalsd3react/blob/main/src/index.css"
    click AppStyles "https://github.com/bradleylund/passportpalsd3react/blob/main/src/App.css"
    click PostCSS "https://github.com/bradleylund/passportpalsd3react/blob/main/postcss.config.js"
    click Tailwind "https://github.com/bradleylund/passportpalsd3react/blob/main/tailwind.config.js"
    click Package "https://github.com/bradleylund/passportpalsd3react/blob/main/package.json / package-lock.json"
    click SetupTests "https://github.com/bradleylund/passportpalsd3react/blob/main/src/setupTests.js"
    click AppTest "https://github.com/bradleylund/passportpalsd3react/blob/main/src/App.test.js"
    click ReportMetrics "https://github.com/bradleylund/passportpalsd3react/blob/main/src/reportWebVitals.js"
    click README "https://github.com/bradleylund/passportpalsd3react/blob/main/README.md"

    %% Styles
    classDef infra fill:#eeeeee,stroke:#888888,stroke-width:1px
    classDef frontend fill:#bbdefb,stroke:#1e88e5,stroke-width:1px
    classDef data fill:#c8e6c9,stroke:#2e7d32,stroke-width:1px
    classDef build fill:#ffe082,stroke:#f9a825,stroke-width:1px
    classDef external fill:#e1bee7,stroke:#8e24aa,stroke-width:1px
```
