# guinetik/exoplanets-review architecture

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

- Interactive diagram: https://gitdiagram.com/guinetik/exoplanets-review
- Repository: https://github.com/guinetik/exoplanets-review

## Overview

##### Project Type and Purpose
- Full-stack Single Page Application (SPA)
- Purpose: Display TESS exoplanet data, allow users to browse and leave reviews
- Frontend built with React/Vite, styling via TailwindCSS/Flowbite
- Backend and real-time data store via Firebase
- Data ingestion scripts process NASA API data into JSON

##### File Structure
Top-Level:
- data/       – ETL scripts & raw/out datasets
- build.js, deploy.js – custom build & deployment scripts
- index.html – SPA entry point
- package.json, vite.config.js, tailwind.config.js – build & styling configs
- src/        – React app: components/, routes/, data/
– components/ – UI building blocks (PlanetCard, StarSystem, modals, etc.)
– routes/     – React Router pages (home, planets, stars, about, apod)
– data/       – client-side data layer (db.js, context.jsx, factories, type definitions)
– App.jsx, main.jsx – root component & bootstrap
– styles/     – global and component CSS

##### README for Key Insights
- Technologies: Vite, React, TailwindCSS, Flowbite, Firebase
- Data source: NASA Exoplanet Archive + NASA Open API
- Dev flow: npm install + npm run dev

