# paing-tech/fyp-26-s2-34-smarttaskallocationapplication architecture

> Architecture diagram of the GitHub repository paing-tech/fyp-26-s2-34-smarttaskallocationapplication, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication
- Repository: https://github.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication

## Overview

Smart Task Allocation is a multi-role workforce and task-management web application built with Next.js, with Supabase-backed APIs. Its central domain covers task creation and assignment, employee task views, workforce and organization administration, attendance and leave, analytics, and AI-agent features. The tree also shows workspace collaboration and platform support/content management. The supplied excerpts establish several API-to-storage and helper calls, but do not show page-to-API wiring; those UI relationships are therefore omitted rather than inferred.

Main entry points: [`smart-task-allocation/src/app/api/tasks/route.js`](https://github.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication/blob/main/smart-task-allocation/src/app/api/tasks/route.js) (Task Management), [`smart-task-allocation/src/app/api/employee-tasks/route.js`](https://github.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication/blob/main/smart-task-allocation/src/app/api/employee-tasks/route.js) (Employee Tasks), [`smart-task-allocation/src/lib/serverAuth.js`](https://github.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication/blob/main/smart-task-allocation/src/lib/serverAuth.js) (Server Auth), [`smart-task-allocation/src/lib/supabaseAdmin.js`](https://github.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication/blob/main/smart-task-allocation/src/lib/supabaseAdmin.js) (Supabase Admin Client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_tasks["Tasks and Workspaces"]
  node_tasks_api["Task Management<br/>[route.js]"]
  node_employee_tasks["Employee Tasks<br/>[route.js]"]
  node_task_groups["Task Groups<br/>[route.js]"]
  node_task_attachments["Task Attachments<br/>[route.js]"]
  node_workspaces["Workspaces<br/>[route.js]"]
end

subgraph group_workforce["Workforce and Organization"]
  node_accounts["Account Management<br/>[route.js]"]
  node_employees["Employee Directory<br/>[route.js]"]
  node_organization["Organization Data<br/>[route.js]"]
  node_org_chart["Organization Chart<br/>[route.js]"]
  node_profile["User Profile<br/>[route.js]"]
  node_leave["Leave Requests<br/>[route.js]"]
  node_attendance["Attendance<br/>[route.js]"]
  node_analytics["Allocation Insights<br/>[route.js]"]
end

subgraph group_agents["AI Agents"]
  node_agent_api["Agent API<br/>[route.js]"]
  node_agent_plan["Plan Generation<br/>[route.js]"]
  node_agent_knowledge["Agent Knowledge<br/>[route.js]"]
end

subgraph group_admin["Platform and Support"]
  node_support["Support Inquiries<br/>[route.js]"]
  node_content_manager["Marketing Content"]
end

subgraph group_runtime["API Runtime"]
  node_auth["Server Auth<br/>[serverAuth.js]"]
  node_admin_client["Supabase Admin Client<br/>[supabaseAdmin.js]"]
  node_task_status["Task Status Sync<br/>[taskStatusSync.js]"]
  node_task_group_helper["Task Group Helper<br/>[taskGroups.js]"]
  node_telegram_notifications["Agent Notifications"]
end

node_user(("User"))
node_supabase[("Supabase")]

node_tasks_api -->|"authenticates"| node_auth
node_tasks_api -->|"creates client"| node_admin_client
node_tasks_api -->|"syncs status"| node_task_status
node_tasks_api -->|"ensures group"| node_task_group_helper
node_tasks_api -->|"notifies owner"| node_telegram_notifications
node_employee_tasks -->|"authenticates"| node_auth
node_employee_tasks -->|"creates client"| node_admin_client
node_employee_tasks -->|"syncs status"| node_task_status
node_support -->|"checks access"| node_auth
node_support -->|"creates client"| node_admin_client
node_org_chart -->|"loads account data"| node_organization
node_content_manager -.->|"loads content"| node_supabase
node_tasks_api -->|"reads and writes"| node_supabase
node_employee_tasks -->|"reads tasks"| node_supabase
node_accounts -->|"reads and writes"| node_supabase
node_employees -->|"reads workforce data"| node_supabase
node_organization -->|"reads organization data"| node_supabase
node_org_chart -->|"reads and updates"| node_supabase
node_profile -->|"updates profile data"| node_supabase
node_task_attachments -->|"manages attachments"| node_supabase
node_workspaces -->|"manages workspaces"| node_supabase

click node_tasks_api "https://github.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication/blob/main/smart-task-allocation/src/app/api/tasks/route.js"
click node_employee_tasks "https://github.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication/blob/main/smart-task-allocation/src/app/api/employee-tasks/route.js"
click node_task_groups "https://github.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication/blob/main/smart-task-allocation/src/app/api/task-groups/route.js"
click node_task_attachments "https://github.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication/blob/main/smart-task-allocation/src/app/api/task-attachments/route.js"
click node_workspaces "https://github.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication/blob/main/smart-task-allocation/src/app/api/workspaces/route.js"
click node_accounts "https://github.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication/blob/main/smart-task-allocation/src/app/api/accounts/route.js"
click node_employees "https://github.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication/blob/main/smart-task-allocation/src/app/api/employees/route.js"
click node_organization "https://github.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication/blob/main/smart-task-allocation/src/app/api/my-organization/route.js"
click node_org_chart "https://github.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication/blob/main/smart-task-allocation/src/app/api/org-chart/route.js"
click node_profile "https://github.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication/blob/main/smart-task-allocation/src/app/api/my-profile/route.js"
click node_leave "https://github.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication/blob/main/smart-task-allocation/src/app/api/leave-requests/route.js"
click node_attendance "https://github.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication/blob/main/smart-task-allocation/src/app/api/attendance/route.js"
click node_analytics "https://github.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication/blob/main/smart-task-allocation/src/app/api/insights/allocation-efficiency/route.js"
click node_agent_api "https://github.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication/blob/main/smart-task-allocation/src/app/api/agent/route.js"
click node_agent_plan "https://github.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication/blob/main/smart-task-allocation/src/app/api/agent/generate-plan/route.js"
click node_agent_knowledge "https://github.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication/blob/main/smart-task-allocation/src/app/api/agent/knowledge/route.js"
click node_support "https://github.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication/blob/main/smart-task-allocation/src/app/api/support-inquiries/route.js"
click node_content_manager "https://github.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication/blob/main/smart-task-allocation/src/components/MarketingContentManager.js"
click node_auth "https://github.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication/blob/main/smart-task-allocation/src/lib/serverAuth.js"
click node_admin_client "https://github.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication/blob/main/smart-task-allocation/src/lib/supabaseAdmin.js"
click node_task_status "https://github.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication/blob/main/smart-task-allocation/src/lib/taskStatusSync.js"
click node_task_group_helper "https://github.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication/blob/main/smart-task-allocation/src/lib/taskGroups.js"
click node_telegram_notifications "https://github.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication/blob/main/smart-task-allocation/src/lib/agentNotifications.js"

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_tasks_api,node_employee_tasks,node_task_groups,node_task_attachments,node_workspaces,node_user toneBlue
class node_accounts,node_employees,node_organization,node_org_chart,node_profile,node_leave,node_attendance,node_analytics,node_supabase toneAmber
class node_agent_api,node_agent_plan,node_agent_knowledge toneMint
class node_support,node_content_manager toneRose
class node_auth,node_admin_client,node_task_status,node_task_group_helper,node_telegram_notifications toneIndigo
```

## Components

### Tasks and Workspaces

- [Task Management](https://github.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication/blob/main/smart-task-allocation/src/app/api/tasks/route.js): `smart-task-allocation/src/app/api/tasks/route.js`
- [Employee Tasks](https://github.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication/blob/main/smart-task-allocation/src/app/api/employee-tasks/route.js): `smart-task-allocation/src/app/api/employee-tasks/route.js`
- [Task Groups](https://github.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication/blob/main/smart-task-allocation/src/app/api/task-groups/route.js): `smart-task-allocation/src/app/api/task-groups/route.js`
- [Task Attachments](https://github.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication/blob/main/smart-task-allocation/src/app/api/task-attachments/route.js): `smart-task-allocation/src/app/api/task-attachments/route.js`
- [Workspaces](https://github.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication/blob/main/smart-task-allocation/src/app/api/workspaces/route.js): `smart-task-allocation/src/app/api/workspaces/route.js`

### Workforce and Organization

- [Account Management](https://github.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication/blob/main/smart-task-allocation/src/app/api/accounts/route.js): `smart-task-allocation/src/app/api/accounts/route.js`
- [Employee Directory](https://github.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication/blob/main/smart-task-allocation/src/app/api/employees/route.js): `smart-task-allocation/src/app/api/employees/route.js`
- [Organization Data](https://github.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication/blob/main/smart-task-allocation/src/app/api/my-organization/route.js): `smart-task-allocation/src/app/api/my-organization/route.js`
- [Organization Chart](https://github.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication/blob/main/smart-task-allocation/src/app/api/org-chart/route.js): `smart-task-allocation/src/app/api/org-chart/route.js`
- [User Profile](https://github.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication/blob/main/smart-task-allocation/src/app/api/my-profile/route.js): `smart-task-allocation/src/app/api/my-profile/route.js`
- [Leave Requests](https://github.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication/blob/main/smart-task-allocation/src/app/api/leave-requests/route.js): `smart-task-allocation/src/app/api/leave-requests/route.js`
- [Attendance](https://github.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication/blob/main/smart-task-allocation/src/app/api/attendance/route.js): `smart-task-allocation/src/app/api/attendance/route.js`
- [Allocation Insights](https://github.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication/blob/main/smart-task-allocation/src/app/api/insights/allocation-efficiency/route.js): `smart-task-allocation/src/app/api/insights/allocation-efficiency/route.js`

### AI Agents

- [Agent API](https://github.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication/blob/main/smart-task-allocation/src/app/api/agent/route.js): `smart-task-allocation/src/app/api/agent/route.js`
- [Plan Generation](https://github.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication/blob/main/smart-task-allocation/src/app/api/agent/generate-plan/route.js): `smart-task-allocation/src/app/api/agent/generate-plan/route.js`
- [Agent Knowledge](https://github.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication/blob/main/smart-task-allocation/src/app/api/agent/knowledge/route.js): `smart-task-allocation/src/app/api/agent/knowledge/route.js`

### Platform and Support

- [Support Inquiries](https://github.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication/blob/main/smart-task-allocation/src/app/api/support-inquiries/route.js): `smart-task-allocation/src/app/api/support-inquiries/route.js`
- [Marketing Content](https://github.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication/blob/main/smart-task-allocation/src/components/MarketingContentManager.js): `smart-task-allocation/src/components/MarketingContentManager.js`

### API Runtime

- [Server Auth](https://github.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication/blob/main/smart-task-allocation/src/lib/serverAuth.js): `smart-task-allocation/src/lib/serverAuth.js`
- [Supabase Admin Client](https://github.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication/blob/main/smart-task-allocation/src/lib/supabaseAdmin.js): `smart-task-allocation/src/lib/supabaseAdmin.js`
- [Task Status Sync](https://github.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication/blob/main/smart-task-allocation/src/lib/taskStatusSync.js): `smart-task-allocation/src/lib/taskStatusSync.js`
- [Task Group Helper](https://github.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication/blob/main/smart-task-allocation/src/lib/taskGroups.js): `smart-task-allocation/src/lib/taskGroups.js`
- [Agent Notifications](https://github.com/paing-tech/fyp-26-s2-34-smarttaskallocationapplication/blob/main/smart-task-allocation/src/lib/agentNotifications.js): `smart-task-allocation/src/lib/agentNotifications.js`

### Other components

- **User**
- **Supabase**

## Connections

- Task Management → Server Auth: authenticates (evidence: `smart-task-allocation/src/app/api/tasks/route.js`)
- Task Management → Supabase Admin Client: creates client (evidence: `smart-task-allocation/src/app/api/tasks/route.js`)
- Task Management → Task Status Sync: syncs status (evidence: `smart-task-allocation/src/app/api/tasks/route.js`)
- Task Management → Task Group Helper: ensures group (evidence: `smart-task-allocation/src/app/api/tasks/route.js`)
- Task Management → Agent Notifications: notifies owner (evidence: `smart-task-allocation/src/app/api/tasks/route.js`)
- Employee Tasks → Server Auth: authenticates (evidence: `smart-task-allocation/src/app/api/employee-tasks/route.js`)
- Employee Tasks → Supabase Admin Client: creates client (evidence: `smart-task-allocation/src/app/api/employee-tasks/route.js`)
- Employee Tasks → Task Status Sync: syncs status (evidence: `smart-task-allocation/src/app/api/employee-tasks/route.js`)
- Support Inquiries → Server Auth: checks access (evidence: `smart-task-allocation/src/app/api/support-inquiries/route.js`)
- Support Inquiries → Supabase Admin Client: creates client (evidence: `smart-task-allocation/src/app/api/support-inquiries/route.js`)
- Organization Chart → Organization Data: loads account data (evidence: `smart-task-allocation/src/app/api/org-chart/route.js`)
- Marketing Content → Supabase: loads content
- Task Management → Supabase: reads and writes (evidence: `smart-task-allocation/src/app/api/tasks/route.js`)
- Employee Tasks → Supabase: reads tasks (evidence: `smart-task-allocation/src/app/api/employee-tasks/route.js`)
- Account Management → Supabase: reads and writes (evidence: `smart-task-allocation/src/app/api/accounts/route.js`)
- Employee Directory → Supabase: reads workforce data (evidence: `smart-task-allocation/src/app/api/employees/route.js`)
- Organization Data → Supabase: reads organization data (evidence: `smart-task-allocation/src/app/api/my-organization/route.js`)
- Organization Chart → Supabase: reads and updates (evidence: `smart-task-allocation/src/app/api/org-chart/route.js`)
- User Profile → Supabase: updates profile data (evidence: `smart-task-allocation/src/app/api/my-profile/route.js`)
- Task Attachments → Supabase: manages attachments (evidence: `smart-task-allocation/src/app/api/task-attachments/route.js`)
- Workspaces → Supabase: manages workspaces (evidence: `smart-task-allocation/src/app/api/workspaces/route.js`)
