# ansh-raj08/moodsync architecture

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

- Interactive diagram: https://gitdiagram.com/ansh-raj08/moodsync
- Repository: https://github.com/ansh-raj08/moodsync

## Overview

MoodSync is a couples’ mood-tracking web app. Users create accounts, pair via codes and requests, log daily moods, then view shared trends and relationship-health insights; they can also chat, review history, manage dissolution, share location, and place voice calls. The static pages load browser JavaScript that uses a shared Supabase client for authentication, database access, and realtime features. Edges follow README statements or shown source calls; location and voice features are included from the source index, but their page wiring and some integrations were not fully sampled.

Main entry points: [`js/auth.js`](https://github.com/ansh-raj08/moodsync/blob/master/js/auth.js) (Authentication), [`js/dashboard.js`](https://github.com/ansh-raj08/moodsync/blob/master/js/dashboard.js) (Relationship dashboard), [`js/chat.js`](https://github.com/ansh-raj08/moodsync/blob/master/js/chat.js) (Partner chat), [`js/voice-call.js`](https://github.com/ansh-raj08/moodsync/blob/master/js/voice-call.js) (Voice calling)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_account["Account and pairing"]
  node_authpages["Account pages<br/>[login.html]"]
  node_auth["Authentication<br/>[auth.js]"]
  node_pairpage["Pairing page<br/>[pair.html]"]
  node_pairing["Partner pairing<br/>[pairing.js]"]
  node_settings["Relationship settings<br/>[settings.js]"]
end

subgraph group_moods["Mood insights"]
  node_moodpage["Mood check-in<br/>[mood.html]"]
  node_mood["Mood logging<br/>[mood.js]"]
  node_dashboard["Relationship dashboard<br/>[dashboard.js]"]
  node_health["Health score<br/>[algorithm.js]"]
  node_history["Mood history<br/>[mood-history.js]"]
end

subgraph group_connection["Partner connections"]
  node_chat["Partner chat<br/>[chat.js]"]
  node_voice["Voice calling<br/>[voice-call.js]"]
  node_voiceui["Call interface<br/>[voice-call-ui.js]"]
  node_location["Location sharing<br/>[location.js]"]
end

subgraph group_platform["Shared platform"]
  node_data["Data utilities<br/>[data.js]"]
  node_client["Supabase client<br/>[supabaseClient.js]"]
  node_ui["Shared UI helpers<br/>[ui.js]"]
end

node_user(("Couple user"))
node_supabase[("Supabase services")]

node_user -->|"signs in"| node_authpages
node_authpages -->|"submits credentials"| node_auth
node_auth -->|"uses client"| node_client
node_client -->|"auth and data"| node_supabase
node_auth -->|"redirects unpaired"| node_pairpage
node_user -->|"enters pair code"| node_pairpage
node_pairpage -->|"submits request"| node_pairing
node_pairing -->|"reads and writes pairing"| node_supabase
node_user -->|"logs mood"| node_moodpage
node_moodpage -->|"submits entry"| node_mood
node_mood -->|"writes mood log"| node_supabase
node_dashboard -->|"loads mood data"| node_data
node_dashboard -->|"calculates score"| node_health
node_user -->|"views insights"| node_dashboard
node_dashboard -->|"subscribes to updates"| node_supabase
node_user -->|"views history"| node_history
node_history -->|"reads and deletes logs"| node_supabase
node_user -->|"manages relationship"| node_settings
node_settings -.->|"uses dissolution utilities"| node_data
node_user -->|"messages partner"| node_chat
node_chat -->|"loads and syncs messages"| node_supabase
node_chat -->|"initializes calls"| node_voice
node_voice -->|"initializes interface"| node_voiceui
node_voice -->|"signals calls"| node_supabase
node_user -.->|"shares location"| node_location
node_location -.->|"stores location"| node_supabase
node_data -->|"queries and subscribes"| node_supabase
node_auth -->|"authenticates users"| node_supabase
node_user -.->|"receives feedback"| node_ui

click node_authpages "https://github.com/ansh-raj08/moodsync/blob/master/login.html"
click node_auth "https://github.com/ansh-raj08/moodsync/blob/master/js/auth.js"
click node_pairpage "https://github.com/ansh-raj08/moodsync/blob/master/pair.html"
click node_pairing "https://github.com/ansh-raj08/moodsync/blob/master/js/pairing.js"
click node_moodpage "https://github.com/ansh-raj08/moodsync/blob/master/mood.html"
click node_mood "https://github.com/ansh-raj08/moodsync/blob/master/js/mood.js"
click node_dashboard "https://github.com/ansh-raj08/moodsync/blob/master/js/dashboard.js"
click node_health "https://github.com/ansh-raj08/moodsync/blob/master/js/algorithm.js"
click node_history "https://github.com/ansh-raj08/moodsync/blob/master/js/mood-history.js"
click node_settings "https://github.com/ansh-raj08/moodsync/blob/master/js/settings.js"
click node_chat "https://github.com/ansh-raj08/moodsync/blob/master/js/chat.js"
click node_voice "https://github.com/ansh-raj08/moodsync/blob/master/js/voice-call.js"
click node_voiceui "https://github.com/ansh-raj08/moodsync/blob/master/js/voice-call-ui.js"
click node_location "https://github.com/ansh-raj08/moodsync/blob/master/js/location.js"
click node_data "https://github.com/ansh-raj08/moodsync/blob/master/js/data.js"
click node_client "https://github.com/ansh-raj08/moodsync/blob/master/js/supabaseClient.js"
click node_ui "https://github.com/ansh-raj08/moodsync/blob/master/js/ui.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_authpages,node_auth,node_pairpage,node_pairing,node_settings,node_user toneBlue
class node_moodpage,node_mood,node_dashboard,node_health,node_history,node_supabase toneAmber
class node_chat,node_voice,node_voiceui,node_location toneMint
class node_data,node_client,node_ui toneRose
```

## Components

### Account and pairing

- [Account pages](https://github.com/ansh-raj08/moodsync/blob/master/login.html): `login.html`
- [Authentication](https://github.com/ansh-raj08/moodsync/blob/master/js/auth.js): `js/auth.js`
- [Pairing page](https://github.com/ansh-raj08/moodsync/blob/master/pair.html): `pair.html`
- [Partner pairing](https://github.com/ansh-raj08/moodsync/blob/master/js/pairing.js): `js/pairing.js`
- [Relationship settings](https://github.com/ansh-raj08/moodsync/blob/master/js/settings.js): `js/settings.js`

### Mood insights

- [Mood check-in](https://github.com/ansh-raj08/moodsync/blob/master/mood.html): `mood.html`
- [Mood logging](https://github.com/ansh-raj08/moodsync/blob/master/js/mood.js): `js/mood.js`
- [Relationship dashboard](https://github.com/ansh-raj08/moodsync/blob/master/js/dashboard.js): `js/dashboard.js`
- [Health score](https://github.com/ansh-raj08/moodsync/blob/master/js/algorithm.js): `js/algorithm.js`
- [Mood history](https://github.com/ansh-raj08/moodsync/blob/master/js/mood-history.js): `js/mood-history.js`

### Partner connections

- [Partner chat](https://github.com/ansh-raj08/moodsync/blob/master/js/chat.js): `js/chat.js`
- [Voice calling](https://github.com/ansh-raj08/moodsync/blob/master/js/voice-call.js): `js/voice-call.js`
- [Call interface](https://github.com/ansh-raj08/moodsync/blob/master/js/voice-call-ui.js): `js/voice-call-ui.js`
- [Location sharing](https://github.com/ansh-raj08/moodsync/blob/master/js/location.js): `js/location.js`

### Shared platform

- [Data utilities](https://github.com/ansh-raj08/moodsync/blob/master/js/data.js): `js/data.js`
- [Supabase client](https://github.com/ansh-raj08/moodsync/blob/master/js/supabaseClient.js): `js/supabaseClient.js`
- [Shared UI helpers](https://github.com/ansh-raj08/moodsync/blob/master/js/ui.js): `js/ui.js`

### Other components

- **Couple user**
- **Supabase services**

## Connections

- Couple user → Account pages: signs in (evidence: `README.md`)
- Account pages → Authentication: submits credentials (evidence: `README.md`)
- Authentication → Supabase client: uses client (evidence: `js/auth.js`)
- Supabase client → Supabase services: auth and data (evidence: `js/supabaseClient.js`)
- Authentication → Pairing page: redirects unpaired (evidence: `js/auth.js`)
- Couple user → Pairing page: enters pair code (evidence: `README.md`)
- Pairing page → Partner pairing: submits request (evidence: `README.md`)
- Partner pairing → Supabase services: reads and writes pairing (evidence: `README.md`)
- Couple user → Mood check-in: logs mood (evidence: `README.md`)
- Mood check-in → Mood logging: submits entry (evidence: `README.md`)
- Mood logging → Supabase services: writes mood log (evidence: `README.md`)
- Relationship dashboard → Data utilities: loads mood data (evidence: `js/dashboard.js`)
- Relationship dashboard → Health score: calculates score (evidence: `README.md`)
- Couple user → Relationship dashboard: views insights (evidence: `README.md`)
- Relationship dashboard → Supabase services: subscribes to updates (evidence: `README.md`)
- Couple user → Mood history: views history (evidence: `README.md`)
- Mood history → Supabase services: reads and deletes logs (evidence: `js/mood-history.js`)
- Couple user → Relationship settings: manages relationship (evidence: `README.md`)
- Relationship settings → Data utilities: uses dissolution utilities
- Couple user → Partner chat: messages partner (evidence: `README.md`)
- Partner chat → Supabase services: loads and syncs messages (evidence: `README.md`)
- Partner chat → Voice calling: initializes calls (evidence: `js/chat.js`)
- Voice calling → Call interface: initializes interface
- Voice calling → Supabase services: signals calls (evidence: `js/voice-call.js`)
- Couple user → Location sharing: shares location
- Location sharing → Supabase services: stores location
- Data utilities → Supabase services: queries and subscribes (evidence: `js/data.js`)
- Authentication → Supabase services: authenticates users (evidence: `js/auth.js`)
- Couple user → Shared UI helpers: receives feedback
