# mathanrajchinnadurai07-debug/goalpath architecture

> Architecture diagram of the GitHub repository mathanrajchinnadurai07-debug/goalpath, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mathanrajchinnadurai07-debug/goalpath
- Repository: https://github.com/mathanrajchinnadurai07-debug/goalpath

## Overview

GoalPath is a multi-tenant productivity SaaS that connects long-term goals to daily planning, habit tracking, gratitude, and team accountability. A typical user signs in, creates goals and milestones, schedules and completes tasks, then reviews progress and reflects. The README documents additional sharing, AI coaching, privacy, export, and administration capabilities. The graph combines these documented workflows with source-index and excerpt evidence; several UI-to-API and unsampled subsystem links are documented rather than verified from implementation excerpts.

Main entry points: [`src/lib/prisma.ts`](https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/lib/prisma.ts) (PostgreSQL access), [`src/lib/auth.ts`](https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/lib/auth.ts) (Authentication), [`src/app/planner/page.tsx`](https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/app/planner/page.tsx) (Planner page), [`src/app/api/v1/goals/route.ts`](https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/app/api/v1/goals/route.ts) (Goals engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_app["App shell<br/>[layout.tsx]"]
  node_appctx["App context<br/>[AppContext.tsx]"]
  node_nav["Navigation<br/>[Navigation.tsx]"]
  node_goalsui["Goals pages<br/>[page.tsx]"]
  node_plannerui["Planner page<br/>[page.tsx]"]
  node_authui["Sign-in pages<br/>[page.tsx]"]
end

subgraph group_execution["Goals and execution"]
  node_goalapi["Goals engine<br/>[route.ts]"]
  node_milestones["Milestones<br/>[route.ts]"]
  node_tasks["Tasks<br/>[route.ts]"]
  node_timeblocks["Time blocks<br/>[route.ts]"]
  node_calendar["Calendar export<br/>[route.ts]"]
  node_focus["Focus sessions<br/>[route.ts]"]
end

subgraph group_wellbeing["Habits and gratitude"]
  node_habits["Habit tracking<br/>[route.ts]"]
  node_gratitude["Gratitude network<br/>[route.ts]"]
  node_support["Support directory<br/>[route.ts]"]
end

subgraph group_insight["Community and insight"]
  node_reviews["Reviews<br/>[route.ts]"]
  node_analytics["Analytics<br/>[route.ts]"]
  node_coach["AI coach<br/>[route.ts]"]
  node_groups["Groups and community<br/>[route.ts]"]
  node_admin["Admin console<br/>[route.ts]"]
end

subgraph group_platform["Platform services"]
  node_auth["Authentication<br/>[auth.ts]"]
  node_loginapi["Login and signup<br/>[route.ts]"]
  node_totp["Two-factor auth<br/>[totp.ts]"]
  node_ratelimit["Rate limiting<br/>[rate-limit.ts]"]
  node_cache["Cache service<br/>[cache.ts]"]
  node_redis["Redis client<br/>[redis.ts]"]
  node_db[("PostgreSQL access<br/>[prisma.ts]")]
  node_i18n["Translations<br/>[i18n.ts]"]
end

node_user(("User"))

node_user -->|"uses"| node_app
node_app -.->|"provides context"| node_appctx
node_appctx -->|"loads session"| node_authui
node_appctx -->|"loads translations"| node_i18n
node_appctx -->|"supplies user state"| node_nav
node_user -->|"signs in"| node_authui
node_authui -.->|"authenticates"| node_loginapi
node_loginapi -->|"checks credentials"| node_auth
node_loginapi -->|"verifies codes"| node_totp
node_loginapi -->|"limits attempts"| node_ratelimit
node_auth -->|"reads sessions"| node_db
node_auth -->|"caches sessions"| node_redis
node_user -->|"sets goals"| node_goalsui
node_goalsui -.->|"manages goals"| node_goalapi
node_goalapi -->|"checks user"| node_auth
node_goalapi -->|"reads and writes"| node_db
node_goalapi -->|"caches results"| node_cache
node_goalapi -.->|"supports breakdown"| node_milestones
node_user -->|"plans day"| node_plannerui
node_plannerui -.->|"manages tasks"| node_tasks
node_plannerui -.->|"schedules blocks"| node_timeblocks
node_tasks -->|"checks user"| node_auth
node_tasks -->|"reads and writes"| node_db
node_tasks -->|"caches results"| node_cache
node_timeblocks -->|"checks user"| node_auth
node_timeblocks -->|"reads and writes"| node_db
node_timeblocks -->|"caches results"| node_cache
node_plannerui -.->|"exports calendar"| node_calendar
node_plannerui -.->|"tracks focus"| node_focus
node_user -->|"tracks habits"| node_habits
node_habits -->|"reads and writes"| node_db
node_user -->|"records gratitude"| node_gratitude
node_gratitude -.->|"manages supporters"| node_support
node_user -->|"joins groups"| node_groups
node_user -->|"writes retrospectives"| node_reviews
node_user -->|"reviews progress"| node_analytics
node_analytics -->|"queries activity"| node_db
node_analytics -->|"caches results"| node_cache
node_user -->|"opts into coaching"| node_coach
node_coach -->|"reads activity"| node_db
node_user -->|"administers platform"| node_admin
node_cache -->|"stores cache"| node_redis

click node_app "https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/app/layout.tsx"
click node_appctx "https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/context/AppContext.tsx"
click node_nav "https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/components/Navigation.tsx"
click node_goalsui "https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/app/goals/page.tsx"
click node_plannerui "https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/app/planner/page.tsx"
click node_authui "https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/app/login/page.tsx"
click node_goalapi "https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/app/api/v1/goals/route.ts"
click node_milestones "https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/app/api/v1/milestones/route.ts"
click node_tasks "https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/app/api/v1/tasks/route.ts"
click node_timeblocks "https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/app/api/v1/timeblocks/route.ts"
click node_calendar "https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/app/api/v1/calendar/export.ics/route.ts"
click node_focus "https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/app/api/v1/focus/route.ts"
click node_habits "https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/app/api/v1/habits/route.ts"
click node_gratitude "https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/app/api/v1/gratitude/route.ts"
click node_support "https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/app/api/v1/gratitude/support-people/route.ts"
click node_reviews "https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/app/api/v1/reviews/route.ts"
click node_analytics "https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/app/api/v1/analytics/route.ts"
click node_coach "https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/app/api/v1/ai-coach/route.ts"
click node_groups "https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/app/api/v1/groups/route.ts"
click node_admin "https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/app/api/v1/admin/overview/route.ts"
click node_auth "https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/lib/auth.ts"
click node_loginapi "https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/app/api/v1/auth/login/route.ts"
click node_totp "https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/lib/totp.ts"
click node_ratelimit "https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/lib/rate-limit.ts"
click node_cache "https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/lib/cache.ts"
click node_redis "https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/lib/redis.ts"
click node_db "https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/lib/prisma.ts"
click node_i18n "https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/lib/i18n.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_appctx,node_nav,node_goalsui,node_plannerui,node_authui,node_user toneBlue
class node_goalapi,node_milestones,node_tasks,node_timeblocks,node_calendar,node_focus toneAmber
class node_habits,node_gratitude,node_support toneMint
class node_reviews,node_analytics,node_coach,node_groups,node_admin toneRose
class node_auth,node_loginapi,node_totp,node_ratelimit,node_cache,node_redis,node_db,node_i18n toneIndigo
```

## Components

### User experience

- [App shell](https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/app/layout.tsx): `src/app/layout.tsx`
- [App context](https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/context/AppContext.tsx): `src/context/AppContext.tsx`
- [Navigation](https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/components/Navigation.tsx): `src/components/Navigation.tsx`
- [Goals pages](https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/app/goals/page.tsx): `src/app/goals/page.tsx`
- [Planner page](https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/app/planner/page.tsx): `src/app/planner/page.tsx`
- [Sign-in pages](https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/app/login/page.tsx): `src/app/login/page.tsx`

### Goals and execution

- [Goals engine](https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/app/api/v1/goals/route.ts): `src/app/api/v1/goals/route.ts`
- [Milestones](https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/app/api/v1/milestones/route.ts): `src/app/api/v1/milestones/route.ts`
- [Tasks](https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/app/api/v1/tasks/route.ts): `src/app/api/v1/tasks/route.ts`
- [Time blocks](https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/app/api/v1/timeblocks/route.ts): `src/app/api/v1/timeblocks/route.ts`
- [Calendar export](https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/app/api/v1/calendar/export.ics/route.ts): `src/app/api/v1/calendar/export.ics/route.ts`
- [Focus sessions](https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/app/api/v1/focus/route.ts): `src/app/api/v1/focus/route.ts`

### Habits and gratitude

- [Habit tracking](https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/app/api/v1/habits/route.ts): `src/app/api/v1/habits/route.ts`
- [Gratitude network](https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/app/api/v1/gratitude/route.ts): `src/app/api/v1/gratitude/route.ts`
- [Support directory](https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/app/api/v1/gratitude/support-people/route.ts): `src/app/api/v1/gratitude/support-people/route.ts`

### Community and insight

- [Reviews](https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/app/api/v1/reviews/route.ts): `src/app/api/v1/reviews/route.ts`
- [Analytics](https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/app/api/v1/analytics/route.ts): `src/app/api/v1/analytics/route.ts`
- [AI coach](https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/app/api/v1/ai-coach/route.ts): `src/app/api/v1/ai-coach/route.ts`
- [Groups and community](https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/app/api/v1/groups/route.ts): `src/app/api/v1/groups/route.ts`
- [Admin console](https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/app/api/v1/admin/overview/route.ts): `src/app/api/v1/admin/overview/route.ts`

### Platform services

- [Authentication](https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/lib/auth.ts): `src/lib/auth.ts`
- [Login and signup](https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/app/api/v1/auth/login/route.ts): `src/app/api/v1/auth/login/route.ts`
- [Two-factor auth](https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/lib/totp.ts): `src/lib/totp.ts`
- [Rate limiting](https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/lib/rate-limit.ts): `src/lib/rate-limit.ts`
- [Cache service](https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/lib/cache.ts): `src/lib/cache.ts`
- [Redis client](https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/lib/redis.ts): `src/lib/redis.ts`
- [PostgreSQL access](https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/lib/prisma.ts): `src/lib/prisma.ts`
- [Translations](https://github.com/mathanrajchinnadurai07-debug/goalpath/blob/main/src/lib/i18n.ts): `src/lib/i18n.ts`

### Other components

- **User**

## Connections

- User → App shell: uses (evidence: `README.md`)
- App shell → App context: provides context
- App context → Sign-in pages: loads session (evidence: `src/context/AppContext.tsx`)
- App context → Translations: loads translations (evidence: `src/context/AppContext.tsx`)
- App context → Navigation: supplies user state (evidence: `src/components/Navigation.tsx`)
- User → Sign-in pages: signs in (evidence: `README.md`)
- Sign-in pages → Login and signup: authenticates
- Login and signup → Authentication: checks credentials (evidence: `src/app/api/v1/auth/login/route.ts`)
- Login and signup → Two-factor auth: verifies codes (evidence: `src/app/api/v1/auth/login/route.ts`)
- Login and signup → Rate limiting: limits attempts (evidence: `src/app/api/v1/auth/login/route.ts`)
- Authentication → PostgreSQL access: reads sessions (evidence: `src/lib/auth.ts`)
- Authentication → Redis client: caches sessions (evidence: `src/lib/auth.ts`)
- User → Goals pages: sets goals (evidence: `README.md`)
- Goals pages → Goals engine: manages goals
- Goals engine → Authentication: checks user (evidence: `src/app/api/v1/goals/route.ts`)
- Goals engine → PostgreSQL access: reads and writes (evidence: `src/app/api/v1/goals/route.ts`)
- Goals engine → Cache service: caches results (evidence: `src/app/api/v1/goals/route.ts`)
- Goals engine → Milestones: supports breakdown (evidence: `README.md`)
- User → Planner page: plans day (evidence: `README.md`)
- Planner page → Tasks: manages tasks
- Planner page → Time blocks: schedules blocks
- Tasks → Authentication: checks user (evidence: `src/app/api/v1/tasks/route.ts`)
- Tasks → PostgreSQL access: reads and writes (evidence: `src/app/api/v1/tasks/route.ts`)
- Tasks → Cache service: caches results (evidence: `src/app/api/v1/tasks/route.ts`)
- Time blocks → Authentication: checks user (evidence: `src/app/api/v1/timeblocks/route.ts`)
- Time blocks → PostgreSQL access: reads and writes (evidence: `src/app/api/v1/timeblocks/route.ts`)
- Time blocks → Cache service: caches results (evidence: `src/app/api/v1/timeblocks/route.ts`)
- Planner page → Calendar export: exports calendar (evidence: `README.md`)
- Planner page → Focus sessions: tracks focus (evidence: `README.md`)
- User → Habit tracking: tracks habits (evidence: `README.md`)
- Habit tracking → PostgreSQL access: reads and writes (evidence: `src/app/api/v1/habits/route.ts`)
- User → Gratitude network: records gratitude (evidence: `README.md`)
- Gratitude network → Support directory: manages supporters (evidence: `README.md`)
- User → Groups and community: joins groups (evidence: `README.md`)
- User → Reviews: writes retrospectives (evidence: `README.md`)
- User → Analytics: reviews progress (evidence: `README.md`)
- Analytics → PostgreSQL access: queries activity (evidence: `src/app/api/v1/analytics/route.ts`)
- Analytics → Cache service: caches results (evidence: `src/app/api/v1/analytics/route.ts`)
- User → AI coach: opts into coaching (evidence: `README.md`)
- AI coach → PostgreSQL access: reads activity (evidence: `src/app/api/v1/ai-coach/route.ts`)
- User → Admin console: administers platform (evidence: `README.md`)
- Cache service → Redis client: stores cache (evidence: `src/lib/cache.ts`)
