# keleviss/playlyst architecture

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

- Interactive diagram: https://gitdiagram.com/keleviss/playlyst
- Repository: https://github.com/keleviss/playlyst

## Overview

##### Project type and purpose
- Playlyst is a single-page, front-end web application built with React and Vite.
- It integrates with the Spotify Web API to authenticate users (OAuth 2.0 + PKCE), search for tracks, create and save playlists, and play music.
- It is deployed as a static site on Netlify.

##### File structure
- Top-level: package.json, vite.config.js, index.html – build and deployment configuration for a front-end app.
- src/main.jsx, src/App.jsx – entry point and root component.
- src/api – thin client wrappers around Spotify Web API (userLogin, searchTracks, savePlaylist).
- src/Features – feature-based modules, each using the container/presentational (components vs. containers) pattern and CSS Modules for scoped styles.
- src/Shared – reusable UI components (buttons, notifications, modals, track items).
- src/utils – pure utility functions (time formatting, notifications).

##### README for additional insights
- Confirms OAuth 2.0 PKCE flow, React hooks for state management, responsive design, and CSS Modules.
- Deployment target: Netlify.
- No custom backend; all business logic lives in the client and delegates to Spotify’s services.

## Diagram (Mermaid)

```mermaid
flowchart TB
    Netlify["Netlify CDN/Hosting"]:::infra
    Netlify -->|"Serves SPA (HTTPS)"| Browser

    subgraph "Browser (React SPA)"
        entry["Entry Point: src/main.jsx"]:::client
        root["Root Component: src/App.jsx"]:::client

        subgraph "API Layer"
            login["OAuth / User Login"]:::api
            search["Search Tracks"]:::api
            save["Save/Create Playlists"]:::api
        end

        subgraph "Features"
            subgraph "NavBar"
                navC["NavBar Container"]:::component
                userPanel["UserPanel"]:::component
                userProfile["UserProfile"]:::component
            end
            subgraph "SearchBar"
                searchC["SearchBar Container"]:::component
                searchComp["SearchBar"]:::component
            end
            subgraph "SearchResults"
                resC["Results Container"]:::component
                resComp["Results"]:::component
            end
            subgraph "Playlist Builder"
                plC["Playlist Container"]:::component
                plComp["Playlist"]:::component
            end
            subgraph "Playlist Embed"
                embed["PlaylistEmbed"]:::component
            end
        end

        subgraph "Shared Components"
            btn["Buttons"]:::shared
            notify["Notification"]:::shared
            modal["Saving Modal"]:::shared
            track["Track Item"]:::shared
            trackList["Track List"]:::shared
        end

        subgraph "Utils"
            utilTime["Time Formatting (msToMinSec)"]:::util
            utilNotif["Notification Helper"]:::util
        end
    end

    Browser -->|"OAuth2 + PKCE"| Auth["Spotify Authorization Server"]:::external
    Auth -->|"Access Token"| Browser
    Browser -->|"REST Search"| WebAPI["Spotify Web API"]:::external
    Browser -->|"REST Playlists"| WebAPI

    click entry "https://github.com/keleviss/playlyst/blob/master/src/main.jsx"
    click root "https://github.com/keleviss/playlyst/blob/master/src/App.jsx"
    click login "https://github.com/keleviss/playlyst/blob/master/src/api/userLogin.js"
    click search "https://github.com/keleviss/playlyst/blob/master/src/api/searchTracks.js"
    click save "https://github.com/keleviss/playlyst/blob/master/src/api/savePlaylist.js"
    click navC "https://github.com/keleviss/playlyst/blob/master/src/Features/NavBar/containers/NavBar.jsx"
    click userPanel "https://github.com/keleviss/playlyst/blob/master/src/Features/NavBar/components/UserPanel.jsx"
    click userProfile "https://github.com/keleviss/playlyst/blob/master/src/Features/NavBar/components/UserProfile.jsx"
    click searchC "https://github.com/keleviss/playlyst/blob/master/src/Features/SearchBar/containers/SearchBarContainer.jsx"
    click searchComp "https://github.com/keleviss/playlyst/blob/master/src/Features/SearchBar/components/SearchBar.jsx"
    click resC "https://github.com/keleviss/playlyst/blob/master/src/Features/SearchResults/containers/ResultsContainer.jsx"
    click resComp "https://github.com/keleviss/playlyst/blob/master/src/Features/SearchResults/components/Results.jsx"
    click plC "https://github.com/keleviss/playlyst/blob/master/src/Features/Playlist/containers/PlaylistContainer.jsx"
    click plComp "https://github.com/keleviss/playlyst/blob/master/src/Features/Playlist/components/Playlist.jsx"
    click embed "https://github.com/keleviss/playlyst/blob/master/src/Features/PlaylistEmbed/PlaylistEmbed.jsx"
    click btn "https://github.com/keleviss/playlyst/blob/master/src/Shared/components/Buttons.jsx"
    click notify "https://github.com/keleviss/playlyst/blob/master/src/Shared/components/Notification.jsx"
    click modal "https://github.com/keleviss/playlyst/blob/master/src/Shared/components/SavingModal.jsx"
    click track "https://github.com/keleviss/playlyst/blob/master/src/Shared/components/Track.jsx"
    click trackList "https://github.com/keleviss/playlyst/blob/master/src/Shared/components/TrackList.jsx"
    click utilTime "https://github.com/keleviss/playlyst/blob/master/src/utils/msToMinSec.js"
    click utilNotif "https://github.com/keleviss/playlyst/blob/master/src/utils/notifications.js"

    classDef client fill:#D0E6FF,stroke:#0366d6
    classDef api fill:#E2F0C6,stroke:#2D862D
    classDef component fill:#FFF4C1,stroke:#D69F00
    classDef shared fill:#FFD8B1,stroke:#D9730D
    classDef util fill:#F3DADD,stroke:#C1345B
    classDef external fill:#E0E0E0,stroke:#888888,stroke-dasharray: 5 5
    classDef infra fill:#E6E0FF,stroke:#6E3CBC,stroke-dasharray: 2 2
```
