# kunalvegada/womens-day-express architecture

> Architecture diagram of the GitHub repository kunalvegada/womens-day-express, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-03-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kunalvegada/womens-day-express
- Repository: https://github.com/kunalvegada/womens-day-express

## Overview

##### Project type & purpose (from file tree + README)
This is a **single-page, static web experience** (“Women’s Day Express 2026”) built with **HTML/CSS/Vanilla JS** and deployed via **Firebase Hosting** (presence of `firebase.json`). The “live, interactive” aspects and “attach photos and wishes” strongly imply use of **Firebase client SDKs** from `script.js` to persist and retrieve user-generated content—typically:
- **Firestore / Realtime Database** for wishes/messages and live counters
- **Cloud Storage** for photo uploads
There is **no custom backend server** in the repo (no Node/Express, no `/functions` directory), so the architecture is **frontend + managed Firebase services**.

##### File structure to architectural components

- `index.html`
The SPA entrypoint. Owns DOM structure: train, coaches, counters, popup containers.
- `style.css`
Presentation layer: Flexbox layout, animations (train motion), responsive styling.
- `script.js`
Application logic: train speed changes, coach counter, popup messages, and Firebase read/write/upload logic.
- `firebase.json`
Deployment/runtime hosting config: Firebase Hosting routes, caching, rewrites (if any), public directory mapping (likely root).
- `README.md`

##### User / Client
- “User on Desktop/Mobile Browser”

##### Frontend (static SPA)
- “Women’s Day Express SPA”
- (Optionally subdivide into)
- UI/DOM (index.html)
- Styling/Animations (style.css)
- App Logic + Firebase SDK (script.js)

##### Firebase Hosting
- Serves `index.html`, `style.css`, `script.js` over HTTPS
- (Note any rewrites/headers if present in `firebase.json`)

##### Firebase Data Services (include only what the code uses; infer likely set)
- **Firestore or Realtime Database**: wishes/messages, “live coach counter”, realtime updates
- **Cloud Storage**: photo uploads + retrieval URLs
- (Optional, only if referenced in `script.js`)
- **Firebase Auth**: anonymous/authenticated posting

##### Browser → Firebase Hosting
- `HTTPS GET` static assets (`/index.html`, `/style.css`, `/script.js`)
##### script.js ↔ Firestore/Realtime DB
- `Firebase SDK (HTTPS/WebSocket)`
- Writes: “submit wish/message”, increment counters
- Reads/listens: “subscribe to messages”, update live counter, trigger popups
##### script.js ↔ Cloud Storage
- `Firebase SDK upload` photo
- `download URL` retrieval for displaying attached photos

If there is “dynamic train speed” driven by local logic only, show it as **internal UI logic** inside the SPA (no external dependency). If it’s influenced by live data (e.g., speed increases with number of wishes), show a dependency from the DB read stream to the animation engine.

##### Architectural patterns/design principles to call out
- **Serverless / Backendless architecture**: all business logic runs client-side; persistence and realtime handled by Firebase managed services.
- **Event-driven UI**: user events (submit wish/upload) and realtime DB events (new message) drive UI updates (popups, counters, train behavior).
- **Separation of concerns (simple)**:
- Markup (HTML), Presentation (CSS animations), Behavior (JS), Hosting/Config (Firebase)

- “Firebase Hosting”, “Firestore (realtime listeners)”, “Cloud Storage (photo upload)”, “Women’s Day Express SPA”
- `GET static assets`
- `upload photo`
- `write wish`
- `realtime subscribe / receive updates`
- Blue: client-side components (Browser, SPA modules)
- Green: Firebase managed services (Hosting/DB/Storage)
- Gray: external actor (User)
- **Call out trust boundaries**:
- Boundary around “Client” (untrusted)
- Boundary around “Firebase” (managed backend)
- “All validation/security must be enforced by Firebase Security Rules” (important in backendless apps)

##### “Don’t overthink it” — but do separate into many components
- UI Rendering (DOM)
- Animation Engine (train speed)
- Live Counter Module
- Popup/Toast Module
- Firebase Adapter (init + read/write/upload)
- Data Models: Wish/Message, Photo metadata

## Diagram (Mermaid)

