# nasrallahelbendaouipro-ops/habits-tracker-web architecture

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

- Interactive diagram: https://gitdiagram.com/nasrallahelbendaouipro-ops/habits-tracker-web
- Repository: https://github.com/nasrallahelbendaouipro-ops/habits-tracker-web
- Video tour (about a minute): https://gitdiagram.com/nasrallahelbendaouipro-ops/habits-tracker-web/video

## Overview

LifeOS is a personal habit and routine tracker organized around Body, Mind, and Soul. Users record habits and routine sessions, plan them on a calendar, set goals, and review progress through the dashboard and analytics views. The README also documents Google Calendar sync, Apple Health ingestion, and an AI-assisted daily planner. The graph captures the main user journey and these documented branches; some integrations are represented at their route level because their implementations were not sampled.

Main entry points: [`lib/supabase/client.ts`](https://github.com/nasrallahelbendaouipro-ops/habits-tracker-web/blob/main/lib/supabase/client.ts) (Browser data client), [`lib/habits.ts`](https://github.com/nasrallahelbendaouipro-ops/habits-tracker-web/blob/main/lib/habits.ts) (Habit tracking), [`app/(app)/dashboard/page.tsx`](https://github.com/nasrallahelbendaouipro-ops/habits-tracker-web/blob/main/app/(app)/dashboard/page.tsx) (Daily dashboard), [`app/api/google-calendar/events/route.ts`](https://github.com/nasrallahelbendaouipro-ops/habits-tracker-web/blob/main/app/api/google-calendar/events/route.ts) (Google Calendar routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_dashboard["Daily dashboard<br/>[page.tsx]"]
  node_dimension_views["Body, Mind, Soul<br/>[page.tsx]"]
  node_checkin["Daily check-in<br/>[page.tsx]"]
  node_analytics_view["Progress analytics<br/>[page.tsx]"]
  node_auth["Sign-in and registration<br/>[page.tsx]"]
end

subgraph group_tracking["Tracking and planning"]
  node_calendar_view["Calendar view<br/>[CalendarView.tsx]"]
  node_habit_forms["Habit entry forms<br/>[HabitForm.tsx]"]
  node_routine_sessions["Routine sessions<br/>[SessionView.tsx]"]
end

subgraph group_services["Domain services"]
  node_habit_service["Habit tracking<br/>[habits.ts]"]
  node_routine_service["Routine management<br/>[routines.ts]"]
  node_goal_service["Goal tracking<br/>[goals.ts]"]
  node_analytics_service["Progress calculations<br/>[analytics.ts]"]
  node_calendar_service["Calendar events<br/>[calendar.ts]"]
  node_shift_parser["Shift parsing<br/>[shift-parser.ts]"]
end

subgraph group_integrations["Integrations and APIs"]
  node_google_api["Google Calendar routes<br/>[route.ts]"]
  node_google_auth["Google OAuth routes<br/>[route.ts]"]
  node_health_api["Health data routes<br/>[route.ts]"]
  node_planner_api["AI planner route<br/>[route.ts]"]
  node_shift_api["Shift parsing route<br/>[route.ts]"]
  node_google_calendar["Google Calendar service<br/>[google-calendar.ts]"]
end

subgraph group_data["Data and shared infrastructure"]
  node_supabase_client["Browser data client<br/>[client.ts]"]
  node_supabase_server["Server data client<br/>[server.ts]"]
  node_database[("Supabase database")]
  node_rate_limit["Rate limiting<br/>[rate-limit.ts]"]
end

node_user(("User"))
node_health_provider["Apple Health data"]

node_user -->|"signs in"| node_auth
node_user -->|"tracks daily"| node_dashboard
node_dashboard -->|"loads and toggles"| node_habit_service
node_dashboard -->|"loads goals"| node_goal_service
node_dashboard -->|"loads routine blocks"| node_routine_service
node_dashboard -->|"calculates score"| node_analytics_service
node_dimension_views -->|"loads goals"| node_goal_service
node_dimension_views -->|"reads health data"| node_supabase_client
node_checkin -->|"uses habit data"| node_habit_service
node_checkin -->|"uses routines"| node_routine_service
node_checkin -->|"uses calendar data"| node_calendar_service
node_analytics_view -->|"loads habit data"| node_habit_service
node_analytics_view -->|"loads goals"| node_goal_service
node_analytics_view -->|"loads metrics"| node_analytics_service
node_habit_forms -->|"uses habit operations"| node_habit_service
node_routine_sessions -->|"updates sessions"| node_routine_service
node_calendar_view -->|"uses event operations"| node_calendar_service
node_calendar_view -->|"uses habit data"| node_habit_service
node_calendar_view -->|"uses routine data"| node_routine_service
node_auth -->|"authenticates"| node_supabase_client
node_habit_service -->|"reads and writes"| node_supabase_client
node_routine_service -->|"reads and writes"| node_supabase_client
node_goal_service -->|"reads and writes"| node_supabase_client
node_calendar_service -->|"uses data client"| node_supabase_client
node_supabase_client -.->|"accesses"| node_database
node_google_auth -->|"creates server client"| node_supabase_server
node_google_auth -->|"checks requests"| node_rate_limit
node_google_auth -.->|"authorizes calendar sync"| node_google_api
node_google_api -->|"creates server client"| node_supabase_server
node_google_api -->|"uses calendar service"| node_google_calendar
node_google_api -->|"checks requests"| node_rate_limit
node_calendar_view -.->|"syncs events"| node_google_api
node_health_provider -.->|"sends readings"| node_health_api
node_health_api -.->|"ingests readings"| node_database
node_user -.->|"requests daily plan"| node_planner_api
node_user -.->|"submits shift text"| node_shift_api
node_shift_api -->|"parses shifts"| node_shift_parser
node_shift_api -->|"checks requests"| node_rate_limit
node_planner_api -->|"checks requests"| node_rate_limit

click node_dashboard "https://github.com/nasrallahelbendaouipro-ops/habits-tracker-web/blob/main/app/(app)/dashboard/page.tsx"
click node_dimension_views "https://github.com/nasrallahelbendaouipro-ops/habits-tracker-web/blob/main/app/(app)/body/page.tsx"
click node_checkin "https://github.com/nasrallahelbendaouipro-ops/habits-tracker-web/blob/main/app/(app)/checkin/page.tsx"
click node_analytics_view "https://github.com/nasrallahelbendaouipro-ops/habits-tracker-web/blob/main/app/(app)/analytics/page.tsx"
click node_calendar_view "https://github.com/nasrallahelbendaouipro-ops/habits-tracker-web/blob/main/components/calendar/CalendarView.tsx"
click node_habit_forms "https://github.com/nasrallahelbendaouipro-ops/habits-tracker-web/blob/main/components/habits/HabitForm.tsx"
click node_routine_sessions "https://github.com/nasrallahelbendaouipro-ops/habits-tracker-web/blob/main/components/routines/SessionView.tsx"
click node_auth "https://github.com/nasrallahelbendaouipro-ops/habits-tracker-web/blob/main/app/(auth)/login/page.tsx"
click node_habit_service "https://github.com/nasrallahelbendaouipro-ops/habits-tracker-web/blob/main/lib/habits.ts"
click node_routine_service "https://github.com/nasrallahelbendaouipro-ops/habits-tracker-web/blob/main/lib/routines.ts"
click node_goal_service "https://github.com/nasrallahelbendaouipro-ops/habits-tracker-web/blob/main/lib/goals.ts"
click node_analytics_service "https://github.com/nasrallahelbendaouipro-ops/habits-tracker-web/blob/main/lib/analytics.ts"
click node_calendar_service "https://github.com/nasrallahelbendaouipro-ops/habits-tracker-web/blob/main/lib/calendar.ts"
click node_shift_parser "https://github.com/nasrallahelbendaouipro-ops/habits-tracker-web/blob/main/lib/shift-parser.ts"
click node_google_api "https://github.com/nasrallahelbendaouipro-ops/habits-tracker-web/blob/main/app/api/google-calendar/events/route.ts"
click node_google_auth "https://github.com/nasrallahelbendaouipro-ops/habits-tracker-web/blob/main/app/api/auth/google/route.ts"
click node_health_api "https://github.com/nasrallahelbendaouipro-ops/habits-tracker-web/blob/main/app/api/health/ingest/route.ts"
click node_planner_api "https://github.com/nasrallahelbendaouipro-ops/habits-tracker-web/blob/main/app/api/planner/route.ts"
click node_shift_api "https://github.com/nasrallahelbendaouipro-ops/habits-tracker-web/blob/main/app/api/parse-shift/route.ts"
click node_supabase_client "https://github.com/nasrallahelbendaouipro-ops/habits-tracker-web/blob/main/lib/supabase/client.ts"
click node_supabase_server "https://github.com/nasrallahelbendaouipro-ops/habits-tracker-web/blob/main/lib/supabase/server.ts"
click node_rate_limit "https://github.com/nasrallahelbendaouipro-ops/habits-tracker-web/blob/main/lib/rate-limit.ts"
click node_google_calendar "https://github.com/nasrallahelbendaouipro-ops/habits-tracker-web/blob/main/lib/google-calendar.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_dashboard,node_dimension_views,node_checkin,node_analytics_view,node_auth,node_user toneBlue
class node_calendar_view,node_habit_forms,node_routine_sessions toneAmber
class node_habit_service,node_routine_service,node_goal_service,node_analytics_service,node_calendar_service,node_shift_parser toneMint
class node_google_api,node_google_auth,node_health_api,node_planner_api,node_shift_api,node_google_calendar toneRose
class node_supabase_client,node_supabase_server,node_database,node_rate_limit,node_health_provider toneIndigo
```

## Components

### User experience

- [Daily dashboard](https://github.com/nasrallahelbendaouipro-ops/habits-tracker-web/blob/main/app/(app)/dashboard/page.tsx): `app/(app)/dashboard/page.tsx`
- [Body, Mind, Soul](https://github.com/nasrallahelbendaouipro-ops/habits-tracker-web/blob/main/app/(app)/body/page.tsx): `app/(app)/body/page.tsx`
- [Daily check-in](https://github.com/nasrallahelbendaouipro-ops/habits-tracker-web/blob/main/app/(app)/checkin/page.tsx): `app/(app)/checkin/page.tsx`
- [Progress analytics](https://github.com/nasrallahelbendaouipro-ops/habits-tracker-web/blob/main/app/(app)/analytics/page.tsx): `app/(app)/analytics/page.tsx`
- [Sign-in and registration](https://github.com/nasrallahelbendaouipro-ops/habits-tracker-web/blob/main/app/(auth)/login/page.tsx): `app/(auth)/login/page.tsx`

### Tracking and planning

- [Calendar view](https://github.com/nasrallahelbendaouipro-ops/habits-tracker-web/blob/main/components/calendar/CalendarView.tsx): `components/calendar/CalendarView.tsx`
- [Habit entry forms](https://github.com/nasrallahelbendaouipro-ops/habits-tracker-web/blob/main/components/habits/HabitForm.tsx): `components/habits/HabitForm.tsx`
- [Routine sessions](https://github.com/nasrallahelbendaouipro-ops/habits-tracker-web/blob/main/components/routines/SessionView.tsx): `components/routines/SessionView.tsx`

### Domain services

- [Habit tracking](https://github.com/nasrallahelbendaouipro-ops/habits-tracker-web/blob/main/lib/habits.ts): `lib/habits.ts`
- [Routine management](https://github.com/nasrallahelbendaouipro-ops/habits-tracker-web/blob/main/lib/routines.ts): `lib/routines.ts`
- [Goal tracking](https://github.com/nasrallahelbendaouipro-ops/habits-tracker-web/blob/main/lib/goals.ts): `lib/goals.ts`
- [Progress calculations](https://github.com/nasrallahelbendaouipro-ops/habits-tracker-web/blob/main/lib/analytics.ts): `lib/analytics.ts`
- [Calendar events](https://github.com/nasrallahelbendaouipro-ops/habits-tracker-web/blob/main/lib/calendar.ts): `lib/calendar.ts`
- [Shift parsing](https://github.com/nasrallahelbendaouipro-ops/habits-tracker-web/blob/main/lib/shift-parser.ts): `lib/shift-parser.ts`

### Integrations and APIs

- [Google Calendar routes](https://github.com/nasrallahelbendaouipro-ops/habits-tracker-web/blob/main/app/api/google-calendar/events/route.ts): `app/api/google-calendar/events/route.ts`
- [Google OAuth routes](https://github.com/nasrallahelbendaouipro-ops/habits-tracker-web/blob/main/app/api/auth/google/route.ts): `app/api/auth/google/route.ts`
- [Health data routes](https://github.com/nasrallahelbendaouipro-ops/habits-tracker-web/blob/main/app/api/health/ingest/route.ts): `app/api/health/ingest/route.ts`
- [AI planner route](https://github.com/nasrallahelbendaouipro-ops/habits-tracker-web/blob/main/app/api/planner/route.ts): `app/api/planner/route.ts`
- [Shift parsing route](https://github.com/nasrallahelbendaouipro-ops/habits-tracker-web/blob/main/app/api/parse-shift/route.ts): `app/api/parse-shift/route.ts`
- [Google Calendar service](https://github.com/nasrallahelbendaouipro-ops/habits-tracker-web/blob/main/lib/google-calendar.ts): `lib/google-calendar.ts`

### Data and shared infrastructure

- [Browser data client](https://github.com/nasrallahelbendaouipro-ops/habits-tracker-web/blob/main/lib/supabase/client.ts): `lib/supabase/client.ts`
- [Server data client](https://github.com/nasrallahelbendaouipro-ops/habits-tracker-web/blob/main/lib/supabase/server.ts): `lib/supabase/server.ts`
- **Supabase database**
- [Rate limiting](https://github.com/nasrallahelbendaouipro-ops/habits-tracker-web/blob/main/lib/rate-limit.ts): `lib/rate-limit.ts`

### Other components

- **User**
- **Apple Health data**

## Connections

- User → Sign-in and registration: signs in (evidence: `app/(auth)/login/page.tsx`)
- User → Daily dashboard: tracks daily (evidence: `README.md`)
- Daily dashboard → Habit tracking: loads and toggles (evidence: `app/(app)/dashboard/page.tsx`)
- Daily dashboard → Goal tracking: loads goals (evidence: `app/(app)/dashboard/page.tsx`)
- Daily dashboard → Routine management: loads routine blocks (evidence: `app/(app)/dashboard/page.tsx`)
- Daily dashboard → Progress calculations: calculates score (evidence: `app/(app)/dashboard/page.tsx`)
- Body, Mind, Soul → Goal tracking: loads goals (evidence: `app/(app)/body/page.tsx`)
- Body, Mind, Soul → Browser data client: reads health data (evidence: `app/(app)/body/page.tsx`)
- Daily check-in → Habit tracking: uses habit data (evidence: `app/(app)/checkin/page.tsx`)
- Daily check-in → Routine management: uses routines (evidence: `app/(app)/checkin/page.tsx`)
- Daily check-in → Calendar events: uses calendar data (evidence: `app/(app)/checkin/page.tsx`)
- Progress analytics → Habit tracking: loads habit data (evidence: `app/(app)/analytics/page.tsx`)
- Progress analytics → Goal tracking: loads goals (evidence: `app/(app)/analytics/page.tsx`)
- Progress analytics → Progress calculations: loads metrics (evidence: `app/(app)/analytics/page.tsx`)
- Habit entry forms → Habit tracking: uses habit operations (evidence: `components/habits/HabitForm.tsx`)
- Routine sessions → Routine management: updates sessions (evidence: `components/routines/SessionView.tsx`)
- Calendar view → Calendar events: uses event operations (evidence: `components/calendar/CalendarView.tsx`)
- Calendar view → Habit tracking: uses habit data (evidence: `components/calendar/CalendarView.tsx`)
- Calendar view → Routine management: uses routine data (evidence: `components/calendar/CalendarView.tsx`)
- Sign-in and registration → Browser data client: authenticates (evidence: `app/(auth)/login/page.tsx`)
- Habit tracking → Browser data client: reads and writes (evidence: `lib/habits.ts`)
- Routine management → Browser data client: reads and writes (evidence: `lib/routines.ts`)
- Goal tracking → Browser data client: reads and writes (evidence: `lib/goals.ts`)
- Calendar events → Browser data client: uses data client (evidence: `lib/calendar.ts`)
- Browser data client → Supabase database: accesses
- Google OAuth routes → Server data client: creates server client (evidence: `app/api/auth/google/route.ts`)
- Google OAuth routes → Rate limiting: checks requests (evidence: `app/api/auth/google/route.ts`)
- Google OAuth routes → Google Calendar routes: authorizes calendar sync (evidence: `README.md`)
- Google Calendar routes → Server data client: creates server client (evidence: `app/api/google-calendar/events/route.ts`)
- Google Calendar routes → Google Calendar service: uses calendar service (evidence: `app/api/google-calendar/events/route.ts`)
- Google Calendar routes → Rate limiting: checks requests (evidence: `app/api/google-calendar/events/route.ts`)
- Calendar view → Google Calendar routes: syncs events (evidence: `README.md`)
- Apple Health data → Health data routes: sends readings (evidence: `README.md`)
- Health data routes → Supabase database: ingests readings (evidence: `README.md`)
- User → AI planner route: requests daily plan (evidence: `README.md`)
- User → Shift parsing route: submits shift text (evidence: `app/api/parse-shift/route.ts`)
- Shift parsing route → Shift parsing: parses shifts (evidence: `app/api/parse-shift/route.ts`)
- Shift parsing route → Rate limiting: checks requests (evidence: `app/api/parse-shift/route.ts`)
- AI planner route → Rate limiting: checks requests (evidence: `app/api/planner/route.ts`)
