# sina9rk/planner architecture

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

- Interactive diagram: https://gitdiagram.com/sina9rk/planner
- Repository: https://github.com/sina9rk/planner

## Overview

This is a Persian-language goal and task planner with account registration, persona-based onboarding, goal tracking, and profile personalization. The main workflow is account creation or login, onboarding to assign a persona, then managing goals and tasks while recording progress; dashboard and profile pages present user context and statistics. Advisor, theme, and goal-log features are represented from the repository tree, but their connections are not asserted where sampled evidence does not establish them. Evidence is limited to the README and the supplied source excerpts and index.

Main entry points: [`src/lib/prisma.ts`](https://github.com/sina9rk/planner/blob/main/src/lib/prisma.ts) (Application Database), [`src/lib/actions/auth.ts`](https://github.com/sina9rk/planner/blob/main/src/lib/actions/auth.ts) (Auth Actions), [`src/app/onboarding/page.tsx`](https://github.com/sina9rk/planner/blob/main/src/app/onboarding/page.tsx) (Onboarding), [`src/app/profile/page.tsx`](https://github.com/sina9rk/planner/blob/main/src/app/profile/page.tsx) (Profile)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Identity &amp; Access"]
  node_login["Login<br/>[login-form.tsx]"]
  node_register["Registration<br/>[register-form.tsx]"]
  node_auth_actions["Auth Actions<br/>[auth.ts]"]
  node_auth_service["Auth Service<br/>[auth.ts]"]
  node_auth_route["Auth Route<br/>[route.ts]"]
end

subgraph group_personalization["Onboarding &amp; Profile"]
  node_onboarding["Onboarding<br/>[page.tsx]"]
  node_persona["Persona Profiles<br/>[personas.ts]"]
  node_onboarding_actions["Onboarding Actions<br/>[onboarding.ts]"]
  node_profile["Profile<br/>[page.tsx]"]
  node_theme["Theme Settings<br/>[theme-section.tsx]"]
end

subgraph group_planning["Goals &amp; Tasks"]
  node_dashboard["Dashboard<br/>[page.tsx]"]
  node_goals_list["Goals List<br/>[page.tsx]"]
  node_goal_create["Goal Creation<br/>[goal-form.tsx]"]
  node_goal_actions["Goal Actions<br/>[goal-create.ts]"]
  node_goal_detail["Goal Workspace<br/>[page.tsx]"]
  node_goal_tasks_ui["Goal Tasks<br/>[goal-tasks.tsx]"]
  node_goal_task_actions["Goal Task Actions<br/>[goal-tasks.ts]"]
  node_goal_advisor["Goal Advisor<br/>[page.tsx]"]
  node_advisor_chat["Advisor Chat<br/>[advisor-chat.tsx]"]
  node_tasks_page["Task Planner"]
  node_task_actions["Task Actions<br/>[task-actions.ts]"]
  node_goals_data["Goal Queries<br/>[goals.ts]"]
end

subgraph group_shared["Shared Services"]
  node_guards["Access Guards<br/>[guards.ts]"]
  node_flow["Route Flow<br/>[flow.ts]"]
  node_stats["User Statistics<br/>[stats.ts]"]
  node_events["Event Tracking<br/>[track.ts]"]
  node_database[("Application Database<br/>[prisma.ts]")]
  node_ui["Shared UI<br/>[ui.tsx]"]
end

node_user(("User"))

node_user -.->|"signs in"| node_login
node_user -.->|"creates account"| node_register
node_login -->|"submits credentials"| node_auth_actions
node_register -->|"submits registration"| node_auth_actions
node_auth_actions -->|"signs in"| node_auth_service
node_auth_actions -->|"reads and creates users"| node_database
node_auth_actions -->|"chooses redirect"| node_flow
node_auth_actions -->|"records events"| node_events
node_auth_route -->|"uses handlers"| node_auth_service
node_auth_service -->|"looks up users"| node_database
node_onboarding -->|"checks access"| node_guards
node_onboarding -->|"uses route paths"| node_flow
node_onboarding -->|"loads persona content"| node_persona
node_onboarding -->|"submits answers"| node_onboarding_actions
node_onboarding -->|"loads statistics"| node_stats
node_onboarding_actions -->|"persists onboarding"| node_database
node_onboarding_actions -->|"scores answers"| node_persona
node_onboarding_actions -->|"records events"| node_events
node_profile -->|"requires persona"| node_guards
node_profile -->|"reads profile data"| node_database
node_profile -->|"loads persona"| node_persona
node_profile -->|"uses date helpers"| node_goals_data
node_theme -->|"uses shared UI"| node_ui
node_dashboard -->|"checks session"| node_auth_service
node_dashboard -->|"loads dashboard data"| node_database
node_dashboard -->|"loads persona"| node_persona
node_goals_list -->|"checks access"| node_guards
node_goals_list -->|"uses route paths"| node_flow
node_goals_list -->|"loads goals"| node_goals_data
node_goal_create -->|"submits goal"| node_goal_actions
node_goal_detail -.->|"renders task controls"| node_goal_tasks_ui
node_goal_tasks_ui -->|"dispatches task actions"| node_goal_task_actions
node_goal_task_actions -->|"updates tasks and logs"| node_database
node_goal_task_actions -->|"records completion"| node_events
node_tasks_page -->|"completes tasks"| node_task_actions
node_goal_actions -.->|"creates goal"| node_database
node_goal_advisor -.->|"hosts chat"| node_advisor_chat

click node_login "https://github.com/sina9rk/planner/blob/main/src/app/login/login-form.tsx"
click node_register "https://github.com/sina9rk/planner/blob/main/src/app/register/register-form.tsx"
click node_auth_actions "https://github.com/sina9rk/planner/blob/main/src/lib/actions/auth.ts"
click node_auth_service "https://github.com/sina9rk/planner/blob/main/src/lib/auth.ts"
click node_auth_route "https://github.com/sina9rk/planner/blob/main/src/app/api/auth/%5B...nextauth%5D/route.ts"
click node_onboarding "https://github.com/sina9rk/planner/blob/main/src/app/onboarding/page.tsx"
click node_persona "https://github.com/sina9rk/planner/blob/main/src/lib/personas.ts"
click node_onboarding_actions "https://github.com/sina9rk/planner/blob/main/src/lib/actions/onboarding.ts"
click node_profile "https://github.com/sina9rk/planner/blob/main/src/app/profile/page.tsx"
click node_theme "https://github.com/sina9rk/planner/blob/main/src/app/profile/theme-section.tsx"
click node_dashboard "https://github.com/sina9rk/planner/blob/main/src/app/dashboard/page.tsx"
click node_goals_list "https://github.com/sina9rk/planner/blob/main/src/app/goals/page.tsx"
click node_goal_create "https://github.com/sina9rk/planner/blob/main/src/app/goals/new/goal-form.tsx"
click node_goal_actions "https://github.com/sina9rk/planner/blob/main/src/lib/actions/goal-create.ts"
click node_goal_detail "https://github.com/sina9rk/planner/blob/main/src/app/goals/%5Bid%5D/page.tsx"
click node_goal_tasks_ui "https://github.com/sina9rk/planner/blob/main/src/app/goals/%5Bid%5D/goal-tasks.tsx"
click node_goal_task_actions "https://github.com/sina9rk/planner/blob/main/src/lib/actions/goal-tasks.ts"
click node_goal_advisor "https://github.com/sina9rk/planner/blob/main/src/app/goals/%5Bid%5D/advisor/page.tsx"
click node_advisor_chat "https://github.com/sina9rk/planner/blob/main/src/app/goals/%5Bid%5D/advisor-chat.tsx"
click node_tasks_page "https://github.com/sina9rk/planner/blob/main/src/app/tasks/tasks-page-client.tsx"
click node_task_actions "https://github.com/sina9rk/planner/blob/main/src/lib/actions/task-actions.ts"
click node_goals_data "https://github.com/sina9rk/planner/blob/main/src/lib/goals.ts"
click node_guards "https://github.com/sina9rk/planner/blob/main/src/lib/guards.ts"
click node_flow "https://github.com/sina9rk/planner/blob/main/src/lib/flow.ts"
click node_stats "https://github.com/sina9rk/planner/blob/main/src/lib/stats.ts"
click node_events "https://github.com/sina9rk/planner/blob/main/src/lib/track.ts"
click node_database "https://github.com/sina9rk/planner/blob/main/src/lib/prisma.ts"
click node_ui "https://github.com/sina9rk/planner/blob/main/src/components/ui.tsx"

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_login,node_register,node_auth_actions,node_auth_service,node_auth_route,node_user toneBlue
class node_onboarding,node_persona,node_onboarding_actions,node_profile,node_theme toneAmber
class node_dashboard,node_goals_list,node_goal_create,node_goal_actions,node_goal_detail,node_goal_tasks_ui,node_goal_task_actions,node_goal_advisor,node_advisor_chat,node_tasks_page,node_task_actions,node_goals_data toneMint
class node_guards,node_flow,node_stats,node_events,node_database,node_ui toneRose
```

## Components

### Identity & Access

- [Login](https://github.com/sina9rk/planner/blob/main/src/app/login/login-form.tsx): `src/app/login/login-form.tsx`
- [Registration](https://github.com/sina9rk/planner/blob/main/src/app/register/register-form.tsx): `src/app/register/register-form.tsx`
- [Auth Actions](https://github.com/sina9rk/planner/blob/main/src/lib/actions/auth.ts): `src/lib/actions/auth.ts`
- [Auth Service](https://github.com/sina9rk/planner/blob/main/src/lib/auth.ts): `src/lib/auth.ts`
- [Auth Route](https://github.com/sina9rk/planner/blob/main/src/app/api/auth/%5B...nextauth%5D/route.ts): `src/app/api/auth/[...nextauth]/route.ts`

### Onboarding & Profile

- [Onboarding](https://github.com/sina9rk/planner/blob/main/src/app/onboarding/page.tsx): `src/app/onboarding/page.tsx`
- [Persona Profiles](https://github.com/sina9rk/planner/blob/main/src/lib/personas.ts): `src/lib/personas.ts`
- [Onboarding Actions](https://github.com/sina9rk/planner/blob/main/src/lib/actions/onboarding.ts): `src/lib/actions/onboarding.ts`
- [Profile](https://github.com/sina9rk/planner/blob/main/src/app/profile/page.tsx): `src/app/profile/page.tsx`
- [Theme Settings](https://github.com/sina9rk/planner/blob/main/src/app/profile/theme-section.tsx): `src/app/profile/theme-section.tsx`

### Goals & Tasks

- [Dashboard](https://github.com/sina9rk/planner/blob/main/src/app/dashboard/page.tsx): `src/app/dashboard/page.tsx`
- [Goals List](https://github.com/sina9rk/planner/blob/main/src/app/goals/page.tsx): `src/app/goals/page.tsx`
- [Goal Creation](https://github.com/sina9rk/planner/blob/main/src/app/goals/new/goal-form.tsx): `src/app/goals/new/goal-form.tsx`
- [Goal Actions](https://github.com/sina9rk/planner/blob/main/src/lib/actions/goal-create.ts): `src/lib/actions/goal-create.ts`
- [Goal Workspace](https://github.com/sina9rk/planner/blob/main/src/app/goals/%5Bid%5D/page.tsx): `src/app/goals/[id]/page.tsx`
- [Goal Tasks](https://github.com/sina9rk/planner/blob/main/src/app/goals/%5Bid%5D/goal-tasks.tsx): `src/app/goals/[id]/goal-tasks.tsx`
- [Goal Task Actions](https://github.com/sina9rk/planner/blob/main/src/lib/actions/goal-tasks.ts): `src/lib/actions/goal-tasks.ts`
- [Goal Advisor](https://github.com/sina9rk/planner/blob/main/src/app/goals/%5Bid%5D/advisor/page.tsx): `src/app/goals/[id]/advisor/page.tsx`
- [Advisor Chat](https://github.com/sina9rk/planner/blob/main/src/app/goals/%5Bid%5D/advisor-chat.tsx): `src/app/goals/[id]/advisor-chat.tsx`
- [Task Planner](https://github.com/sina9rk/planner/blob/main/src/app/tasks/tasks-page-client.tsx): `src/app/tasks/tasks-page-client.tsx`
- [Task Actions](https://github.com/sina9rk/planner/blob/main/src/lib/actions/task-actions.ts): `src/lib/actions/task-actions.ts`
- [Goal Queries](https://github.com/sina9rk/planner/blob/main/src/lib/goals.ts): `src/lib/goals.ts`

### Shared Services

- [Access Guards](https://github.com/sina9rk/planner/blob/main/src/lib/guards.ts): `src/lib/guards.ts`
- [Route Flow](https://github.com/sina9rk/planner/blob/main/src/lib/flow.ts): `src/lib/flow.ts`
- [User Statistics](https://github.com/sina9rk/planner/blob/main/src/lib/stats.ts): `src/lib/stats.ts`
- [Event Tracking](https://github.com/sina9rk/planner/blob/main/src/lib/track.ts): `src/lib/track.ts`
- [Application Database](https://github.com/sina9rk/planner/blob/main/src/lib/prisma.ts): `src/lib/prisma.ts`
- [Shared UI](https://github.com/sina9rk/planner/blob/main/src/components/ui.tsx): `src/components/ui.tsx`

### Other components

- **User**

## Connections

- User → Login: signs in
- User → Registration: creates account
- Login → Auth Actions: submits credentials (evidence: `src/app/login/login-form.tsx`)
- Registration → Auth Actions: submits registration (evidence: `src/app/register/register-form.tsx`)
- Auth Actions → Auth Service: signs in (evidence: `src/lib/actions/auth.ts`)
- Auth Actions → Application Database: reads and creates users (evidence: `src/lib/actions/auth.ts`)
- Auth Actions → Route Flow: chooses redirect (evidence: `src/lib/actions/auth.ts`)
- Auth Actions → Event Tracking: records events (evidence: `src/lib/actions/auth.ts`)
- Auth Route → Auth Service: uses handlers (evidence: `src/app/api/auth/[...nextauth]/route.ts`)
- Auth Service → Application Database: looks up users (evidence: `src/lib/auth.ts`)
- Onboarding → Access Guards: checks access (evidence: `src/app/onboarding/page.tsx`)
- Onboarding → Route Flow: uses route paths (evidence: `src/app/onboarding/page.tsx`)
- Onboarding → Persona Profiles: loads persona content (evidence: `src/app/onboarding/page.tsx`)
- Onboarding → Onboarding Actions: submits answers (evidence: `src/app/onboarding/page.tsx`)
- Onboarding → User Statistics: loads statistics (evidence: `src/app/onboarding/page.tsx`)
- Onboarding Actions → Application Database: persists onboarding (evidence: `src/lib/actions/onboarding.ts`)
- Onboarding Actions → Persona Profiles: scores answers (evidence: `src/lib/actions/onboarding.ts`)
- Onboarding Actions → Event Tracking: records events (evidence: `src/lib/actions/onboarding.ts`)
- Profile → Access Guards: requires persona (evidence: `src/app/profile/page.tsx`)
- Profile → Application Database: reads profile data (evidence: `src/app/profile/page.tsx`)
- Profile → Persona Profiles: loads persona (evidence: `src/app/profile/page.tsx`)
- Profile → Goal Queries: uses date helpers (evidence: `src/app/profile/page.tsx`)
- Theme Settings → Shared UI: uses shared UI (evidence: `src/app/profile/theme-section.tsx`)
- Dashboard → Auth Service: checks session (evidence: `src/app/dashboard/page.tsx`)
- Dashboard → Application Database: loads dashboard data (evidence: `src/app/dashboard/page.tsx`)
- Dashboard → Persona Profiles: loads persona (evidence: `src/app/dashboard/page.tsx`)
- Goals List → Access Guards: checks access (evidence: `src/app/goals/page.tsx`)
- Goals List → Route Flow: uses route paths (evidence: `src/app/goals/page.tsx`)
- Goals List → Goal Queries: loads goals (evidence: `src/app/goals/page.tsx`)
- Goal Creation → Goal Actions: submits goal (evidence: `src/app/goals/new/goal-form.tsx`)
- Goal Workspace → Goal Tasks: renders task controls
- Goal Tasks → Goal Task Actions: dispatches task actions (evidence: `src/app/goals/[id]/goal-tasks.tsx`)
- Goal Task Actions → Application Database: updates tasks and logs (evidence: `src/lib/actions/goal-tasks.ts`)
- Goal Task Actions → Event Tracking: records completion (evidence: `src/lib/actions/goal-tasks.ts`)
- Task Planner → Task Actions: completes tasks (evidence: `src/app/tasks/tasks-page-client.tsx`)
- Goal Actions → Application Database: creates goal
- Goal Advisor → Advisor Chat: hosts chat
