# nitish-kumar777/helth-tracker architecture

> Architecture diagram of the GitHub repository nitish-kumar777/helth-tracker, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nitish-kumar777/helth-tracker
- Repository: https://github.com/nitish-kumar777/helth-tracker

## Overview

Habit Tracker is a full-stack productivity app: users register and authenticate, define habits, record daily progress, then review streaks, accuracy, calendar views, analytics, and badges. Account settings support email/password changes, verification, recovery, and avatar uploads. The dashboard is the main user-facing layer; API routes own authentication, habit operations, statistics, badges, and settings, with Prisma-backed persistence and optional email and Cloudinary services. UI-to-API wiring is not shown in the excerpts, so those documented feature links cite the README; unsampled route details are represented at their exact tree paths.

Main entry points: [`app/api/settings`](https://github.com/nitish-kumar777/helth-tracker/tree/master/app/api/settings) (Profile & settings), [`app/api/auth/[...nextauth]/route.js`](https://github.com/nitish-kumar777/helth-tracker/blob/master/app/api/auth/%5B...nextauth%5D/route.js) (Credentials & sessions), [`app/api/auth/create-acc/route.js`](https://github.com/nitish-kumar777/helth-tracker/blob/master/app/api/auth/create-acc/route.js) (Account workflows), [`app/api/stats/route.js`](https://github.com/nitish-kumar777/helth-tracker/blob/master/app/api/stats/route.js) (Streaks & statistics)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Identity &amp; Account"]
  node_auth_ui["Sign-in &amp; recovery<br/>[page.js]"]
  node_registration_ui["Registration<br/>[page.jsx]"]
  node_recovery_ui["Reset password<br/>[page.jsx]"]
  node_auth_api["Credentials &amp; sessions<br/>[route.js]"]
  node_account_api["Account workflows<br/>[route.js]"]
  node_settings_api["Profile &amp; settings"]
end

subgraph group_habit["Habit Tracking"]
  node_habit_api["Habit definitions<br/>[route.js]"]
  node_logging_api["Daily log operations<br/>[route.js]"]
end

subgraph group_review["Progress &amp; Insights"]
  node_stats_api["Streaks &amp; statistics<br/>[route.js]"]
  node_badges_api["Badge awards<br/>[route.js]"]
end

subgraph group_dashboard["Dashboard UI"]
  node_settings_ui["Account settings UI<br/>[page.jsx]"]
  node_habit_ui["Habit management"]
  node_daily_ui["Daily habit logging<br/>[page.jsx]"]
  node_dashboard_home["Dashboard overview<br/>[page.jsx]"]
  node_calendar_ui["Calendar heatmap<br/>[Calendar.jsx]"]
  node_calendar_page["Calendar page<br/>[page.jsx]"]
  node_analytics_ui["Analytics &amp; reports<br/>[page.jsx]"]
  node_insights_ui["Insights<br/>[page.jsx]"]
  node_shell["Dashboard shell<br/>[layout.jsx]"]
  node_header["Dashboard header<br/>[Header.jsx]"]
  node_sidebar["Dashboard navigation<br/>[Sidebar.jsx]"]
end

subgraph group_platform["Shared Services"]
  node_session_provider["Session provider<br/>[provider.js]"]
  node_user_context["User context<br/>[UserContext.jsx]"]
  node_prisma_helper["Prisma client<br/>[prisma.js]"]
  node_email_helper["Transactional email<br/>[email.js]"]
  node_cloudinary_helper["Avatar upload client<br/>[cloudinary.js]"]
end

node_user(("Habit tracker"))
node_mongo[("MongoDB")]
node_smtp["SMTP service"]
node_cloudinary["Cloudinary"]

node_user -->|"registers"| node_registration_ui
node_user -->|"signs in"| node_auth_ui
node_user -->|"recovers account"| node_recovery_ui
node_registration_ui -->|"creates account"| node_account_api
node_auth_ui -->|"authenticates"| node_auth_api
node_recovery_ui -->|"requests recovery"| node_account_api
node_auth_api -->|"reads user"| node_mongo
node_account_api -.->|"persists account"| node_mongo
node_user -->|"manages habits"| node_habit_ui
node_habit_ui -->|"manages definitions"| node_habit_api
node_user -->|"logs habits"| node_daily_ui
node_daily_ui -->|"records progress"| node_logging_api
node_habit_api -->|"reads and writes"| node_mongo
node_logging_api -->|"reads and writes"| node_mongo
node_user -->|"reviews progress"| node_dashboard_home
node_dashboard_home -.->|"shows statistics"| node_stats_api
node_user -->|"views calendar"| node_calendar_page
node_calendar_page -->|"renders calendar"| node_calendar_ui
node_user -->|"reviews reports"| node_analytics_ui
node_analytics_ui -.->|"loads analytics"| node_stats_api
node_user -.->|"reviews insights"| node_insights_ui
node_stats_api -->|"reads and persists stats"| node_mongo
node_user -->|"checks badges"| node_badges_api
node_badges_api -->|"reads and awards"| node_mongo
node_shell -->|"renders"| node_header
node_shell -->|"renders"| node_sidebar
node_settings_ui -->|"updates account"| node_settings_api
node_settings_api -->|"checks session"| node_auth_api
node_settings_api -->|"reads and updates"| node_mongo
node_settings_api -->|"sends verification codes"| node_email_helper
node_email_helper -->|"delivers email"| node_smtp
node_settings_api -->|"uploads avatar"| node_cloudinary_helper
node_cloudinary_helper -->|"stores image"| node_cloudinary
node_settings_api -->|"uses shared client"| node_prisma_helper
node_prisma_helper -.->|"connects to"| node_mongo
node_session_provider -.->|"provides sessions"| node_auth_api
node_user_context -.->|"reads session"| node_session_provider

click node_auth_ui "https://github.com/nitish-kumar777/helth-tracker/blob/master/app/login/page.js"
click node_registration_ui "https://github.com/nitish-kumar777/helth-tracker/blob/master/app/register/page.jsx"
click node_recovery_ui "https://github.com/nitish-kumar777/helth-tracker/blob/master/app/reset-password/page.jsx"
click node_auth_api "https://github.com/nitish-kumar777/helth-tracker/blob/master/app/api/auth/%5B...nextauth%5D/route.js"
click node_account_api "https://github.com/nitish-kumar777/helth-tracker/blob/master/app/api/auth/create-acc/route.js"
click node_settings_api "https://github.com/nitish-kumar777/helth-tracker/tree/master/app/api/settings"
click node_settings_ui "https://github.com/nitish-kumar777/helth-tracker/blob/master/app/dashboard/settings/page.jsx"
click node_habit_ui "https://github.com/nitish-kumar777/helth-tracker/tree/master/app/dashboard/habits"
click node_daily_ui "https://github.com/nitish-kumar777/helth-tracker/blob/master/app/dashboard/habits/log/page.jsx"
click node_habit_api "https://github.com/nitish-kumar777/helth-tracker/blob/master/app/api/habits/new/route.js"
click node_logging_api "https://github.com/nitish-kumar777/helth-tracker/blob/master/app/api/habits/log/route.js"
click node_dashboard_home "https://github.com/nitish-kumar777/helth-tracker/blob/master/app/dashboard/page.jsx"
click node_calendar_ui "https://github.com/nitish-kumar777/helth-tracker/blob/master/app/dashboard/components/Calendar.jsx"
click node_calendar_page "https://github.com/nitish-kumar777/helth-tracker/blob/master/app/dashboard/calendar/page.jsx"
click node_analytics_ui "https://github.com/nitish-kumar777/helth-tracker/blob/master/app/dashboard/analytics/page.jsx"
click node_insights_ui "https://github.com/nitish-kumar777/helth-tracker/blob/master/app/dashboard/insights/page.jsx"
click node_stats_api "https://github.com/nitish-kumar777/helth-tracker/blob/master/app/api/stats/route.js"
click node_badges_api "https://github.com/nitish-kumar777/helth-tracker/blob/master/app/api/badges/route.js"
click node_shell "https://github.com/nitish-kumar777/helth-tracker/blob/master/app/dashboard/layout.jsx"
click node_header "https://github.com/nitish-kumar777/helth-tracker/blob/master/app/dashboard/components/Header.jsx"
click node_sidebar "https://github.com/nitish-kumar777/helth-tracker/blob/master/app/dashboard/components/Sidebar.jsx"
click node_session_provider "https://github.com/nitish-kumar777/helth-tracker/blob/master/app/SessionProvider/provider.js"
click node_user_context "https://github.com/nitish-kumar777/helth-tracker/blob/master/context/UserContext.jsx"
click node_prisma_helper "https://github.com/nitish-kumar777/helth-tracker/blob/master/lib/prisma.js"
click node_email_helper "https://github.com/nitish-kumar777/helth-tracker/blob/master/lib/email.js"
click node_cloudinary_helper "https://github.com/nitish-kumar777/helth-tracker/blob/master/lib/cloudinary.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_auth_ui,node_registration_ui,node_recovery_ui,node_auth_api,node_account_api,node_settings_api toneBlue
class node_habit_api,node_logging_api,node_mongo toneAmber
class node_stats_api,node_badges_api toneMint
class node_settings_ui,node_habit_ui,node_daily_ui,node_dashboard_home,node_calendar_ui,node_calendar_page,node_analytics_ui,node_insights_ui,node_shell,node_header,node_sidebar toneRose
class node_session_provider,node_user_context,node_prisma_helper,node_email_helper,node_cloudinary_helper,node_user,node_smtp,node_cloudinary toneIndigo
```

## Components

### Identity & Account

- [Sign-in & recovery](https://github.com/nitish-kumar777/helth-tracker/blob/master/app/login/page.js): `app/login/page.js`
- [Registration](https://github.com/nitish-kumar777/helth-tracker/blob/master/app/register/page.jsx): `app/register/page.jsx`
- [Reset password](https://github.com/nitish-kumar777/helth-tracker/blob/master/app/reset-password/page.jsx): `app/reset-password/page.jsx`
- [Credentials & sessions](https://github.com/nitish-kumar777/helth-tracker/blob/master/app/api/auth/%5B...nextauth%5D/route.js): `app/api/auth/[...nextauth]/route.js`
- [Account workflows](https://github.com/nitish-kumar777/helth-tracker/blob/master/app/api/auth/create-acc/route.js): `app/api/auth/create-acc/route.js`
- [Profile & settings](https://github.com/nitish-kumar777/helth-tracker/tree/master/app/api/settings): `app/api/settings`

### Habit Tracking

- [Habit definitions](https://github.com/nitish-kumar777/helth-tracker/blob/master/app/api/habits/new/route.js): `app/api/habits/new/route.js`
- [Daily log operations](https://github.com/nitish-kumar777/helth-tracker/blob/master/app/api/habits/log/route.js): `app/api/habits/log/route.js`

### Progress & Insights

- [Streaks & statistics](https://github.com/nitish-kumar777/helth-tracker/blob/master/app/api/stats/route.js): `app/api/stats/route.js`
- [Badge awards](https://github.com/nitish-kumar777/helth-tracker/blob/master/app/api/badges/route.js): `app/api/badges/route.js`

### Dashboard UI

- [Account settings UI](https://github.com/nitish-kumar777/helth-tracker/blob/master/app/dashboard/settings/page.jsx): `app/dashboard/settings/page.jsx`
- [Habit management](https://github.com/nitish-kumar777/helth-tracker/tree/master/app/dashboard/habits): `app/dashboard/habits`
- [Daily habit logging](https://github.com/nitish-kumar777/helth-tracker/blob/master/app/dashboard/habits/log/page.jsx): `app/dashboard/habits/log/page.jsx`
- [Dashboard overview](https://github.com/nitish-kumar777/helth-tracker/blob/master/app/dashboard/page.jsx): `app/dashboard/page.jsx`
- [Calendar heatmap](https://github.com/nitish-kumar777/helth-tracker/blob/master/app/dashboard/components/Calendar.jsx): `app/dashboard/components/Calendar.jsx`
- [Calendar page](https://github.com/nitish-kumar777/helth-tracker/blob/master/app/dashboard/calendar/page.jsx): `app/dashboard/calendar/page.jsx`
- [Analytics & reports](https://github.com/nitish-kumar777/helth-tracker/blob/master/app/dashboard/analytics/page.jsx): `app/dashboard/analytics/page.jsx`
- [Insights](https://github.com/nitish-kumar777/helth-tracker/blob/master/app/dashboard/insights/page.jsx): `app/dashboard/insights/page.jsx`
- [Dashboard shell](https://github.com/nitish-kumar777/helth-tracker/blob/master/app/dashboard/layout.jsx): `app/dashboard/layout.jsx`
- [Dashboard header](https://github.com/nitish-kumar777/helth-tracker/blob/master/app/dashboard/components/Header.jsx): `app/dashboard/components/Header.jsx`
- [Dashboard navigation](https://github.com/nitish-kumar777/helth-tracker/blob/master/app/dashboard/components/Sidebar.jsx): `app/dashboard/components/Sidebar.jsx`

### Shared Services

- [Session provider](https://github.com/nitish-kumar777/helth-tracker/blob/master/app/SessionProvider/provider.js): `app/SessionProvider/provider.js`
- [User context](https://github.com/nitish-kumar777/helth-tracker/blob/master/context/UserContext.jsx): `context/UserContext.jsx`
- [Prisma client](https://github.com/nitish-kumar777/helth-tracker/blob/master/lib/prisma.js): `lib/prisma.js`
- [Transactional email](https://github.com/nitish-kumar777/helth-tracker/blob/master/lib/email.js): `lib/email.js`
- [Avatar upload client](https://github.com/nitish-kumar777/helth-tracker/blob/master/lib/cloudinary.js): `lib/cloudinary.js`

### Other components

- **Habit tracker**
- **MongoDB**
- **SMTP service**
- **Cloudinary**

## Connections

- Habit tracker → Registration: registers (evidence: `README.md`)
- Habit tracker → Sign-in & recovery: signs in (evidence: `README.md`)
- Habit tracker → Reset password: recovers account (evidence: `README.md`)
- Registration → Account workflows: creates account (evidence: `README.md`)
- Sign-in & recovery → Credentials & sessions: authenticates (evidence: `README.md`)
- Reset password → Account workflows: requests recovery (evidence: `README.md`)
- Credentials & sessions → MongoDB: reads user (evidence: `app/api/auth/[...nextauth]/route.js`)
- Account workflows → MongoDB: persists account
- Habit tracker → Habit management: manages habits (evidence: `README.md`)
- Habit management → Habit definitions: manages definitions (evidence: `README.md`)
- Habit tracker → Daily habit logging: logs habits (evidence: `README.md`)
- Daily habit logging → Daily log operations: records progress (evidence: `README.md`)
- Habit definitions → MongoDB: reads and writes (evidence: `app/api/habits/new/route.js`)
- Daily log operations → MongoDB: reads and writes (evidence: `app/api/habits/log/route.js`)
- Habit tracker → Dashboard overview: reviews progress (evidence: `README.md`)
- Dashboard overview → Streaks & statistics: shows statistics
- Habit tracker → Calendar page: views calendar (evidence: `README.md`)
- Calendar page → Calendar heatmap: renders calendar (evidence: `app/dashboard/calendar/page.jsx`)
- Habit tracker → Analytics & reports: reviews reports (evidence: `README.md`)
- Analytics & reports → Streaks & statistics: loads analytics
- Habit tracker → Insights: reviews insights
- Streaks & statistics → MongoDB: reads and persists stats (evidence: `app/api/stats/route.js`)
- Habit tracker → Badge awards: checks badges (evidence: `README.md`)
- Badge awards → MongoDB: reads and awards (evidence: `app/api/badges/route.js`)
- Dashboard shell → Dashboard header: renders (evidence: `app/dashboard/layout.jsx`)
- Dashboard shell → Dashboard navigation: renders (evidence: `app/dashboard/layout.jsx`)
- Account settings UI → Profile & settings: updates account (evidence: `README.md`)
- Profile & settings → Credentials & sessions: checks session (evidence: `app/api/settings/send-code/route.js`)
- Profile & settings → MongoDB: reads and updates (evidence: `app/api/settings/change-email/route.js`)
- Profile & settings → Transactional email: sends verification codes (evidence: `app/api/settings/send-code/route.js`)
- Transactional email → SMTP service: delivers email (evidence: `lib/email.js`)
- Profile & settings → Avatar upload client: uploads avatar (evidence: `app/api/settings/upload-avatar/route.js`)
- Avatar upload client → Cloudinary: stores image
- Profile & settings → Prisma client: uses shared client (evidence: `app/api/settings/send-code/route.js`)
- Prisma client → MongoDB: connects to
- Session provider → Credentials & sessions: provides sessions
- User context → Session provider: reads session
