# herniezz/chronotune architecture

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

- Interactive diagram: https://gitdiagram.com/herniezz/chronotune
- Repository: https://github.com/herniezz/chronotune

## Overview

##### Project type and purpose
- This is a React single-page application (SPA) that displays playlists (static JSON), lets users choose music, play videos, and run a simple game with hearts and pop-up cards. There is no backend service; all data lives in `public/playlist/*.json` or in external video/analytics services.

##### File structure
- Top-level dirs/files:
- public/ – static assets, including `playlist/*.json`
- src/ – React source (App.js, components/, utils/)
- config.js – app configuration (e.g. API keys, endpoints)
- No server code, so architecture is purely client-side plus external dependencies.

##### Key components (to represent as nodes)
- Browser (user’s web client)
- Static JSON Store (public/playlist)
- dadrock.json
- elections.json
- top_teledyski.json
- React App
- Root: index.html → index.js → App
- Components:
– HomeScreen
– MusicChooseScreen
– GameForm
– GameScreen
– VideoPlayer
– PopUpCard
– Hearts
- Utilities: errorHandlers, reportWebVitals
- External services
- External Video Source
- Analytics Service

##### Relationships & data flows
- User clicks through HomeScreen → MusicChooseScreen
- MusicChooseScreen & GameScreen fetch playlist JSON from Static JSON Store
- VideoPlayer streams from ExternalVideo Source
- reportWebVitals sends metrics to Analytics Service
- Components communicate via props/context inside the React App

##### Architectural patterns & design principles
- SPA with component-based architecture
- Static asset hosting for playlists (no dynamic backend)
- Separation of concerns: UI components vs. utilities (errorHandlers, analytics)
- Externalized config in config.js

## Diagram (Mermaid)

```mermaid
flowchart TB
  subgraph "User Environment"
    Browser["User Browser"]:::external
  end

  subgraph "Static JSON Store"
    direction TB
    StaticJSON["Static JSON Store"]:::data
    DadrockJson["dadrock.json"]:::data
    ElectionsJson["elections.json"]:::data
    TopTeledyskiJson["top_teledyski.json"]:::data
    StaticJSON --> DadrockJson
    StaticJSON --> ElectionsJson
    StaticJSON --> TopTeledyskiJson
  end

  subgraph "React SPA"
    direction TB
    IndexHTML["index.html"]:::asset
    IndexJS["index.js"]:::code
    AppComp["App"]:::code
    Home["HomeScreen"]:::component
    MusicChoose["MusicChooseScreen"]:::component
    GameForm["GameForm"]:::component
    GameScreen["GameScreen"]:::component
    VideoPlayer["VideoPlayer"]:::component
    PopUp["PopUpCard"]:::component
    Hearts["Hearts"]:::component
    ErrorUtils["errorHandlers"]:::util
    WebVitals["reportWebVitals"]:::util
    Config["config.js"]:::util
  end

  subgraph "External Services"
    ExternalVideo["External Video Source"]:::external
    Analytics["Analytics Service"]:::external
  end

  Browser -->|loads| IndexHTML
  IndexHTML --> IndexJS
  IndexJS --> AppComp
  IndexJS --> WebVitals
  AppComp --> Home
  AppComp --> ErrorUtils
  AppComp --> Config
  Home --> MusicChoose
  MusicChoose -->|FetchJSON| StaticJSON
  GameForm --> GameScreen
  GameScreen -->|FetchJSON| StaticJSON
  MusicChoose --> VideoPlayer
  VideoPlayer -->|Stream| ExternalVideo
  WebVitals -->|SendMetrics| Analytics

  classDef component fill:#DDEEFF,stroke:#3399FF,stroke-width:1px
  classDef data fill:#EEFFDD,stroke:#33AA33,stroke-width:1px
  classDef external fill:#FFEEDD,stroke:#FF9933,stroke-width:1px
  classDef code fill:#F5F5F5,stroke:#888888,stroke-width:1px,stroke-dasharray:2 2
  classDef asset fill:#FFF5CC,stroke:#CCCC00,stroke-width:1px
  classDef util fill:#F0F0F0,stroke:#666666,stroke-width:1px,stroke-dasharray:2 2

  click DadrockJson "https://github.com/herniezz/chronotune/blob/main/public/playlist/dadrock.json"
  click ElectionsJson "https://github.com/herniezz/chronotune/blob/main/public/playlist/elections.json"
  click TopTeledyskiJson "https://github.com/herniezz/chronotune/blob/main/public/playlist/top_teledyski.json"
  click IndexHTML "https://github.com/herniezz/chronotune/blob/main/public/index.html"
  click IndexJS "https://github.com/herniezz/chronotune/blob/main/src/index.js"
  click AppComp "https://github.com/herniezz/chronotune/blob/main/src/App.js"
  click Home "https://github.com/herniezz/chronotune/blob/main/src/components/HomeScreen.js"
  click MusicChoose "https://github.com/herniezz/chronotune/blob/main/src/components/MusicChooseScreen.js"
  click GameForm "https://github.com/herniezz/chronotune/blob/main/src/components/GameForm.js"
  click GameScreen "https://github.com/herniezz/chronotune/blob/main/src/components/GameScreen.js"
  click VideoPlayer "https://github.com/herniezz/chronotune/blob/main/src/components/VideoPlayer.js"
  click PopUp "https://github.com/herniezz/chronotune/blob/main/src/components/PopUpCard.js"
  click Hearts "https://github.com/herniezz/chronotune/blob/main/src/components/Hearts.js"
  click ErrorUtils "https://github.com/herniezz/chronotune/blob/main/src/utils/errorHandlers.js"
  click WebVitals "https://github.com/herniezz/chronotune/blob/main/src/reportWebVitals.js"
  click Config "https://github.com/herniezz/chronotune/blob/main/src/config.js"
```
