# shubhamhiremat/cosmic-birthdate-voyager architecture

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

- Interactive diagram: https://gitdiagram.com/shubhamhiremat/cosmic-birthdate-voyager
- Repository: https://github.com/shubhamhiremat/cosmic-birthdate-voyager

## Overview

##### Project type and purpose
- This is a Single-Page Application (SPA) built with React, TypeScript, Vite, Tailwind CSS, and the shadcn-ui component library.
- Purpose: a “cosmic” UI that displays NASA APOD (Astronomy Picture of the Day), a solar system viewer, star field effects, and related interactive components (e.g., birthdate form).

##### File structure
- Top-level files:
- index.html – SPA entry point
- public/robots.txt – static asset
- package.json / bun.lockb / package-lock.json – dependencies, scripts
- config files: vite.config.ts, tailwind.config.ts, tsconfig*.json, eslint.config.js, postcss.config.js
- src/:
- main.tsx – renders <App /> into the DOM
- App.tsx + App.css – root application shell
- components/ – domain components (ApodDisplay, SolarSystemViewer, StarField, CosmicVoyager, BirthdateForm)
- components/ui/ – shared UI primitives from shadcn-ui (buttons, dialogs, inputs, etc.)
- hooks/ – custom hooks (use-mobile, use-toast)
- lib/ – utility functions
- pages/ – route views (Index.tsx, NotFound.tsx)
- No backend code; data fetched directly from external APIs at runtime.

##### README for insights
- Tech stack: Vite, TS, React, shadcn-ui, Tailwind.
- Deployment/editing through Lovable.dev platform (auto-commits, custom domains).
- Development via local IDE or GitHub Codespaces, Node.js & npm.

##### Components
a. Main components
- User’s Web Browser (Client)
- CDN or Static Host (e.g., Lovable’s hosting or Vercel)
- Frontend SPA (bundled JS/CSS from Vite build)
– Routing (React Router or custom)
– UI Components (ApodDisplay, SolarSystemViewer, etc.)
– UI Library (shadcn-ui + Tailwind CSS)
– Custom Hooks & Utility Module
- External API(s)
– NASA APOD API (data source)
– Any other third-party services (e.g., telemetry, analytics)
- Dev & CI/CD Services
– GitHub (repo)
– Lovable.dev Platform (edit, preview, publish)
– npm registry (dependencies)

b. Relationships and interactions
1. Browser requests index.html from the CDN/host.
2. SPA bundle is loaded; React hydrates the App.
3. Components render and invoke custom hooks.
4. API layer issues HTTP requests to NASA API; responses flow back to components.
5. User interactions (forms, buttons) trigger state updates via React.
6. Dev workflow: changes pushed to GitHub → Lovable rebuilds & auto-deploys.

