# mahessh9848/swaram-music architecture

> Architecture diagram of the GitHub repository mahessh9848/swaram-music, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mahessh9848/swaram-music
- Repository: https://github.com/mahessh9848/swaram-music

## Overview

Swaram is a mood-based music web app: users choose a mood and language, browse its playlist, and play tracks; they can also import and manage local MP3s. The frontend owns the main experience, playback, demo authentication, and preferences. An optional Express API exposes mood, playlist, history, and favorite operations backed by Oracle when configured, with fallback data for some reads. The README documents broader database capabilities, but database scripts are not present in this tree. Unsampled frontend modules are included where the tree and README establish their role; uncertain connections are omitted or marked dashed.

Main entry points: [`frontend/src/pages/Home.jsx`](https://github.com/mahessh9848/swaram-music/blob/main/frontend/src/pages/Home.jsx) (Home orchestration), [`frontend/src/components/MoodSelector.jsx`](https://github.com/mahessh9848/swaram-music/blob/main/frontend/src/components/MoodSelector.jsx) (Mood selection), [`frontend/src/hooks/usePlayer.js`](https://github.com/mahessh9848/swaram-music/blob/main/frontend/src/hooks/usePlayer.js) (Player state and queue), [`frontend/src/App.jsx`](https://github.com/mahessh9848/swaram-music/blob/main/frontend/src/App.jsx) (React app entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Mood experience"]
  node_app["React app entry<br/>[App.jsx]"]
  node_home["Home orchestration<br/>[Home.jsx]"]
  node_mooddata["Mood catalog<br/>[moods.js]"]
  node_moodselection["Mood selection<br/>[MoodSelector.jsx]"]
  node_moodcard["Mood card<br/>[MoodCard.jsx]"]
  node_moodhero["Mood artwork<br/>[MoodHero.jsx]"]
  node_playlist["Mood playlist"]
  node_songcard["Song card<br/>[SongCard.jsx]"]
end

subgraph group_playback["Playback and library"]
  node_musiclibrary["Local music library<br/>[MusicLibrary.jsx]"]
  node_localstore[("Imported track storage<br/>[musicStorage.js]")]
  node_playerui["Player controls<br/>[MusicPlayer.jsx]"]
  node_playerhook["Player state and queue<br/>[usePlayer.js]"]
  node_audioengine["HTML audio engine<br/>[audioEngine.js]"]
  node_playbackadapter["Playback adapter<br/>[playbackAdapter.js]"]
  node_playercontroller["Player controller"]
end

subgraph group_backend["API and data"]
  node_backendapp["Express API app<br/>[app.js]"]
  node_routes["API routes<br/>[index.js]"]
  node_controller["Music API controller<br/>[musicController.js]"]
  node_service["Music service<br/>[musicService.js]"]
  node_db["Oracle connection layer<br/>[index.js]"]
  node_api["Frontend API client<br/>[api.js]"]
end

subgraph group_preferences["User preferences"]
  node_login["Demo login modal<br/>[LoginModal.jsx]"]
  node_auth["Demo authentication<br/>[useAuth.js]"]
  node_language["Language preferences<br/>[languages.js]"]
  node_theme["Theme preference<br/>[useTheme.js]"]
end

node_listener(("Listener"))
node_oracle[("Oracle database")]

node_listener -->|"opens"| node_app
node_app -->|"renders"| node_home
node_home -->|"selects mood"| node_mooddata
node_home -->|"renders"| node_moodselection
node_home -->|"renders"| node_moodhero
node_home -->|"renders"| node_playlist
node_moodselection -->|"renders"| node_moodcard
node_moodselection -->|"selects language"| node_language
node_playlist -->|"renders"| node_songcard
node_home -->|"manages playback"| node_playerhook
node_home -->|"renders"| node_musiclibrary
node_home -->|"renders"| node_login
node_home -->|"manages login"| node_auth
node_home -->|"manages theme"| node_theme
node_musiclibrary -->|"manages tracks"| node_localstore
node_playerui -.->|"controls playback"| node_playerhook
node_playerhook -->|"controls audio"| node_audioengine
node_playercontroller -->|"uses adapter"| node_playbackadapter
node_backendapp -->|"mounts routes"| node_routes
node_routes -->|"routes requests"| node_controller
node_controller -->|"calls service"| node_service
node_service -->|"queries database"| node_db
node_db -->|"executes SQL"| node_oracle
node_api -.->|"calls API"| node_backendapp

click node_app "https://github.com/mahessh9848/swaram-music/blob/main/frontend/src/App.jsx"
click node_home "https://github.com/mahessh9848/swaram-music/blob/main/frontend/src/pages/Home.jsx"
click node_mooddata "https://github.com/mahessh9848/swaram-music/blob/main/frontend/src/data/moods.js"
click node_moodselection "https://github.com/mahessh9848/swaram-music/blob/main/frontend/src/components/MoodSelector.jsx"
click node_moodcard "https://github.com/mahessh9848/swaram-music/blob/main/frontend/src/components/MoodCard.jsx"
click node_moodhero "https://github.com/mahessh9848/swaram-music/blob/main/frontend/src/components/MoodHero.jsx"
click node_playlist "https://github.com/mahessh9848/swaram-music/blob/main/frontend/src/components/PlaylistSection.jsx"
click node_songcard "https://github.com/mahessh9848/swaram-music/blob/main/frontend/src/components/SongCard.jsx"
click node_musiclibrary "https://github.com/mahessh9848/swaram-music/blob/main/frontend/src/components/MusicLibrary.jsx"
click node_localstore "https://github.com/mahessh9848/swaram-music/blob/main/frontend/src/storage/musicStorage.js"
click node_playerui "https://github.com/mahessh9848/swaram-music/blob/main/frontend/src/components/MusicPlayer.jsx"
click node_playerhook "https://github.com/mahessh9848/swaram-music/blob/main/frontend/src/hooks/usePlayer.js"
click node_audioengine "https://github.com/mahessh9848/swaram-music/blob/main/frontend/src/player/audioEngine.js"
click node_playbackadapter "https://github.com/mahessh9848/swaram-music/blob/main/frontend/src/player/playbackAdapter.js"
click node_playercontroller "https://github.com/mahessh9848/swaram-music/blob/main/frontend/src/player/playerController.js"
click node_login "https://github.com/mahessh9848/swaram-music/blob/main/frontend/src/components/LoginModal.jsx"
click node_auth "https://github.com/mahessh9848/swaram-music/blob/main/frontend/src/hooks/useAuth.js"
click node_language "https://github.com/mahessh9848/swaram-music/blob/main/frontend/src/data/languages.js"
click node_theme "https://github.com/mahessh9848/swaram-music/blob/main/frontend/src/hooks/useTheme.js"
click node_backendapp "https://github.com/mahessh9848/swaram-music/blob/main/backend/src/app.js"
click node_routes "https://github.com/mahessh9848/swaram-music/blob/main/backend/src/routes/index.js"
click node_controller "https://github.com/mahessh9848/swaram-music/blob/main/backend/src/controllers/musicController.js"
click node_service "https://github.com/mahessh9848/swaram-music/blob/main/backend/src/services/musicService.js"
click node_db "https://github.com/mahessh9848/swaram-music/blob/main/backend/src/db/index.js"
click node_api "https://github.com/mahessh9848/swaram-music/blob/main/frontend/src/services/api.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_home,node_mooddata,node_moodselection,node_moodcard,node_moodhero,node_playlist,node_songcard toneBlue
class node_musiclibrary,node_localstore,node_playerui,node_playerhook,node_audioengine,node_playbackadapter,node_playercontroller,node_oracle toneAmber
class node_backendapp,node_routes,node_controller,node_service,node_db,node_api toneMint
class node_login,node_auth,node_language,node_theme toneRose
class node_listener toneIndigo
```

## Components

### Mood experience

- [React app entry](https://github.com/mahessh9848/swaram-music/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Home orchestration](https://github.com/mahessh9848/swaram-music/blob/main/frontend/src/pages/Home.jsx): `frontend/src/pages/Home.jsx`
- [Mood catalog](https://github.com/mahessh9848/swaram-music/blob/main/frontend/src/data/moods.js): `frontend/src/data/moods.js`
- [Mood selection](https://github.com/mahessh9848/swaram-music/blob/main/frontend/src/components/MoodSelector.jsx): `frontend/src/components/MoodSelector.jsx`
- [Mood card](https://github.com/mahessh9848/swaram-music/blob/main/frontend/src/components/MoodCard.jsx): `frontend/src/components/MoodCard.jsx`
- [Mood artwork](https://github.com/mahessh9848/swaram-music/blob/main/frontend/src/components/MoodHero.jsx): `frontend/src/components/MoodHero.jsx`
- [Mood playlist](https://github.com/mahessh9848/swaram-music/blob/main/frontend/src/components/PlaylistSection.jsx): `frontend/src/components/PlaylistSection.jsx`
- [Song card](https://github.com/mahessh9848/swaram-music/blob/main/frontend/src/components/SongCard.jsx): `frontend/src/components/SongCard.jsx`

### Playback and library

- [Local music library](https://github.com/mahessh9848/swaram-music/blob/main/frontend/src/components/MusicLibrary.jsx): `frontend/src/components/MusicLibrary.jsx`
- [Imported track storage](https://github.com/mahessh9848/swaram-music/blob/main/frontend/src/storage/musicStorage.js): `frontend/src/storage/musicStorage.js`
- [Player controls](https://github.com/mahessh9848/swaram-music/blob/main/frontend/src/components/MusicPlayer.jsx): `frontend/src/components/MusicPlayer.jsx`
- [Player state and queue](https://github.com/mahessh9848/swaram-music/blob/main/frontend/src/hooks/usePlayer.js): `frontend/src/hooks/usePlayer.js`
- [HTML audio engine](https://github.com/mahessh9848/swaram-music/blob/main/frontend/src/player/audioEngine.js): `frontend/src/player/audioEngine.js`
- [Playback adapter](https://github.com/mahessh9848/swaram-music/blob/main/frontend/src/player/playbackAdapter.js): `frontend/src/player/playbackAdapter.js`
- [Player controller](https://github.com/mahessh9848/swaram-music/blob/main/frontend/src/player/playerController.js): `frontend/src/player/playerController.js`

### API and data

- [Express API app](https://github.com/mahessh9848/swaram-music/blob/main/backend/src/app.js): `backend/src/app.js`
- [API routes](https://github.com/mahessh9848/swaram-music/blob/main/backend/src/routes/index.js): `backend/src/routes/index.js`
- [Music API controller](https://github.com/mahessh9848/swaram-music/blob/main/backend/src/controllers/musicController.js): `backend/src/controllers/musicController.js`
- [Music service](https://github.com/mahessh9848/swaram-music/blob/main/backend/src/services/musicService.js): `backend/src/services/musicService.js`
- [Oracle connection layer](https://github.com/mahessh9848/swaram-music/blob/main/backend/src/db/index.js): `backend/src/db/index.js`
- [Frontend API client](https://github.com/mahessh9848/swaram-music/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`

### User preferences

- [Demo login modal](https://github.com/mahessh9848/swaram-music/blob/main/frontend/src/components/LoginModal.jsx): `frontend/src/components/LoginModal.jsx`
- [Demo authentication](https://github.com/mahessh9848/swaram-music/blob/main/frontend/src/hooks/useAuth.js): `frontend/src/hooks/useAuth.js`
- [Language preferences](https://github.com/mahessh9848/swaram-music/blob/main/frontend/src/data/languages.js): `frontend/src/data/languages.js`
- [Theme preference](https://github.com/mahessh9848/swaram-music/blob/main/frontend/src/hooks/useTheme.js): `frontend/src/hooks/useTheme.js`

### Other components

- **Listener**
- **Oracle database**

## Connections

- Listener → React app entry: opens
- React app entry → Home orchestration: renders (evidence: `frontend/src/App.jsx`)
- Home orchestration → Mood catalog: selects mood (evidence: `frontend/src/pages/Home.jsx`)
- Home orchestration → Mood selection: renders (evidence: `frontend/src/pages/Home.jsx`)
- Home orchestration → Mood artwork: renders (evidence: `frontend/src/pages/Home.jsx`)
- Home orchestration → Mood playlist: renders (evidence: `frontend/src/pages/Home.jsx`)
- Mood selection → Mood card: renders (evidence: `frontend/src/components/MoodSelector.jsx`)
- Mood selection → Language preferences: selects language (evidence: `frontend/src/components/MoodSelector.jsx`)
- Mood playlist → Song card: renders (evidence: `frontend/src/components/PlaylistSection.jsx`)
- Home orchestration → Player state and queue: manages playback (evidence: `frontend/src/pages/Home.jsx`)
- Home orchestration → Local music library: renders (evidence: `frontend/src/pages/Home.jsx`)
- Home orchestration → Demo login modal: renders (evidence: `frontend/src/pages/Home.jsx`)
- Home orchestration → Demo authentication: manages login (evidence: `frontend/src/pages/Home.jsx`)
- Home orchestration → Theme preference: manages theme (evidence: `frontend/src/pages/Home.jsx`)
- Local music library → Imported track storage: manages tracks (evidence: `frontend/src/components/MusicLibrary.jsx`)
- Player controls → Player state and queue: controls playback
- Player state and queue → HTML audio engine: controls audio (evidence: `frontend/src/hooks/usePlayer.js`)
- Player controller → Playback adapter: uses adapter (evidence: `frontend/src/player/playerController.js`)
- Express API app → API routes: mounts routes (evidence: `backend/src/app.js`)
- API routes → Music API controller: routes requests (evidence: `backend/src/routes/index.js`)
- Music API controller → Music service: calls service (evidence: `backend/src/controllers/musicController.js`)
- Music service → Oracle connection layer: queries database (evidence: `backend/src/services/musicService.js`)
- Oracle connection layer → Oracle database: executes SQL (evidence: `backend/src/db/index.js`)
- Frontend API client → Express API app: calls API
