# delighttagwi/taskhub architecture

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

- Interactive diagram: https://gitdiagram.com/delighttagwi/taskhub
- Repository: https://github.com/delighttagwi/taskhub

## Overview

APP SURVEY is a Next.js app for members to sign up, complete app-testing surveys, submit screenshots and answers, and earn point rewards; admins create tasks and review submissions before managing payouts. Members can request USDT cash-outs and use private messaging when access is unlocked. The browser UI talks to server route handlers, which use Supabase for authentication, database operations, storage, and chat events. The README also documents PWA installation. The graph follows shown calls and documented capabilities; some admin and portal UI details are unsampled.

Main entry points: [`lib/supabase.ts`](https://github.com/delighttagwi/taskhub/blob/main/lib/supabase.ts) (Session and profile), [`supabase/schema.sql`](https://github.com/delighttagwi/taskhub/blob/main/supabase/schema.sql) (Supabase data and storage), [`app/page.tsx`](https://github.com/delighttagwi/taskhub/blob/main/app/page.tsx) (Member and admin UI), [`app/api/auth/route.ts`](https://github.com/delighttagwi/taskhub/blob/main/app/api/auth/route.ts) (Signup and login)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Web experience"]
  node_web_app["Member and admin UI<br/>[page.tsx]"]
  node_root_layout["App shell<br/>[layout.tsx]"]
end

subgraph group_identity["Identity and access"]
  node_auth_api["Signup and login<br/>[route.ts]"]
  node_session_profile["Session and profile<br/>[supabase.ts]"]
end

subgraph group_task_rewards["Tasks and rewards"]
  node_portal_api["Member portal<br/>[route.ts]"]
  node_task_creation["Task creation<br/>[route.ts]"]
end

subgraph group_operations["Administration and chat"]
  node_admin_api["Admin operations<br/>[route.ts]"]
  node_admin_chat["Admin messaging<br/>[route.ts]"]
  node_chat_events["Live chat events<br/>[route.ts]"]
end

subgraph group_platform["Backend and PWA"]
  node_supabase[("Supabase data and storage<br/>[schema.sql]")]
  node_pwa_install["Install prompt"]
  node_pwa_manifest["PWA manifest<br/>[manifest.ts]"]
  node_service_worker["Service worker<br/>[sw.js]"]
end

node_member(("Member"))
node_admin_actor(("Administrator"))

node_member -->|"uses"| node_web_app
node_admin_actor -->|"uses"| node_web_app
node_web_app -->|"submits auth"| node_auth_api
node_web_app -->|"loads portal"| node_portal_api
node_web_app -->|"opens stream"| node_chat_events
node_auth_api -->|"authenticates"| node_supabase
node_auth_api -->|"creates session"| node_session_profile
node_portal_api -->|"checks identity"| node_session_profile
node_admin_api -->|"checks role"| node_session_profile
node_task_creation -->|"checks role"| node_session_profile
node_admin_chat -->|"checks role"| node_session_profile
node_chat_events -->|"checks identity"| node_session_profile
node_session_profile -->|"reads profile"| node_supabase
node_portal_api -->|"reads and writes"| node_supabase
node_task_creation -->|"stores tasks"| node_supabase
node_admin_api -->|"manages rewards"| node_supabase
node_admin_chat -->|"reads and sends"| node_supabase
node_chat_events -->|"subscribes changes"| node_supabase
node_root_layout -->|"renders"| node_pwa_install
node_pwa_install -->|"registers"| node_service_worker
node_root_layout -->|"declares manifest"| node_pwa_manifest

click node_web_app "https://github.com/delighttagwi/taskhub/blob/main/app/page.tsx"
click node_auth_api "https://github.com/delighttagwi/taskhub/blob/main/app/api/auth/route.ts"
click node_session_profile "https://github.com/delighttagwi/taskhub/blob/main/lib/supabase.ts"
click node_portal_api "https://github.com/delighttagwi/taskhub/blob/main/app/api/portal/route.ts"
click node_task_creation "https://github.com/delighttagwi/taskhub/blob/main/app/api/admin/tasks/route.ts"
click node_admin_api "https://github.com/delighttagwi/taskhub/blob/main/app/api/admin/route.ts"
click node_admin_chat "https://github.com/delighttagwi/taskhub/blob/main/app/api/admin/chat/route.ts"
click node_chat_events "https://github.com/delighttagwi/taskhub/blob/main/app/api/chat/events/route.ts"
click node_supabase "https://github.com/delighttagwi/taskhub/blob/main/supabase/schema.sql"
click node_pwa_install "https://github.com/delighttagwi/taskhub/blob/main/app/PwaInstallButton.tsx"
click node_pwa_manifest "https://github.com/delighttagwi/taskhub/blob/main/app/manifest.ts"
click node_service_worker "https://github.com/delighttagwi/taskhub/blob/main/public/sw.js"
click node_root_layout "https://github.com/delighttagwi/taskhub/blob/main/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_web_app,node_root_layout toneBlue
class node_auth_api,node_session_profile toneAmber
class node_portal_api,node_task_creation toneMint
class node_admin_api,node_admin_chat,node_chat_events toneRose
class node_supabase,node_pwa_install,node_pwa_manifest,node_service_worker,node_member,node_admin_actor toneIndigo
```

## Components

### Web experience

- [Member and admin UI](https://github.com/delighttagwi/taskhub/blob/main/app/page.tsx): `app/page.tsx`
- [App shell](https://github.com/delighttagwi/taskhub/blob/main/app/layout.tsx): `app/layout.tsx`

### Identity and access

- [Signup and login](https://github.com/delighttagwi/taskhub/blob/main/app/api/auth/route.ts): `app/api/auth/route.ts`
- [Session and profile](https://github.com/delighttagwi/taskhub/blob/main/lib/supabase.ts): `lib/supabase.ts`

### Tasks and rewards

- [Member portal](https://github.com/delighttagwi/taskhub/blob/main/app/api/portal/route.ts): `app/api/portal/route.ts`
- [Task creation](https://github.com/delighttagwi/taskhub/blob/main/app/api/admin/tasks/route.ts): `app/api/admin/tasks/route.ts`

### Administration and chat

- [Admin operations](https://github.com/delighttagwi/taskhub/blob/main/app/api/admin/route.ts): `app/api/admin/route.ts`
- [Admin messaging](https://github.com/delighttagwi/taskhub/blob/main/app/api/admin/chat/route.ts): `app/api/admin/chat/route.ts`
- [Live chat events](https://github.com/delighttagwi/taskhub/blob/main/app/api/chat/events/route.ts): `app/api/chat/events/route.ts`

### Backend and PWA

- [Supabase data and storage](https://github.com/delighttagwi/taskhub/blob/main/supabase/schema.sql): `supabase/schema.sql`
- [Install prompt](https://github.com/delighttagwi/taskhub/blob/main/app/PwaInstallButton.tsx): `app/PwaInstallButton.tsx`
- [PWA manifest](https://github.com/delighttagwi/taskhub/blob/main/app/manifest.ts): `app/manifest.ts`
- [Service worker](https://github.com/delighttagwi/taskhub/blob/main/public/sw.js): `public/sw.js`

### Other components

- **Member**
- **Administrator**

## Connections

- Member → Member and admin UI: uses (evidence: `README.md`)
- Administrator → Member and admin UI: uses (evidence: `README.md`)
- Member and admin UI → Signup and login: submits auth (evidence: `app/page.tsx`)
- Member and admin UI → Member portal: loads portal (evidence: `app/page.tsx`)
- Member and admin UI → Live chat events: opens stream (evidence: `app/page.tsx`)
- Signup and login → Supabase data and storage: authenticates (evidence: `app/api/auth/route.ts`)
- Signup and login → Session and profile: creates session (evidence: `app/api/auth/route.ts`)
- Member portal → Session and profile: checks identity (evidence: `app/api/portal/route.ts`)
- Admin operations → Session and profile: checks role (evidence: `app/api/admin/route.ts`)
- Task creation → Session and profile: checks role (evidence: `app/api/admin/tasks/route.ts`)
- Admin messaging → Session and profile: checks role (evidence: `app/api/admin/chat/route.ts`)
- Live chat events → Session and profile: checks identity (evidence: `app/api/chat/events/route.ts`)
- Session and profile → Supabase data and storage: reads profile (evidence: `lib/supabase.ts`)
- Member portal → Supabase data and storage: reads and writes (evidence: `app/api/portal/route.ts`)
- Task creation → Supabase data and storage: stores tasks (evidence: `app/api/admin/tasks/route.ts`)
- Admin operations → Supabase data and storage: manages rewards (evidence: `app/api/admin/route.ts`)
- Admin messaging → Supabase data and storage: reads and sends (evidence: `app/api/admin/chat/route.ts`)
- Live chat events → Supabase data and storage: subscribes changes (evidence: `app/api/chat/events/route.ts`)
- App shell → Install prompt: renders (evidence: `app/layout.tsx`)
- Install prompt → Service worker: registers (evidence: `app/PwaInstallButton.tsx`)
- App shell → PWA manifest: declares manifest (evidence: `app/layout.tsx`)
