# harshsalunkhe2005/clarity architecture

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

- Interactive diagram: https://gitdiagram.com/harshsalunkhe2005/clarity
- Repository: https://github.com/harshsalunkhe2005/clarity

## Overview

Clarity is a natural-language productivity task app. Users enter a task in the dashboard; the input component parses it into structured fields using Gemini, with a keyword fallback, saves it to Firestore, and updates the task list. Users can sign in with email or Google, and the dashboard loads their saved tasks newest-first. The graph reflects documented capabilities and sampled calls; no server-side API layer is shown, and the route proxy explicitly leaves access checks to client-side auth.

Main entry points: [`src/components/TaskInput.tsx`](https://github.com/harshsalunkhe2005/clarity/blob/main/src/components/TaskInput.tsx) (Task entry), [`src/app/dashboard/page.tsx`](https://github.com/harshsalunkhe2005/clarity/blob/main/src/app/dashboard/page.tsx) (Task dashboard), [`src/context/AuthContext.tsx`](https://github.com/harshsalunkhe2005/clarity/blob/main/src/context/AuthContext.tsx) (Auth state), [`src/app/page.tsx`](https://github.com/harshsalunkhe2005/clarity/blob/main/src/app/page.tsx) (Landing page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["App entry"]
  node_landing["Landing page<br/>[page.tsx]"]
  node_glass["Glass UI components"]
  node_layout["App layout<br/>[layout.tsx]"]
end

subgraph group_identity["Accounts"]
  node_login["Sign-in page<br/>[page.tsx]"]
  node_authctx["Auth state<br/>[AuthContext.tsx]"]
  node_firebaseinit["Firebase setup<br/>[firebase.ts]"]
end

subgraph group_tasks["Task workflow"]
  node_dashboard["Task dashboard<br/>[page.tsx]"]
  node_taskinput["Task entry<br/>[TaskInput.tsx]"]
  node_parser["Task parsing<br/>[ai.ts]"]
  node_taskdb["Task storage access<br/>[db.ts]"]
end

subgraph group_services["External services"]
  node_firebaseauth(("Firebase Auth"))
  node_gemini(("Gemini"))
  node_firestore[("Firestore")]
end

node_user(("User"))

node_user -->|"opens app"| node_landing
node_landing -->|"checks auth"| node_authctx
node_landing -->|"routes unauthenticated"| node_login
node_landing -->|"routes authenticated"| node_dashboard
node_user -->|"submits credentials"| node_login
node_login -->|"requests sign-in"| node_authctx
node_authctx -->|"authenticates"| node_firebaseauth
node_firebaseinit -->|"initializes"| node_firebaseauth
node_layout -->|"provides auth state"| node_authctx
node_user -->|"enters task text"| node_taskinput
node_dashboard -->|"renders entry"| node_taskinput
node_taskinput -->|"reads user"| node_authctx
node_taskinput -->|"parses text"| node_parser
node_parser -->|"requests extraction"| node_gemini
node_taskinput -->|"saves parsed task"| node_taskdb
node_dashboard -->|"loads user tasks"| node_taskdb
node_taskdb -->|"reads and writes"| node_firestore
node_firebaseinit -->|"initializes"| node_firestore
node_taskinput -->|"notifies added task"| node_dashboard
node_dashboard -->|"renders task cards"| node_glass
node_login -->|"renders form controls"| node_glass

click node_landing "https://github.com/harshsalunkhe2005/clarity/blob/main/src/app/page.tsx"
click node_login "https://github.com/harshsalunkhe2005/clarity/blob/main/src/app/login/page.tsx"
click node_authctx "https://github.com/harshsalunkhe2005/clarity/blob/main/src/context/AuthContext.tsx"
click node_firebaseinit "https://github.com/harshsalunkhe2005/clarity/blob/main/src/lib/firebase.ts"
click node_dashboard "https://github.com/harshsalunkhe2005/clarity/blob/main/src/app/dashboard/page.tsx"
click node_taskinput "https://github.com/harshsalunkhe2005/clarity/blob/main/src/components/TaskInput.tsx"
click node_parser "https://github.com/harshsalunkhe2005/clarity/blob/main/src/lib/ai.ts"
click node_taskdb "https://github.com/harshsalunkhe2005/clarity/blob/main/src/lib/db.ts"
click node_glass "https://github.com/harshsalunkhe2005/clarity/blob/main/src/components/GlassComponents.tsx"
click node_layout "https://github.com/harshsalunkhe2005/clarity/blob/main/src/app/layout.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_landing,node_glass,node_layout,node_user toneBlue
class node_login,node_authctx,node_firebaseinit toneAmber
class node_dashboard,node_taskinput,node_parser,node_taskdb toneMint
class node_firebaseauth,node_gemini,node_firestore toneRose
```

## Components

### App entry

- [Landing page](https://github.com/harshsalunkhe2005/clarity/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [Glass UI components](https://github.com/harshsalunkhe2005/clarity/blob/main/src/components/GlassComponents.tsx): `src/components/GlassComponents.tsx`
- [App layout](https://github.com/harshsalunkhe2005/clarity/blob/main/src/app/layout.tsx): `src/app/layout.tsx`

### Accounts

- [Sign-in page](https://github.com/harshsalunkhe2005/clarity/blob/main/src/app/login/page.tsx): `src/app/login/page.tsx`
- [Auth state](https://github.com/harshsalunkhe2005/clarity/blob/main/src/context/AuthContext.tsx): `src/context/AuthContext.tsx`
- [Firebase setup](https://github.com/harshsalunkhe2005/clarity/blob/main/src/lib/firebase.ts): `src/lib/firebase.ts`

### Task workflow

- [Task dashboard](https://github.com/harshsalunkhe2005/clarity/blob/main/src/app/dashboard/page.tsx): `src/app/dashboard/page.tsx`
- [Task entry](https://github.com/harshsalunkhe2005/clarity/blob/main/src/components/TaskInput.tsx): `src/components/TaskInput.tsx`
- [Task parsing](https://github.com/harshsalunkhe2005/clarity/blob/main/src/lib/ai.ts): `src/lib/ai.ts`
- [Task storage access](https://github.com/harshsalunkhe2005/clarity/blob/main/src/lib/db.ts): `src/lib/db.ts`

### External services

- **Firebase Auth**
- **Gemini**
- **Firestore**

### Other components

- **User**

## Connections

- User → Landing page: opens app (evidence: `README.md`)
- Landing page → Auth state: checks auth (evidence: `src/app/page.tsx`)
- Landing page → Sign-in page: routes unauthenticated (evidence: `src/app/page.tsx`)
- Landing page → Task dashboard: routes authenticated (evidence: `src/app/page.tsx`)
- User → Sign-in page: submits credentials (evidence: `src/app/login/page.tsx`)
- Sign-in page → Auth state: requests sign-in (evidence: `src/app/login/page.tsx`)
- Auth state → Firebase Auth: authenticates (evidence: `src/context/AuthContext.tsx`)
- Firebase setup → Firebase Auth: initializes (evidence: `src/lib/firebase.ts`)
- App layout → Auth state: provides auth state (evidence: `src/app/layout.tsx`)
- User → Task entry: enters task text (evidence: `src/components/TaskInput.tsx`)
- Task dashboard → Task entry: renders entry (evidence: `src/app/dashboard/page.tsx`)
- Task entry → Auth state: reads user (evidence: `src/components/TaskInput.tsx`)
- Task entry → Task parsing: parses text (evidence: `src/components/TaskInput.tsx`)
- Task parsing → Gemini: requests extraction (evidence: `README.md`)
- Task entry → Task storage access: saves parsed task (evidence: `src/components/TaskInput.tsx`)
- Task dashboard → Task storage access: loads user tasks (evidence: `src/app/dashboard/page.tsx`)
- Task storage access → Firestore: reads and writes (evidence: `src/lib/db.ts`)
- Firebase setup → Firestore: initializes (evidence: `src/lib/firebase.ts`)
- Task entry → Task dashboard: notifies added task (evidence: `src/app/dashboard/page.tsx`)
- Task dashboard → Glass UI components: renders task cards (evidence: `src/app/dashboard/page.tsx`)
- Sign-in page → Glass UI components: renders form controls (evidence: `src/app/login/page.tsx`)
