# deekshith1707/syncwave architecture

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

- Interactive diagram: https://gitdiagram.com/deekshith1707/syncwave
- Repository: https://github.com/deekshith1707/syncwave

## Overview

SyncWave is a collaborative music-listening app: users authenticate, create or join a room, then share playback and room activity. The frontend routes users through authentication and into Home or a Session; backend HTTP routes handle identity, room membership, and song operations, while the server’s Socket.io handlers coordinate live room state. Songs are stored in Firebase and session/user records in MongoDB. Major components are retained from the source index and README; some frontend-to-backend wiring and unsampled features are documented but not visible in excerpts, so those links are dashed or omitted.

Main entry points: [`frontend/src/App.js`](https://github.com/deekshith1707/syncwave/blob/main/frontend/src/App.js) (App routing), [`frontend/src/context/AuthContext.js`](https://github.com/deekshith1707/syncwave/blob/main/frontend/src/context/AuthContext.js) (Auth state), [`Backend/server.js`](https://github.com/deekshith1707/syncwave/blob/main/Backend/server.js) (API and sockets), [`Backend/controllers/songController.js`](https://github.com/deekshith1707/syncwave/blob/main/Backend/controllers/songController.js) (Song handlers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web client"]
  node_app["App routing<br/>[App.js]"]
  node_authui["Auth screens<br/>[Auth.js]"]
  node_authredirect["OAuth redirect<br/>[AuthRedirect.js]"]
  node_authcontext["Auth state<br/>[AuthContext.js]"]
  node_authservice["Auth service<br/>[authServices.js]"]
  node_private["Route guard<br/>[PrivateRoute.js]"]
  node_home["Room discovery<br/>[Home.js]"]
  node_sessionui["Session room UI<br/>[Session.js]"]
end

subgraph group_api["HTTP API"]
  node_authroutes["Auth routes<br/>[authRoutes.js]"]
  node_authcontroller["Identity handlers<br/>[authController.js]"]
  node_authmiddleware["JWT protection<br/>[auth.js]"]
  node_sessionroutes["Session routes<br/>[sessionRoutes.js]"]
  node_sessioncontroller["Session handlers"]
  node_songroutes["Song routes<br/>[songRoutes.js]"]
  node_songcontroller["Song handlers<br/>[songController.js]"]
end

subgraph group_realtime["Live collaboration"]
  node_server["API and sockets<br/>[server.js]"]
end

subgraph group_data["Persistence and storage"]
  node_dbconfig["Database connection<br/>[db.js]"]
  node_userrecord[("User records<br/>[User.js]")]
  node_sessionrecord[("Session records<br/>[Session.js]")]
  node_songrecord[("Song records<br/>[Song.js]")]
end

node_user(("Listener"))
node_mongodb[("MongoDB")]
node_firebase[("Firebase Storage")]

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_authui
node_app -->|"routes to"| node_authredirect
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_sessionui
node_app -->|"guards routes"| node_private
node_app -->|"provides state"| node_authcontext
node_authui -->|"uses state"| node_authcontext
node_authredirect -->|"sets identity"| node_authcontext
node_authcontext -->|"loads user"| node_authservice
node_private -->|"checks identity"| node_authcontext
node_home -->|"reads identity"| node_authcontext
node_sessionui -->|"reads identity"| node_authcontext
node_authservice -.->|"calls auth API"| node_authroutes
node_authroutes -->|"dispatches"| node_authcontroller
node_authroutes -->|"protects profile"| node_authmiddleware
node_authcontroller -->|"reads and writes"| node_userrecord
node_sessionroutes -->|"dispatches"| node_sessioncontroller
node_sessionroutes -->|"protects routes"| node_authmiddleware
node_sessioncontroller -->|"reads and writes"| node_sessionrecord
node_sessioncontroller -->|"populates host"| node_userrecord
node_songroutes -->|"dispatches"| node_songcontroller
node_songroutes -->|"protects routes"| node_authmiddleware
node_songcontroller -->|"reads and updates"| node_sessionrecord
node_songcontroller -->|"creates and reads"| node_songrecord
node_songcontroller -->|"uploads audio"| node_firebase
node_server -->|"mounts routes"| node_authroutes
node_server -->|"mounts routes"| node_sessionroutes
node_server -->|"mounts routes"| node_songroutes
node_server -->|"connects database"| node_dbconfig
node_server -->|"persists room state"| node_sessionrecord
node_dbconfig -.->|"connects"| node_mongodb
node_sessionui -.->|"exchanges live events"| node_server

click node_app "https://github.com/deekshith1707/syncwave/blob/main/frontend/src/App.js"
click node_authui "https://github.com/deekshith1707/syncwave/blob/main/frontend/src/components/Auth/Auth.js"
click node_authredirect "https://github.com/deekshith1707/syncwave/blob/main/frontend/src/pages/AuthRedirect.js"
click node_authcontext "https://github.com/deekshith1707/syncwave/blob/main/frontend/src/context/AuthContext.js"
click node_authservice "https://github.com/deekshith1707/syncwave/blob/main/frontend/src/services/authServices.js"
click node_private "https://github.com/deekshith1707/syncwave/blob/main/frontend/src/components/PrivateRoute.js"
click node_home "https://github.com/deekshith1707/syncwave/blob/main/frontend/src/pages/Home.js"
click node_sessionui "https://github.com/deekshith1707/syncwave/blob/main/frontend/src/pages/Session.js"
click node_authroutes "https://github.com/deekshith1707/syncwave/blob/main/Backend/routes/authRoutes.js"
click node_authcontroller "https://github.com/deekshith1707/syncwave/blob/main/Backend/controllers/authController.js"
click node_authmiddleware "https://github.com/deekshith1707/syncwave/blob/main/Backend/middleware/auth.js"
click node_sessionroutes "https://github.com/deekshith1707/syncwave/blob/main/Backend/routes/sessionRoutes.js"
click node_sessioncontroller "https://github.com/deekshith1707/syncwave/blob/main/Backend/controllers/sessionController.js"
click node_songroutes "https://github.com/deekshith1707/syncwave/blob/main/Backend/routes/songRoutes.js"
click node_songcontroller "https://github.com/deekshith1707/syncwave/blob/main/Backend/controllers/songController.js"
click node_server "https://github.com/deekshith1707/syncwave/blob/main/Backend/server.js"
click node_dbconfig "https://github.com/deekshith1707/syncwave/blob/main/Backend/config/db.js"
click node_userrecord "https://github.com/deekshith1707/syncwave/blob/main/Backend/models/User.js"
click node_sessionrecord "https://github.com/deekshith1707/syncwave/blob/main/Backend/models/Session.js"
click node_songrecord "https://github.com/deekshith1707/syncwave/blob/main/Backend/models/Song.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_authui,node_authredirect,node_authcontext,node_authservice,node_private,node_home,node_sessionui toneBlue
class node_authroutes,node_authcontroller,node_authmiddleware,node_sessionroutes,node_sessioncontroller,node_songroutes,node_songcontroller,node_mongodb,node_firebase toneAmber
class node_server toneMint
class node_dbconfig,node_userrecord,node_sessionrecord,node_songrecord toneRose
class node_user toneIndigo
```

## Components

### Web client

- [App routing](https://github.com/deekshith1707/syncwave/blob/main/frontend/src/App.js): `frontend/src/App.js`
- [Auth screens](https://github.com/deekshith1707/syncwave/blob/main/frontend/src/components/Auth/Auth.js): `frontend/src/components/Auth/Auth.js`
- [OAuth redirect](https://github.com/deekshith1707/syncwave/blob/main/frontend/src/pages/AuthRedirect.js): `frontend/src/pages/AuthRedirect.js`
- [Auth state](https://github.com/deekshith1707/syncwave/blob/main/frontend/src/context/AuthContext.js): `frontend/src/context/AuthContext.js`
- [Auth service](https://github.com/deekshith1707/syncwave/blob/main/frontend/src/services/authServices.js): `frontend/src/services/authServices.js`
- [Route guard](https://github.com/deekshith1707/syncwave/blob/main/frontend/src/components/PrivateRoute.js): `frontend/src/components/PrivateRoute.js`
- [Room discovery](https://github.com/deekshith1707/syncwave/blob/main/frontend/src/pages/Home.js): `frontend/src/pages/Home.js`
- [Session room UI](https://github.com/deekshith1707/syncwave/blob/main/frontend/src/pages/Session.js): `frontend/src/pages/Session.js`

### HTTP API

- [Auth routes](https://github.com/deekshith1707/syncwave/blob/main/Backend/routes/authRoutes.js): `Backend/routes/authRoutes.js`
- [Identity handlers](https://github.com/deekshith1707/syncwave/blob/main/Backend/controllers/authController.js): `Backend/controllers/authController.js`
- [JWT protection](https://github.com/deekshith1707/syncwave/blob/main/Backend/middleware/auth.js): `Backend/middleware/auth.js`
- [Session routes](https://github.com/deekshith1707/syncwave/blob/main/Backend/routes/sessionRoutes.js): `Backend/routes/sessionRoutes.js`
- [Session handlers](https://github.com/deekshith1707/syncwave/blob/main/Backend/controllers/sessionController.js): `Backend/controllers/sessionController.js`
- [Song routes](https://github.com/deekshith1707/syncwave/blob/main/Backend/routes/songRoutes.js): `Backend/routes/songRoutes.js`
- [Song handlers](https://github.com/deekshith1707/syncwave/blob/main/Backend/controllers/songController.js): `Backend/controllers/songController.js`

### Live collaboration

- [API and sockets](https://github.com/deekshith1707/syncwave/blob/main/Backend/server.js): `Backend/server.js`

### Persistence and storage

- [Database connection](https://github.com/deekshith1707/syncwave/blob/main/Backend/config/db.js): `Backend/config/db.js`
- [User records](https://github.com/deekshith1707/syncwave/blob/main/Backend/models/User.js): `Backend/models/User.js`
- [Session records](https://github.com/deekshith1707/syncwave/blob/main/Backend/models/Session.js): `Backend/models/Session.js`
- [Song records](https://github.com/deekshith1707/syncwave/blob/main/Backend/models/Song.js): `Backend/models/Song.js`

### Other components

- **Listener**
- **MongoDB**
- **Firebase Storage**

## Connections

- Listener → App routing: uses (evidence: `frontend/src/App.js`)
- App routing → Auth screens: routes to (evidence: `frontend/src/App.js`)
- App routing → OAuth redirect: routes to (evidence: `frontend/src/App.js`)
- App routing → Room discovery: routes to (evidence: `frontend/src/App.js`)
- App routing → Session room UI: routes to (evidence: `frontend/src/App.js`)
- App routing → Route guard: guards routes (evidence: `frontend/src/App.js`)
- App routing → Auth state: provides state (evidence: `frontend/src/App.js`)
- Auth screens → Auth state: uses state (evidence: `frontend/src/components/Auth/Auth.js`)
- OAuth redirect → Auth state: sets identity (evidence: `frontend/src/pages/AuthRedirect.js`)
- Auth state → Auth service: loads user (evidence: `frontend/src/context/AuthContext.js`)
- Route guard → Auth state: checks identity (evidence: `frontend/src/components/PrivateRoute.js`)
- Room discovery → Auth state: reads identity (evidence: `frontend/src/pages/Home.js`)
- Session room UI → Auth state: reads identity (evidence: `frontend/src/pages/Session.js`)
- Auth service → Auth routes: calls auth API
- Auth routes → Identity handlers: dispatches (evidence: `Backend/routes/authRoutes.js`)
- Auth routes → JWT protection: protects profile (evidence: `Backend/routes/authRoutes.js`)
- Identity handlers → User records: reads and writes (evidence: `Backend/controllers/authController.js`)
- Session routes → Session handlers: dispatches (evidence: `Backend/routes/sessionRoutes.js`)
- Session routes → JWT protection: protects routes (evidence: `Backend/routes/sessionRoutes.js`)
- Session handlers → Session records: reads and writes (evidence: `Backend/controllers/sessionController.js`)
- Session handlers → User records: populates host (evidence: `Backend/controllers/sessionController.js`)
- Song routes → Song handlers: dispatches (evidence: `Backend/routes/songRoutes.js`)
- Song routes → JWT protection: protects routes (evidence: `Backend/routes/songRoutes.js`)
- Song handlers → Session records: reads and updates (evidence: `Backend/controllers/songController.js`)
- Song handlers → Song records: creates and reads (evidence: `Backend/controllers/songController.js`)
- Song handlers → Firebase Storage: uploads audio (evidence: `Backend/controllers/songController.js`)
- API and sockets → Auth routes: mounts routes (evidence: `Backend/server.js`)
- API and sockets → Session routes: mounts routes (evidence: `Backend/server.js`)
- API and sockets → Song routes: mounts routes (evidence: `Backend/server.js`)
- API and sockets → Database connection: connects database (evidence: `Backend/server.js`)
- API and sockets → Session records: persists room state (evidence: `Backend/server.js`)
- Database connection → MongoDB: connects
- Session room UI → API and sockets: exchanges live events (evidence: `README.md`)