```mermaid
flowchart TD
  %% External Actor
  User(["User<br/>(Desktop/Mobile)"]):::actor

  %% Trust Boundaries (vertical orientation)
  subgraph "Client / Untrusted Environment"
    direction TB
    Browser["Web Browser<br/>(HTTPS + JS Runtime)"]:::client

    subgraph "Women’s Day Express SPA (Static)"
      direction TB

      HTML["UI / DOM Structure<br/>(index.html)"]:::frontend
      CSS["Presentation & Animations<br/>(style.css)"]:::frontend
      JS["App Logic + Firebase Client SDK<br/>(script.js)"]:::frontend

      subgraph "In-App Modules (client-side)"
        direction TB
        UI["UI Rendering & Event Handlers"]:::module
        Anim["Animation Engine<br/>(Train motion/speed)"]:::module
        Counter["Live Coach Counter Module"]:::module
        Popup["Popup/Toast Module"]:::module
        Models["Data Models<br/>(Wish/Message + Photo metadata)"]:::module
        Adapter["Firebase Adapter<br/>(init,read,write,upload)"]:::module
      end
    end
  end

  subgraph "Firebase / Managed Backend"
    direction TB

    Hosting["Firebase Hosting<br/>(Static asset delivery)"]:::firebase
    HostingCfg["Hosting Config<br/>(firebase.json)"]:::config

    subgraph "Firebase Data Services"
      direction TB
      DB[("Firestore or Realtime Database<br/>(wishes/messages,counters)<br/>realtime listeners")]:::db
      Storage[("Cloud Storage<br/>(photo uploads + download URLs)")]:::storage
    end

    Rules["Security Rules<br/>(enforce validation & access)"]:::note
  end

  %% Flows
  User -->|"uses"| Browser

  Browser -->|"HTTPS GET static assets"| Hosting
  Hosting -->|"serves index.html"| HTML
  Hosting -->|"serves style.css"| CSS
  Hosting -->|"serves script.js"| JS

  HostingCfg -->|"configures hosting/routes/headers"| Hosting

  %% SPA internal wiring
  HTML -->|"structure"| UI
  CSS -->|"styles/animations"| Anim
  JS -->|"binds events & updates DOM"| UI
  JS -->|"controls train behavior"| Anim
  JS -->|"updates coach counter"| Counter
  JS -->|"shows messages/popups"| Popup
  JS -->|"uses models"| Models
  JS -->|"calls"| Adapter

  %% Firebase interactions
  Adapter -->|"write wish/message & increment counters"| DB
  DB -->|"realtime subscribe / receive updates"| Adapter

  Adapter -->|"upload photo"| Storage
  Storage -->|"download URL & metadata"| Adapter

  %% Event-driven UI updates from realtime data
  Adapter -->|"new message/event"| Popup
  Adapter -->|"counter updates"| Counter
  Adapter -->|"optional: drive speed from live data"| Anim

  %% Security emphasis
  Rules -.->|"protects DB/Storage access"| DB
  Rules -.->|"protects DB/Storage access"| Storage

  %% Click events (component mappings)
  click HTML "https://github.com/kunalvegada/womens-day-express/blob/main/index.html"
  click CSS "https://github.com/kunalvegada/womens-day-express/blob/main/style.css"
  click JS "https://github.com/kunalvegada/womens-day-express/blob/main/script.js"
  click HostingCfg "https://github.com/kunalvegada/womens-day-express/blob/main/firebase.json"
  click Rules "https://github.com/kunalvegada/womens-day-express/blob/main/firebase.json"
  click Hosting "https://github.com/kunalvegada/womens-day-express/blob/main/firebase.json"

  %% README (documentation) as a referenced artifact
  Docs["Documentation<br/>(README.md)"]:::doc
  Docs -.->|"describes features/stack"| HTML
  Docs -.->|"describes features/stack"| JS
  click Docs "https://github.com/kunalvegada/womens-day-express/blob/main/README.md"

  %% Styles
  classDef actor fill:#E5E7EB,stroke:#6B7280,color:#111827,stroke-width:1px
  classDef client fill:#DBEAFE,stroke:#1D4ED8,color:#0B1F4B,stroke-width:1px
  classDef frontend fill:#BFDBFE,stroke:#1D4ED8,color:#0B1F4B,stroke-width:1px
  classDef module fill:#93C5FD,stroke:#1E40AF,color:#0B1F4B,stroke-width:1px
  classDef firebase fill:#D1FAE5,stroke:#047857,color:#052E1A,stroke-width:1px
  classDef db fill:#A7F3D0,stroke:#047857,color:#052E1A,stroke-width:1px
  classDef storage fill:#6EE7B7,stroke:#047857,color:#052E1A,stroke-width:1px
  classDef config fill:#FDE68A,stroke:#B45309,color:#3A2500,stroke-width:1px
  classDef doc fill:#F3F4F6,stroke:#4B5563,color:#111827,stroke-width:1px
  classDef note fill:#FFE4E6,stroke:#BE123C,color:#3F0A1B,stroke-width:1px
```
