# kushalshrestha303-web/balanceboard architecture

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

- Interactive diagram: https://gitdiagram.com/kushalshrestha303-web/balanceboard
- Repository: https://github.com/kushalshrestha303-web/balanceboard

## Overview

BalanceBoard is a full-stack study productivity and wellbeing app. Users sign in, then manage tasks, exercise, scheduled sessions, focus time, mood and hydration; the dashboard and dedicated pages present saved progress, analytics and achievements. The frontend routes through shared auth, dashboard and timer state to an HTTP API, with Express persisting per-user data in SQLite. The README documents backend validation, Google sign-in, and browser alarms/notifications; excerpts establish only selected implementation links, so unsampled subsystem connections are left out.

Main entry points: [`src/App.jsx`](https://github.com/kushalshrestha303-web/balanceboard/blob/main/src/App.jsx) (Route app), [`src/context/DashboardContext.jsx`](https://github.com/kushalshrestha303-web/balanceboard/blob/main/src/context/DashboardContext.jsx) (Dashboard state), [`src/pages/Dashboard.jsx`](https://github.com/kushalshrestha303-web/balanceboard/blob/main/src/pages/Dashboard.jsx) (Dashboard), [`src/components/layout/Layout.jsx`](https://github.com/kushalshrestha303-web/balanceboard/blob/main/src/components/layout/Layout.jsx) (Shared layout)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend experience"]
  node_app["Route app<br/>[App.jsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.jsx]"]
  node_calendar["Calendar<br/>[Calendar.jsx]"]
  node_analytics["Analytics<br/>[Analytics.jsx]"]
  node_achievements["Achievements<br/>[Achievements.jsx]"]
  node_profile["Profile<br/>[Profile.jsx]"]
  node_login["Sign in<br/>[Login.jsx]"]
  node_layout["Shared layout<br/>[Layout.jsx]"]
  node_reminders["Reminders<br/>[Reminders.jsx]"]
  node_alarms["Alarm effects<br/>[alarms.js]"]
  node_tasks["Study tasks<br/>[AddTask.jsx]"]
  node_exercise["Exercise tracking<br/>[AddExercise.jsx]"]
  node_wellness["Mood and hydration<br/>[WaterTracker.jsx]"]
end

subgraph group_state["Shared application state"]
  node_auth["Auth state<br/>[AuthContext.jsx]"]
  node_dashboardstate["Dashboard state"]
  node_timerstate["Timer state<br/>[TimerContext.jsx]"]
end

subgraph group_backend["API and services"]
  node_api["HTTP client<br/>[api.js]"]
  node_express["Express API<br/>[server.js]"]
  node_google["Google identity<br/>[googleAuth.js]"]
  node_timerlogic["Timer actions<br/>[timer.js]"]
end

subgraph group_persistence["Persistent data"]
  node_sqlite[("SQLite database<br/>[server.js]")]
end

node_user(("User"))

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_calendar
node_app -->|"routes to"| node_analytics
node_app -->|"routes to"| node_achievements
node_app -->|"routes to"| node_profile
node_app -->|"checks session"| node_auth
node_dashboard -->|"renders"| node_layout
node_calendar -->|"renders"| node_layout
node_analytics -->|"renders"| node_layout
node_achievements -->|"renders"| node_layout
node_profile -->|"renders"| node_layout
node_dashboard -->|"renders"| node_tasks
node_dashboard -->|"renders"| node_exercise
node_dashboard -->|"renders"| node_wellness
node_dashboard -->|"selects timer"| node_timerstate
node_layout -->|"renders"| node_reminders
node_reminders -->|"plays or vibrates"| node_alarms
node_login -->|"authenticates"| node_auth
node_dashboard -->|"reads state"| node_dashboardstate
node_calendar -->|"reads and updates"| node_dashboardstate
node_analytics -->|"reads state"| node_dashboardstate
node_achievements -->|"reads state"| node_dashboardstate
node_tasks -->|"records actions"| node_dashboardstate
node_exercise -->|"records actions"| node_dashboardstate
node_wellness -->|"records actions"| node_dashboardstate
node_reminders -->|"reads sessions"| node_dashboardstate
node_auth -->|"requests"| node_api
node_dashboardstate -->|"requests"| node_api
node_timerstate -->|"requests"| node_api
node_reminders -->|"checks due alarms"| node_api
node_api -->|"sends HTTP requests"| node_express
node_express -->|"verifies identity"| node_google
node_express -->|"handles timer actions"| node_timerlogic
node_express -->|"reads and writes"| node_sqlite
node_timerlogic -.->|"persists timer state"| node_sqlite

click node_app "https://github.com/kushalshrestha303-web/balanceboard/blob/main/src/App.jsx"
click node_dashboard "https://github.com/kushalshrestha303-web/balanceboard/blob/main/src/pages/Dashboard.jsx"
click node_calendar "https://github.com/kushalshrestha303-web/balanceboard/blob/main/src/pages/Calendar.jsx"
click node_analytics "https://github.com/kushalshrestha303-web/balanceboard/blob/main/src/pages/Analytics.jsx"
click node_achievements "https://github.com/kushalshrestha303-web/balanceboard/blob/main/src/pages/Achievements.jsx"
click node_profile "https://github.com/kushalshrestha303-web/balanceboard/blob/main/src/pages/Profile.jsx"
click node_login "https://github.com/kushalshrestha303-web/balanceboard/blob/main/src/pages/Login.jsx"
click node_layout "https://github.com/kushalshrestha303-web/balanceboard/blob/main/src/components/layout/Layout.jsx"
click node_reminders "https://github.com/kushalshrestha303-web/balanceboard/blob/main/src/components/layout/Reminders.jsx"
click node_alarms "https://github.com/kushalshrestha303-web/balanceboard/blob/main/src/services/alarms.js"
click node_tasks "https://github.com/kushalshrestha303-web/balanceboard/blob/main/src/components/tasks/AddTask.jsx"
click node_exercise "https://github.com/kushalshrestha303-web/balanceboard/blob/main/src/components/exercise/AddExercise.jsx"
click node_wellness "https://github.com/kushalshrestha303-web/balanceboard/blob/main/src/components/wellness/WaterTracker.jsx"
click node_auth "https://github.com/kushalshrestha303-web/balanceboard/blob/main/src/context/AuthContext.jsx"
click node_dashboardstate "https://github.com/kushalshrestha303-web/balanceboard/blob/main/src/context/DashboardContext.jsx"
click node_timerstate "https://github.com/kushalshrestha303-web/balanceboard/blob/main/src/context/TimerContext.jsx"
click node_api "https://github.com/kushalshrestha303-web/balanceboard/blob/main/src/services/api.js"
click node_express "https://github.com/kushalshrestha303-web/balanceboard/blob/main/server/src/server.js"
click node_google "https://github.com/kushalshrestha303-web/balanceboard/blob/main/server/src/googleAuth.js"
click node_timerlogic "https://github.com/kushalshrestha303-web/balanceboard/blob/main/server/src/timer.js"
click node_sqlite "https://github.com/kushalshrestha303-web/balanceboard/blob/main/server/src/server.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_dashboard,node_calendar,node_analytics,node_achievements,node_profile,node_login,node_layout,node_reminders,node_alarms,node_tasks,node_exercise,node_wellness,node_user toneBlue
class node_auth,node_dashboardstate,node_timerstate toneAmber
class node_api,node_express,node_google,node_timerlogic toneMint
class node_sqlite toneRose
```

## Components

### Frontend experience

- [Route app](https://github.com/kushalshrestha303-web/balanceboard/blob/main/src/App.jsx): `src/App.jsx`
- [Dashboard](https://github.com/kushalshrestha303-web/balanceboard/blob/main/src/pages/Dashboard.jsx): `src/pages/Dashboard.jsx`
- [Calendar](https://github.com/kushalshrestha303-web/balanceboard/blob/main/src/pages/Calendar.jsx): `src/pages/Calendar.jsx`
- [Analytics](https://github.com/kushalshrestha303-web/balanceboard/blob/main/src/pages/Analytics.jsx): `src/pages/Analytics.jsx`
- [Achievements](https://github.com/kushalshrestha303-web/balanceboard/blob/main/src/pages/Achievements.jsx): `src/pages/Achievements.jsx`
- [Profile](https://github.com/kushalshrestha303-web/balanceboard/blob/main/src/pages/Profile.jsx): `src/pages/Profile.jsx`
- [Sign in](https://github.com/kushalshrestha303-web/balanceboard/blob/main/src/pages/Login.jsx): `src/pages/Login.jsx`
- [Shared layout](https://github.com/kushalshrestha303-web/balanceboard/blob/main/src/components/layout/Layout.jsx): `src/components/layout/Layout.jsx`
- [Reminders](https://github.com/kushalshrestha303-web/balanceboard/blob/main/src/components/layout/Reminders.jsx): `src/components/layout/Reminders.jsx`
- [Alarm effects](https://github.com/kushalshrestha303-web/balanceboard/blob/main/src/services/alarms.js): `src/services/alarms.js`
- [Study tasks](https://github.com/kushalshrestha303-web/balanceboard/blob/main/src/components/tasks/AddTask.jsx): `src/components/tasks/AddTask.jsx`
- [Exercise tracking](https://github.com/kushalshrestha303-web/balanceboard/blob/main/src/components/exercise/AddExercise.jsx): `src/components/exercise/AddExercise.jsx`
- [Mood and hydration](https://github.com/kushalshrestha303-web/balanceboard/blob/main/src/components/wellness/WaterTracker.jsx): `src/components/wellness/WaterTracker.jsx`

### Shared application state

- [Auth state](https://github.com/kushalshrestha303-web/balanceboard/blob/main/src/context/AuthContext.jsx): `src/context/AuthContext.jsx`
- [Dashboard state](https://github.com/kushalshrestha303-web/balanceboard/blob/main/src/context/DashboardContext.jsx): `src/context/DashboardContext.jsx`
- [Timer state](https://github.com/kushalshrestha303-web/balanceboard/blob/main/src/context/TimerContext.jsx): `src/context/TimerContext.jsx`

### API and services

- [HTTP client](https://github.com/kushalshrestha303-web/balanceboard/blob/main/src/services/api.js): `src/services/api.js`
- [Express API](https://github.com/kushalshrestha303-web/balanceboard/blob/main/server/src/server.js): `server/src/server.js`
- [Google identity](https://github.com/kushalshrestha303-web/balanceboard/blob/main/server/src/googleAuth.js): `server/src/googleAuth.js`
- [Timer actions](https://github.com/kushalshrestha303-web/balanceboard/blob/main/server/src/timer.js): `server/src/timer.js`

### Persistent data

- [SQLite database](https://github.com/kushalshrestha303-web/balanceboard/blob/main/server/src/server.js): `server/src/server.js`

### Other components

- **User**

## Connections

- User → Route app: uses (evidence: `README.md`)
- Route app → Sign in: routes to (evidence: `src/App.jsx`)
- Route app → Dashboard: routes to (evidence: `src/App.jsx`)
- Route app → Calendar: routes to (evidence: `src/App.jsx`)
- Route app → Analytics: routes to (evidence: `src/App.jsx`)
- Route app → Achievements: routes to (evidence: `src/App.jsx`)
- Route app → Profile: routes to (evidence: `src/App.jsx`)
- Route app → Auth state: checks session (evidence: `src/App.jsx`)
- Dashboard → Shared layout: renders (evidence: `src/pages/Dashboard.jsx`)
- Calendar → Shared layout: renders (evidence: `src/pages/Calendar.jsx`)
- Analytics → Shared layout: renders (evidence: `src/pages/Analytics.jsx`)
- Achievements → Shared layout: renders (evidence: `src/pages/Achievements.jsx`)
- Profile → Shared layout: renders (evidence: `src/pages/Profile.jsx`)
- Dashboard → Study tasks: renders (evidence: `src/pages/Dashboard.jsx`)
- Dashboard → Exercise tracking: renders (evidence: `src/pages/Dashboard.jsx`)
- Dashboard → Mood and hydration: renders (evidence: `src/pages/Dashboard.jsx`)
- Dashboard → Timer state: selects timer (evidence: `src/pages/Dashboard.jsx`)
- Shared layout → Reminders: renders (evidence: `src/components/layout/Layout.jsx`)
- Reminders → Alarm effects: plays or vibrates (evidence: `src/components/layout/Reminders.jsx`)
- Sign in → Auth state: authenticates (evidence: `src/pages/Login.jsx`)
- Dashboard → Dashboard state: reads state (evidence: `src/pages/Dashboard.jsx`)
- Calendar → Dashboard state: reads and updates (evidence: `src/pages/Calendar.jsx`)
- Analytics → Dashboard state: reads state (evidence: `src/pages/Analytics.jsx`)
- Achievements → Dashboard state: reads state (evidence: `src/pages/Achievements.jsx`)
- Study tasks → Dashboard state: records actions (evidence: `src/components/tasks/AddTask.jsx`)
- Exercise tracking → Dashboard state: records actions (evidence: `src/components/exercise/AddExercise.jsx`)
- Mood and hydration → Dashboard state: records actions (evidence: `src/components/wellness/WaterTracker.jsx`)
- Reminders → Dashboard state: reads sessions (evidence: `src/components/layout/Reminders.jsx`)
- Auth state → HTTP client: requests (evidence: `src/context/AuthContext.jsx`)
- Dashboard state → HTTP client: requests (evidence: `src/context/DashboardContext.jsx`)
- Timer state → HTTP client: requests (evidence: `src/context/TimerContext.jsx`)
- Reminders → HTTP client: checks due alarms (evidence: `src/components/layout/Reminders.jsx`)
- HTTP client → Express API: sends HTTP requests (evidence: `README.md`)
- Express API → Google identity: verifies identity (evidence: `server/src/server.js`)
- Express API → Timer actions: handles timer actions (evidence: `server/src/server.js`)
- Express API → SQLite database: reads and writes (evidence: `server/src/server.js`)
- Timer actions → SQLite database: persists timer state (evidence: `server/src/server.js`)