c. Architectural patterns & principles
- Component-Based Architecture (isolated, reusable UI pieces)
- Unidirectional Data Flow (React props & state)
- Separation of Concerns:
– UI primitives (components/ui) vs. domain logic (components/*.tsx)
– Utility functions in lib/
– Custom hooks encapsulate cross-cutting concerns (mobile detection, toast notifications)
- SPA Routing – index view vs. NotFound

d. Key technologies
- Vite – fast dev server & build tool
- React & TypeScript – typed UI
- Tailwind CSS – utility-first styling
- shadcn-ui – accessible, styled React primitives
- Node.js & npm – dev scripts & dependency management

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Side
    subgraph "Client Side"
        Browser["User's Browser"]:::frontend
    end

    %% CDN/Host
    CDN["CDN / Static Host"]:::external

    Browser -->|"HTTP GET index.html"| CDN
    CDN -->|"Serves bundle (JS/CSS)"| SPA

    %% SPA Bundle
    subgraph "SPA Bundle"
        direction TB
        subgraph "Entry & Bootstrap"
            direction TB
            HTML["index.html"]:::frontend
            Main["main.tsx"]:::frontend
        end
        subgraph "Root Application Shell"
            direction TB
            App["App.tsx"]:::frontend
            AppCSS["App.css"]:::frontend
        end
        subgraph "Routing / Pages"
            direction TB
            Home["Index.tsx"]:::frontend
            NotFound["NotFound.tsx"]:::frontend
        end
        subgraph "Domain Components"
            direction TB
            Apod["ApodDisplay"]:::frontend
            Solar["SolarSystemViewer"]:::frontend
            Star["StarField"]:::frontend
            Voyager["CosmicVoyager"]:::frontend
            Birth["BirthdateForm"]:::frontend
        end
        subgraph "UI Primitives"
            direction TB
            UI["components/ui/"]:::frontend
        end
        subgraph "Hooks & Utils"
            direction TB
            Mobile["use-mobile"]:::frontend
            ToastH["use-toast"]:::frontend
            Utils["utils.ts"]:::frontend
        end
    end

    %% External APIs
    subgraph "External APIs"
        direction TB
        NASA["NASA APOD API"]:::external
        Analyt["Analytics / Telemetry"]:::external
    end

    %% Dev & CI/CD
    subgraph "Dev & CI/CD"
        direction TB
        IDE["Local IDE / Codespaces"]:::ci
        GH["GitHub Repo"]:::ci
        Lovable["Lovable.dev Platform"]:::ci
        npm["npm Registry"]:::ci
    end

    %% Interactions
    SPA --> Apod
    SPA --> Solar
    SPA --> Star
    SPA --> Voyager
    SPA --> Birth
    SPA --> Home
    SPA --> NotFound
    SPA --> UI
    SPA --> Mobile
    SPA --> ToastH
    SPA --> Utils

    Apod -->|"GET /apod"| NASA
    SPA -->|"telemetry"| Analyt

    IDE -->|"push/commit"| GH
    GH -->|"CI Build & Deploy"| Lovable
    Lovable -->|"Hosts static site"| CDN
    npm -->|"dependencies"| SPA

    %% Click Events
    click HTML "https://github.com/shubhamhiremat/cosmic-birthdate-voyager/blob/main/index.html"
    click Main "https://github.com/shubhamhiremat/cosmic-birthdate-voyager/blob/main/src/main.tsx"
    click App "https://github.com/shubhamhiremat/cosmic-birthdate-voyager/blob/main/src/App.tsx"
    click AppCSS "https://github.com/shubhamhiremat/cosmic-birthdate-voyager/blob/main/src/App.css"
    click Apod "https://github.com/shubhamhiremat/cosmic-birthdate-voyager/blob/main/src/components/ApodDisplay.tsx"
    click Solar "https://github.com/shubhamhiremat/cosmic-birthdate-voyager/blob/main/src/components/SolarSystemViewer.tsx"
    click Star "https://github.com/shubhamhiremat/cosmic-birthdate-voyager/blob/main/src/components/StarField.tsx"
    click Voyager "https://github.com/shubhamhiremat/cosmic-birthdate-voyager/blob/main/src/components/CosmicVoyager.tsx"
    click Birth "https://github.com/shubhamhiremat/cosmic-birthdate-voyager/blob/main/src/components/BirthdateForm.tsx"
    click UI "https://github.com/shubhamhiremat/cosmic-birthdate-voyager/tree/main/src/components/ui/"
    click Mobile "https://github.com/shubhamhiremat/cosmic-birthdate-voyager/blob/main/src/hooks/use-mobile.tsx"
    click ToastH "https://github.com/shubhamhiremat/cosmic-birthdate-voyager/blob/main/src/hooks/use-toast.ts"
    click Utils "https://github.com/shubhamhiremat/cosmic-birthdate-voyager/blob/main/src/lib/utils.ts"
    click Home "https://github.com/shubhamhiremat/cosmic-birthdate-voyager/blob/main/src/pages/Index.tsx"
    click NotFound "https://github.com/shubhamhiremat/cosmic-birthdate-voyager/blob/main/src/pages/NotFound.tsx"

    %% Styles
    classDef frontend fill:#e0f7fa,stroke:#006064,stroke-width:1px
    classDef external fill:#e8f5e9,stroke:#2e7d32,stroke-width:1px
    classDef ci fill:#fff3e0,stroke:#ef6c00,stroke-width:1px
```
