# ritheesh024-hub/daily-habit-tracker architecture

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

- Interactive diagram: https://gitdiagram.com/ritheesh024-hub/daily-habit-tracker
- Repository: https://github.com/ritheesh024-hub/daily-habit-tracker

## Overview

This is an offline-capable habit-tracking web app. Users manage habits and goals, record daily completions and notes, then review streaks, milestones, and analytics; profile settings include theme and optional Google Calendar sync. The app shell coordinates user state and persistence, while service modules handle cached and remote data. The README is empty, so capability coverage comes from the source index and excerpts; unsampled modules are represented only where their names and references establish a subsystem.

Main entry points: [`src/App.tsx`](https://github.com/ritheesh024-hub/daily-habit-tracker/blob/main/src/App.tsx) (App coordinator), [`src/lib/habitService.ts`](https://github.com/ritheesh024-hub/daily-habit-tracker/blob/main/src/lib/habitService.ts) (Habit management), [`src/lib/googleCalendarService.ts`](https://github.com/ritheesh024-hub/daily-habit-tracker/blob/main/src/lib/googleCalendarService.ts) (Calendar sync), [`src/lib/cacheService.ts`](https://github.com/ritheesh024-hub/daily-habit-tracker/blob/main/src/lib/cacheService.ts) (Local cache)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App experience"]
  node_app["App coordinator<br/>[App.tsx]"]
  node_main["Application entry<br/>[main.tsx]"]
  node_onboarding["Onboarding"]
  node_profile["Profile settings<br/>[ProfileModal.tsx]"]
  node_profileview["Profile view<br/>[ProfileView.tsx]"]
end

subgraph group_tracking["Habit tracking"]
  node_habits["Habit management<br/>[habitService.ts]"]
  node_habitui["Habit editor<br/>[HabitModal.tsx]"]
  node_habitdetails["Habit details"]
  node_daily["Daily tracking<br/>[HabitList.tsx]"]
  node_dailylog["Daily notes<br/>[DailyNote.tsx]"]
  node_history["Habit history<br/>[HistoryList.tsx]"]
end

subgraph group_insights["Progress and goals"]
  node_analytics["Analytics<br/>[AnalyticsView.tsx]"]
  node_intelligence["Habit insights"]
  node_goals["Goal management<br/>[goalService.ts]"]
  node_goalui["Goal views<br/>[GoalCard.tsx]"]
  node_milestones["Milestones"]
end

subgraph group_platform["Persistence and integrations"]
  node_calendar["Calendar sync"]
  node_sync["Offline sync queue"]
  node_cache[("Local cache<br/>[cacheService.ts]")]
  node_firebase[("Firebase services<br/>[firebase.ts]")]
  node_theme["Theme settings<br/>[themeService.ts]"]
  node_dates["Date utilities<br/>[dateUtils.ts]"]
end

node_calendarapi["Google Calendar"]

node_main -->|"renders"| node_app
node_app -->|"saves habits"| node_habits
node_app -->|"loads cached state"| node_cache
node_app -->|"fetches milestones"| node_milestones
node_app -->|"starts sync"| node_calendar
node_app -->|"loads theme"| node_theme
node_app -->|"renders"| node_daily
node_app -->|"renders"| node_dailylog
node_app -->|"renders"| node_history
node_app -->|"renders"| node_analytics
node_app -->|"renders"| node_profile
node_app -->|"renders"| node_onboarding
node_app -->|"uses"| node_goals
node_app -->|"uses"| node_sync
node_habitdetails -->|"calls"| node_habits
node_habitdetails -->|"uses"| node_calendar
node_goalui -.->|"uses"| node_intelligence
node_analytics -->|"uses"| node_intelligence
node_analytics -->|"renders"| node_goalui
node_profile -->|"renders"| node_analytics
node_profile -->|"renders"| node_milestones
node_profile -->|"configures"| node_calendar
node_habits -->|"reads cache"| node_cache
node_habits -->|"queues operations"| node_sync
node_habits -->|"reads and writes"| node_firebase
node_goals -->|"reads cache"| node_cache
node_goals -->|"reads and writes"| node_firebase
node_milestones -->|"uses"| node_cache
node_milestones -->|"uses"| node_firebase
node_sync -->|"writes queued data"| node_firebase
node_sync -->|"updates cache"| node_cache
node_sync -->|"uses calendar helpers"| node_calendar
node_calendar -->|"calls API"| node_calendarapi
node_calendar -->|"uses auth"| node_firebase
node_dailylog -->|"formats dates"| node_dates
node_cache -->|"normalizes dates"| node_dates
node_goals -->|"uses"| node_dates
node_habits -->|"uses"| node_dates

click node_app "https://github.com/ritheesh024-hub/daily-habit-tracker/blob/main/src/App.tsx"
click node_main "https://github.com/ritheesh024-hub/daily-habit-tracker/blob/main/src/main.tsx"
click node_onboarding "https://github.com/ritheesh024-hub/daily-habit-tracker/blob/main/src/components/OnboardingModal.tsx"
click node_profile "https://github.com/ritheesh024-hub/daily-habit-tracker/blob/main/src/components/ProfileModal.tsx"
click node_profileview "https://github.com/ritheesh024-hub/daily-habit-tracker/blob/main/src/components/ProfileView.tsx"
click node_habits "https://github.com/ritheesh024-hub/daily-habit-tracker/blob/main/src/lib/habitService.ts"
click node_habitui "https://github.com/ritheesh024-hub/daily-habit-tracker/blob/main/src/components/HabitModal.tsx"
click node_habitdetails "https://github.com/ritheesh024-hub/daily-habit-tracker/blob/main/src/components/HabitDetailsModal.tsx"
click node_daily "https://github.com/ritheesh024-hub/daily-habit-tracker/blob/main/src/components/HabitList.tsx"
click node_dailylog "https://github.com/ritheesh024-hub/daily-habit-tracker/blob/main/src/components/DailyNote.tsx"
click node_history "https://github.com/ritheesh024-hub/daily-habit-tracker/blob/main/src/components/HistoryList.tsx"
click node_analytics "https://github.com/ritheesh024-hub/daily-habit-tracker/blob/main/src/components/AnalyticsView.tsx"
click node_intelligence "https://github.com/ritheesh024-hub/daily-habit-tracker/blob/main/src/lib/habitIntelligence.ts"
click node_goals "https://github.com/ritheesh024-hub/daily-habit-tracker/blob/main/src/lib/goalService.ts"
click node_goalui "https://github.com/ritheesh024-hub/daily-habit-tracker/blob/main/src/components/GoalCard.tsx"
click node_milestones "https://github.com/ritheesh024-hub/daily-habit-tracker/blob/main/src/lib/milestoneService.ts"
click node_calendar "https://github.com/ritheesh024-hub/daily-habit-tracker/blob/main/src/lib/googleCalendarService.ts"
click node_sync "https://github.com/ritheesh024-hub/daily-habit-tracker/blob/main/src/lib/syncQueueService.ts"
click node_cache "https://github.com/ritheesh024-hub/daily-habit-tracker/blob/main/src/lib/cacheService.ts"
click node_firebase "https://github.com/ritheesh024-hub/daily-habit-tracker/blob/main/src/lib/firebase.ts"
click node_theme "https://github.com/ritheesh024-hub/daily-habit-tracker/blob/main/src/lib/themeService.ts"
click node_dates "https://github.com/ritheesh024-hub/daily-habit-tracker/blob/main/src/lib/dateUtils.ts"

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_main,node_onboarding,node_profile,node_profileview toneBlue
class node_habits,node_habitui,node_habitdetails,node_daily,node_dailylog,node_history toneAmber
class node_analytics,node_intelligence,node_goals,node_goalui,node_milestones toneMint
class node_calendar,node_sync,node_cache,node_firebase,node_theme,node_dates toneRose
class node_calendarapi toneIndigo
```

## Components

### App experience

- [App coordinator](https://github.com/ritheesh024-hub/daily-habit-tracker/blob/main/src/App.tsx): `src/App.tsx`
- [Application entry](https://github.com/ritheesh024-hub/daily-habit-tracker/blob/main/src/main.tsx): `src/main.tsx`
- [Onboarding](https://github.com/ritheesh024-hub/daily-habit-tracker/blob/main/src/components/OnboardingModal.tsx): `src/components/OnboardingModal.tsx`
- [Profile settings](https://github.com/ritheesh024-hub/daily-habit-tracker/blob/main/src/components/ProfileModal.tsx): `src/components/ProfileModal.tsx`
- [Profile view](https://github.com/ritheesh024-hub/daily-habit-tracker/blob/main/src/components/ProfileView.tsx): `src/components/ProfileView.tsx`

### Habit tracking

- [Habit management](https://github.com/ritheesh024-hub/daily-habit-tracker/blob/main/src/lib/habitService.ts): `src/lib/habitService.ts`
- [Habit editor](https://github.com/ritheesh024-hub/daily-habit-tracker/blob/main/src/components/HabitModal.tsx): `src/components/HabitModal.tsx`
- [Habit details](https://github.com/ritheesh024-hub/daily-habit-tracker/blob/main/src/components/HabitDetailsModal.tsx): `src/components/HabitDetailsModal.tsx`
- [Daily tracking](https://github.com/ritheesh024-hub/daily-habit-tracker/blob/main/src/components/HabitList.tsx): `src/components/HabitList.tsx`
- [Daily notes](https://github.com/ritheesh024-hub/daily-habit-tracker/blob/main/src/components/DailyNote.tsx): `src/components/DailyNote.tsx`
- [Habit history](https://github.com/ritheesh024-hub/daily-habit-tracker/blob/main/src/components/HistoryList.tsx): `src/components/HistoryList.tsx`

### Progress and goals

- [Analytics](https://github.com/ritheesh024-hub/daily-habit-tracker/blob/main/src/components/AnalyticsView.tsx): `src/components/AnalyticsView.tsx`
- [Habit insights](https://github.com/ritheesh024-hub/daily-habit-tracker/blob/main/src/lib/habitIntelligence.ts): `src/lib/habitIntelligence.ts`
- [Goal management](https://github.com/ritheesh024-hub/daily-habit-tracker/blob/main/src/lib/goalService.ts): `src/lib/goalService.ts`
- [Goal views](https://github.com/ritheesh024-hub/daily-habit-tracker/blob/main/src/components/GoalCard.tsx): `src/components/GoalCard.tsx`
- [Milestones](https://github.com/ritheesh024-hub/daily-habit-tracker/blob/main/src/lib/milestoneService.ts): `src/lib/milestoneService.ts`

### Persistence and integrations

- [Calendar sync](https://github.com/ritheesh024-hub/daily-habit-tracker/blob/main/src/lib/googleCalendarService.ts): `src/lib/googleCalendarService.ts`
- [Offline sync queue](https://github.com/ritheesh024-hub/daily-habit-tracker/blob/main/src/lib/syncQueueService.ts): `src/lib/syncQueueService.ts`
- [Local cache](https://github.com/ritheesh024-hub/daily-habit-tracker/blob/main/src/lib/cacheService.ts): `src/lib/cacheService.ts`
- [Firebase services](https://github.com/ritheesh024-hub/daily-habit-tracker/blob/main/src/lib/firebase.ts): `src/lib/firebase.ts`
- [Theme settings](https://github.com/ritheesh024-hub/daily-habit-tracker/blob/main/src/lib/themeService.ts): `src/lib/themeService.ts`
- [Date utilities](https://github.com/ritheesh024-hub/daily-habit-tracker/blob/main/src/lib/dateUtils.ts): `src/lib/dateUtils.ts`

### Other components

- **Google Calendar**

## Connections

- Application entry → App coordinator: renders (evidence: `src/main.tsx`)
- App coordinator → Habit management: saves habits (evidence: `src/App.tsx`)
- App coordinator → Local cache: loads cached state (evidence: `src/App.tsx`)
- App coordinator → Milestones: fetches milestones (evidence: `src/App.tsx`)
- App coordinator → Calendar sync: starts sync (evidence: `src/App.tsx`)
- App coordinator → Theme settings: loads theme (evidence: `src/App.tsx`)
- App coordinator → Daily tracking: renders (evidence: `src/App.tsx`)
- App coordinator → Daily notes: renders (evidence: `src/App.tsx`)
- App coordinator → Habit history: renders (evidence: `src/App.tsx`)
- App coordinator → Analytics: renders (evidence: `src/App.tsx`)
- App coordinator → Profile settings: renders (evidence: `src/App.tsx`)
- App coordinator → Onboarding: renders (evidence: `src/App.tsx`)
- App coordinator → Goal management: uses (evidence: `src/App.tsx`)
- App coordinator → Offline sync queue: uses (evidence: `src/App.tsx`)
- Habit details → Habit management: calls (evidence: `src/components/HabitDetailsModal.tsx`)
- Habit details → Calendar sync: uses (evidence: `src/components/HabitDetailsModal.tsx`)
- Goal views → Habit insights: uses
- Analytics → Habit insights: uses (evidence: `src/components/AnalyticsView.tsx`)
- Analytics → Goal views: renders (evidence: `src/components/AnalyticsView.tsx`)
- Profile settings → Analytics: renders (evidence: `src/components/ProfileModal.tsx`)
- Profile settings → Milestones: renders (evidence: `src/components/ProfileModal.tsx`)
- Profile settings → Calendar sync: configures (evidence: `src/components/ProfileModal.tsx`)
- Habit management → Local cache: reads cache (evidence: `src/lib/habitService.ts`)
- Habit management → Offline sync queue: queues operations (evidence: `src/lib/habitService.ts`)
- Habit management → Firebase services: reads and writes (evidence: `src/lib/habitService.ts`)
- Goal management → Local cache: reads cache (evidence: `src/lib/goalService.ts`)
- Goal management → Firebase services: reads and writes (evidence: `src/lib/goalService.ts`)
- Milestones → Local cache: uses (evidence: `src/lib/milestoneService.ts`)
- Milestones → Firebase services: uses (evidence: `src/lib/milestoneService.ts`)
- Offline sync queue → Firebase services: writes queued data (evidence: `src/lib/syncQueueService.ts`)
- Offline sync queue → Local cache: updates cache (evidence: `src/lib/syncQueueService.ts`)
- Offline sync queue → Calendar sync: uses calendar helpers (evidence: `src/lib/syncQueueService.ts`)
- Calendar sync → Google Calendar: calls API (evidence: `src/lib/googleCalendarService.ts`)
- Calendar sync → Firebase services: uses auth (evidence: `src/lib/googleCalendarService.ts`)
- Daily notes → Date utilities: formats dates (evidence: `src/components/DailyNote.tsx`)
- Local cache → Date utilities: normalizes dates (evidence: `src/lib/cacheService.ts`)
- Goal management → Date utilities: uses (evidence: `src/lib/goalService.ts`)
- Habit management → Date utilities: uses (evidence: `src/lib/habitService.ts`)
