# geordee/solar-potential architecture

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

- Interactive diagram: https://gitdiagram.com/geordee/solar-potential
- Repository: https://github.com/geordee/solar-potential

## Overview

##### Project type and purpose
- This is a web application (a full-stack SvelteKit demo) whose sole purpose is to showcase Google’s Solar API data on a map. It leverages SvelteKit for server-side rendering (SSR) and client-side hydration, Vite as the build tool, Tailwind and Material Web Components for styling, and is intended to be deployed to Cloud Run.

##### File structure
- Top-level: standard Node/JavaScript configs (.env, package.json, tsconfig.json, ESLint/Prettier, GitHub Actions for CI, Cloud Run deploy files).
- src/app.html + src/app.css: HTML template and global CSS.
- src/routes: SvelteKit file-based routing.
- +layout.svelte handles the shared page shell (injects Google Maps API script, theme provider).
- +page.svelte/ts provide the homepage logic.
- /components contains reusable UI pieces (charts, inputs, calendar, map marker overlays).
- /sections groups page-specific UI sections.
- static: static assets (robots.txt).
- theme: Tailwind/tokens, light/dark CSS.
- tests & playwright: end-to-end and unit tests.

##### README for additional insights
- Tech stack summary: Solar API, Google Maps JavaScript API, Material Design Web Components, SvelteKit + TypeScript, Vite, Tailwind, ESLint/Prettier.
- Deployment: Cloud Run via gcloud build & deploy from source.
- Environment: VITE_GOOGLE_MAPS_API_KEY loaded from .env for browser use.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Developer Environment
    subgraph "🖥 Developer Environment"
        style DeveloperEnv fill:#e5e5e5,stroke:#333,stroke-width:1px
        subgraph "Local File System"
            style LocalFS fill:#f8f9fa,stroke:#ccc,stroke-dasharray: 2 2
            SC["svelte.config.js"]:::dev
            VCFG["vite.config.ts"]:::dev
            TWCFG["tailwind.config.js"]:::dev
            PCFG["postcss.config.js"]:::dev
            ENV[".env"]:::dev
            GCI[".gcloudignore"]:::dev
            GHBUILD[".github/workflows/build.yml"]:::dev
            GHLINT[".github/workflows/lint.yml"]:::dev
            GHTEST[".github/workflows/tests.yml"]:::dev
            APPHTML["src/app.html"]:::dev
            APPCSS["src/app.css"]:::dev
            APPDTS["src/app.d.ts"]:::dev
            LAYOUT["src/routes/+layout.svelte"]:::dev
            PAGE_SVELTE["src/routes/+page.svelte"]:::dev
            PAGE_TS["src/routes/+page.ts"]:::dev
            SOLAR_HELPER["src/routes/solar.ts"]:::dev
            VISUALIZE["src/routes/visualize.ts"]:::dev
            LAYER["src/routes/layer.ts"]:::dev
            UTILS["src/routes/utils.ts"]:::dev
            COMPONENTS["src/routes/components"]:::dev
            SECTIONS["src/routes/sections"]:::dev
            THEME["src/theme"]:::dev
            STATIC["static/robots.txt"]:::dev
            PLAYWRIGHT["playwright.config.ts"]:::dev
            TESTS["tests/test.ts"]:::dev
            ROUTE_TEST["src/routes/solar.test.ts"]:::dev
            TSCONFIG["tsconfig.json"]:::dev
            ESLINT[".eslintrc.js/.eslintignore"]:::dev
            PRETTIER[".prettierrc/.prettierignore"]:::dev
        end
        Vite["Vite Dev Server"]:::dev
    end

    %% CI/CD Pipeline
    subgraph "🔄 CI/CD Pipeline"
        style CICD fill:#e5e5e5,stroke:#333,stroke-width:1px
        GH["GitHub Actions"]:::dev -->|triggers| CB["Cloud Build"]:::dev -->|deploys| CR["Cloud Run"]:::server
    end

    %% Runtime
    subgraph "☁️ Cloud Run"
        SK["SvelteKit Server"]:::server
    end

    %% Client
    subgraph "🌐 User's Browser"
        BR["Browser (SSR + CSR)"]:::client
    end

    %% External Services
    subgraph "🔗 External APIs"
        GMJS["Google Maps JS API (CDN)"]:::external
        SOLAR["Solar API (Google)"]:::external
    end

    %% Relationships
    BR -->|HTTPS request| SK
    SK -->|serves HTML/CSS/JS| BR
    ENV -->|injects VITE_GOOGLE_MAPS_API_KEY| SK
    BR -->|loads script| GMJS
    BR -->|calls API via Maps JS| SOLAR
    GMJS -->|provides Solar layer calls| SOLAR
    CR -->|runs| SK

    Vite -->|hot-reload/dev| BR
    SC --> Vite
    VCFG --> Vite

    GH --> CB
    CB --> CR

    %% Click Events
    click SC "https://github.com/geordee/solar-potential/blob/main/svelte.config.js"
    click VCFG "https://github.com/geordee/solar-potential/blob/main/vite.config.ts"
    click TWCFG "https://github.com/geordee/solar-potential/blob/main/tailwind.config.js"
    click PCFG "https://github.com/geordee/solar-potential/blob/main/postcss.config.js"
    click ENV "https://github.com/geordee/solar-potential/blob/main/.env"
    click GCI "https://github.com/geordee/solar-potential/blob/main/.gcloudignore"
    click GHBUILD "https://github.com/geordee/solar-potential/blob/main/.github/workflows/build.yml"
    click GHLINT "https://github.com/geordee/solar-potential/blob/main/.github/workflows/lint.yml"
    click GHTEST "https://github.com/geordee/solar-potential/blob/main/.github/workflows/tests.yml"
    click APPHTML "https://github.com/geordee/solar-potential/blob/main/src/app.html"
    click APPCSS "https://github.com/geordee/solar-potential/blob/main/src/app.css"
    click APPDTS "https://github.com/geordee/solar-potential/blob/main/src/app.d.ts"
    click LAYOUT "https://github.com/geordee/solar-potential/blob/main/src/routes/+layout.svelte"
    click PAGE_SVELTE "https://github.com/geordee/solar-potential/blob/main/src/routes/+page.svelte"
    click PAGE_TS "https://github.com/geordee/solar-potential/blob/main/src/routes/+page.ts"
    click SOLAR_HELPER "https://github.com/geordee/solar-potential/blob/main/src/routes/solar.ts"
    click VISUALIZE "https://github.com/geordee/solar-potential/blob/main/src/routes/visualize.ts"
    click LAYER "https://github.com/geordee/solar-potential/blob/main/src/routes/layer.ts"
    click UTILS "https://github.com/geordee/solar-potential/blob/main/src/routes/utils.ts"
    click COMPONENTS "https://github.com/geordee/solar-potential/tree/main/src/routes/components"
    click SECTIONS "https://github.com/geordee/solar-potential/tree/main/src/routes/sections"
    click THEME "https://github.com/geordee/solar-potential/tree/main/src/theme"
    click STATIC "https://github.com/geordee/solar-potential/blob/main/static/robots.txt"
    click PLAYWRIGHT "https://github.com/geordee/solar-potential/blob/main/playwright.config.ts"
    click TESTS "https://github.com/geordee/solar-potential/blob/main/tests/test.ts"
    click ROUTE_TEST "https://github.com/geordee/solar-potential/blob/main/src/routes/solar.test.ts"
    click TSCONFIG "https://github.com/geordee/solar-potential/blob/main/tsconfig.json"
    click ESLINT "https://github.com/geordee/solar-potential/blob/main/.eslintrc.js"
    click PRETTIER "https://github.com/geordee/solar-potential/blob/main/.prettierrc"
    
    %% Styles
    classDef client fill:#b2f2bb,stroke:#333,stroke-width:1px
    classDef server fill:#aed9e0,stroke:#333,stroke-width:1px
    classDef external fill:#ffd8a8,stroke:#333,stroke-width:1px
    classDef dev fill:#f1f3f5,stroke:#333,stroke-width:1px
```