##### Main Components
a. Data Ingestion Pipeline (offline/pre-build)
– data/raw/*.json & CSV (source files)
– data/exploration.js (transforms & filters)
– data/out/*.json (processed exoplanet data)
– build.js (bundles or automates data processing)
b. Build & Deployment Pipeline
– Vite (module bundler) + TailwindCSS compiler
– deploy.js (uploads build artifacts to hosting, e.g. Firebase Hosting or static server)
c. Frontend SPA
– React Components & Routes
– Context API layer (src/data/context.jsx) provides state and hooks
– UI Library (Flowbite components styled with TailwindCSS)
– CSS (src/styles + tailwind.config.js + postcss.config.js)
d. Backend / Data Store
– Firebase (Authentication? Firestore or Realtime Database)
– src/data/db.js manages read/write of reviews and any user data
e. External Services
– NASA Open API (APOD, additional exoplanet metadata)
– (Optional) Authentication providers if used

##### Relationships and Data Flows
- Offline Data Flow: raw data → exploration.js → out/*.json → bundled into client
- Build Flow: src/ + out/*.json → Vite → bundle → deploy.js → Hosting
- Runtime Flow:
1. User accesses SPA via browser
2. React Router navigates to a route (e.g. /planets)
3. Component fetches processed data (bundled JSON or on-demand via Firebase Cloud Function if implemented)
4. Component invokes Firebase SDK (src/data/db.js) to:
– Read existing reviews
– Write new user reviews
5. If APOD or other NASA endpoints are requested at runtime, SPA calls NASA Open API directly
- Authentication (if implemented): Users sign in via Firebase Auth

##### Architectural Patterns and Design Principles
- SPA pattern with client-side routing (src/routes)
- Component-based UI (src/components)
- Context API for global state management
- Separation of concerns: data ingestion (offline), build, runtime
- Infrastructure as code: build.js and deploy.js scripts

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Offline Data Ingestion
    subgraph "Offline Data Ingestion"
        DIR_RAW[/data/raw/]:::datafile
        EXPL["data/exploration.js"]:::script
        DIR_OUT[/data/out/]:::datafile
        BUILD_SCRIPT["build.js"]:::script

        DIR_RAW -->|input| EXPL
        EXPL -->|processed| DIR_OUT
        DIR_OUT -->|used by| BUILD_SCRIPT
    end

    %% Build & Deployment
    subgraph "Build & Deployment"
        VITE["vite.config.js"]:::build
        TAIL["tailwind.config.js"]:::build
        POSTCSS["postcss.config.js"]:::build
        DEPLOY["deploy.js"]:::script

        DIR_OUT --> VITE
        VITE -->|bundle| DEPLOY
    end

    %% Frontend SPA
    subgraph "Frontend SPA"
        HTML["index.html"]:::frontend
        MAIN["src/main.jsx"]:::frontend
        APP["src/App.jsx"]:::frontend

        HTML --> MAIN --> APP

        subgraph Components
            PG["PlanetGenerator"]:::frontend
            SSE["StarSystemEngine"]:::frontend
            PC["planetcard.jsx"]:::frontend
            SC["starcard.jsx"]:::frontend
            SS["starsystem.jsx"]:::frontend
            SSP["starsystemplanets.jsx"]:::frontend
            MOD["modals.jsx"]:::frontend
            REV["reviews.jsx"]:::frontend
            NAV["nav.jsx"]:::frontend
            QUO["quote.jsx"]:::frontend
            BG["bg.jsx"]:::frontend
        end

        subgraph Routes
            R_HOME["home.jsx"]:::frontend
            R_PLANETS["planets.jsx"]:::frontend
            R_PLANET["planet.jsx"]:::frontend
            R_STARS["stars.jsx"]:::frontend
            R_STAR["star.jsx"]:::frontend
            R_ABOUT["about.jsx"]:::frontend
            R_APOD["apod.jsx"]:::frontend
        end

        subgraph "Data & State Layer"
            ADR["app.data.js"]:::frontend
            FAC["solarsystem.factory.js"]:::frontend
            TYPES["types.js"]:::frontend
            CTX["context.jsx"]:::frontend
            DB["db.js"]:::backend
        end

        APP --> Components
        APP --> Routes
        APP --> ADR
        ADR --> FAC
        ADR --> TYPES
        ADR --> CTX
        CTX --> DB
        REV --> DB
        PC --> DB
        R_APOD --> NASA
    end

    %% Firebase Backend
    subgraph "Firebase Backend"
        FIRESTORE[(Firestore)]:::database
        AUTH[(Auth)]:::database

        DB --> FIRESTORE
        DB --> AUTH
    end

    %% External APIs
    subgraph "External APIs"
        NASA["NASA Open API"]:::external
    end

    %% Click events
    click DIR_RAW "https://github.com/guinetik/exoplanets-review/tree/master/data/raw/"
    click EXPL "https://github.com/guinetik/exoplanets-review/blob/master/data/exploration.js"
    click DIR_OUT "https://github.com/guinetik/exoplanets-review/tree/master/data/out/"
    click BUILD_SCRIPT "https://github.com/guinetik/exoplanets-review/blob/master/build.js"
    click VITE "https://github.com/guinetik/exoplanets-review/blob/master/vite.config.js"
    click TAIL "https://github.com/guinetik/exoplanets-review/blob/master/tailwind.config.js"
    click POSTCSS "https://github.com/guinetik/exoplanets-review/blob/master/postcss.config.js"
    click DEPLOY "https://github.com/guinetik/exoplanets-review/blob/master/deploy.js"
    click HTML "https://github.com/guinetik/exoplanets-review/blob/master/index.html"
    click MAIN "https://github.com/guinetik/exoplanets-review/blob/master/src/main.jsx"
    click APP "https://github.com/guinetik/exoplanets-review/blob/master/src/App.jsx"
    click PG "https://github.com/guinetik/exoplanets-review/blob/master/src/components/PlanetGenerator.js"
    click SSE "https://github.com/guinetik/exoplanets-review/blob/master/src/components/StarSystemEngine.js"
    click PC "https://github.com/guinetik/exoplanets-review/blob/master/src/components/planetcard.jsx"
    click SC "https://github.com/guinetik/exoplanets-review/blob/master/src/components/starcard.jsx"
    click SS "https://github.com/guinetik/exoplanets-review/blob/master/src/components/starsystem.jsx"
    click SSP "https://github.com/guinetik/exoplanets-review/blob/master/src/components/starsystemplanets.jsx"
    click MOD "https://github.com/guinetik/exoplanets-review/blob/master/src/components/modals.jsx"
    click REV "https://github.com/guinetik/exoplanets-review/blob/master/src/components/reviews.jsx"
    click NAV "https://github.com/guinetik/exoplanets-review/blob/master/src/components/nav.jsx"
    click QUO "https://github.com/guinetik/exoplanets-review/blob/master/src/components/quote.jsx"
    click BG "https://github.com/guinetik/exoplanets-review/blob/master/src/components/bg.jsx"
    click R_HOME "https://github.com/guinetik/exoplanets-review/blob/master/src/routes/home.jsx"
    click R_PLANETS "https://github.com/guinetik/exoplanets-review/blob/master/src/routes/planets.jsx"
    click R_PLANET "https://github.com/guinetik/exoplanets-review/blob/master/src/routes/planet.jsx"
    click R_STARS "https://github.com/guinetik/exoplanets-review/blob/master/src/routes/stars.jsx"
    click R_STAR "https://github.com/guinetik/exoplanets-review/blob/master/src/routes/star.jsx"
    click R_ABOUT "https://github.com/guinetik/exoplanets-review/blob/master/src/routes/about.jsx"
    click R_APOD "https://github.com/guinetik/exoplanets-review/blob/master/src/routes/apod.jsx"
    click ADR "https://github.com/guinetik/exoplanets-review/blob/master/src/data/app.data.js"
    click FAC "https://github.com/guinetik/exoplanets-review/blob/master/src/data/solarsystem.factory.js"
    click TYPES "https://github.com/guinetik/exoplanets-review/blob/master/src/data/types.js"
    click CTX "https://github.com/guinetik/exoplanets-review/blob/master/src/data/context.jsx"
    click DB "https://github.com/guinetik/exoplanets-review/blob/master/src/data/db.js"

    %% Styles
    classDef datafile fill:#f2f2f2,stroke:#aaa;
    classDef script fill:#bbbbbb,stroke:#888;
    classDef build fill:#cccccc,stroke:#666;
    classDef frontend fill:#a0c4ff,stroke:#0366d6;
    classDef backend fill:#b8e986,stroke:#3a6e02;
    classDef database fill:#ffe066,stroke:#b58900,stroke-width:2px;
    classDef external fill:#ffadad,stroke:#d62828;
```
