# twety24/aghapy architecture

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

- Interactive diagram: https://gitdiagram.com/twety24/aghapy
- Repository: https://github.com/twety24/aghapy

## Overview

Aghapy is a community-management web app with member-facing and administrator workflows. Members authenticate, use a dashboard to reach attendance scanning, messages, photos, meeting information, chats, profiles and suggestions; administrators manage members, groups, attendance, meetings, messages, photos, reports and settings. Supabase provides application data and authentication. The tree and excerpts establish several runtime connections, but many feature pages and admin routes were not sampled, so their internal calls are not inferred.

Main entry points: [`app/dashboard/page.jsx`](https://github.com/twety24/aghapy/blob/main/app/dashboard/page.jsx) (Member dashboard), [`lib/supabase/server.js`](https://github.com/twety24/aghapy/blob/main/lib/supabase/server.js) (Server Supabase client), [`app/api/attendance/checkin/route.js`](https://github.com/twety24/aghapy/blob/main/app/api/attendance/checkin/route.js) (Attendance API), [`lib/supabase/admin.js`](https://github.com/twety24/aghapy/blob/main/lib/supabase/admin.js) (Privileged Supabase client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Identity and access"]
  node_login["Sign in<br/>[page.jsx]"]
  node_register["Registration<br/>[page.jsx]"]
  node_auth_callback["Auth callback<br/>[route.js]"]
  node_access_guard["Admin authorization<br/>[guard.js]"]
end

subgraph group_member["Member experience"]
  node_dashboard["Member dashboard<br/>[page.jsx]"]
  node_attendance["QR attendance<br/>[page.jsx]"]
  node_attendance_api["Attendance API<br/>[route.js]"]
  node_messages["Messages<br/>[page.jsx]"]
  node_message_list["Message list<br/>[MessageList.jsx]"]
  node_chats["Group chats<br/>[page.jsx]"]
  node_photos["Photo gallery<br/>[page.jsx]"]
  node_meeting["Meeting information<br/>[page.jsx]"]
  node_suggestions["Suggestions<br/>[page.jsx]"]
  node_suggestions_api["Suggestion submission<br/>[route.js]"]
  node_profile["Member profile<br/>[page.jsx]"]
end

subgraph group_admin["Administration"]
  node_admin_console["Admin console<br/>[page.jsx]"]
  node_admin_members["Member management<br/>[page.jsx]"]
  node_admin_groups["Group management<br/>[page.jsx]"]
  node_admin_attendance["Attendance administration<br/>[page.jsx]"]
  node_admin_meeting["Meeting editor<br/>[page.jsx]"]
  node_admin_messages["Admin messaging<br/>[page.jsx]"]
  node_admin_photos["Photo administration<br/>[page.jsx]"]
  node_admin_reports["Reports<br/>[page.jsx]"]
  node_admin_suggestions["Suggestion review<br/>[page.jsx]"]
  node_admin_settings["Admin settings<br/>[page.jsx]"]
  node_admin_api["Admin API routes"]
end

subgraph group_services["Shared services"]
  node_attendance_rules["Attendance tokens<br/>[attendance.js]"]
  node_server_client["Server Supabase client<br/>[server.js]"]
  node_browser_client["Browser Supabase client<br/>[client.js]"]
  node_admin_client["Privileged Supabase client<br/>[admin.js]"]
  node_language["Language provider<br/>[LangProvider.jsx]"]
end

node_member_actor(("Member"))
node_admin_actor(("Administrator"))
node_database[("Supabase")]

node_member_actor -->|"signs in"| node_login
node_member_actor -->|"registers"| node_register
node_login -->|"authenticates with"| node_browser_client
node_register -->|"creates account with"| node_browser_client
node_auth_callback -->|"exchanges auth code"| node_server_client
node_member_actor -->|"opens"| node_dashboard
node_dashboard -->|"loads account data"| node_server_client
node_dashboard -->|"gets translations"| node_language
node_dashboard -->|"links to"| node_messages
node_dashboard -->|"links to"| node_photos
node_dashboard -->|"links to"| node_meeting
node_dashboard -->|"links to"| node_suggestions
node_dashboard -->|"links to"| node_chats
node_dashboard -->|"links to"| node_attendance
node_messages -->|"loads messages"| node_server_client
node_messages -->|"renders"| node_message_list
node_meeting -->|"loads meeting data"| node_server_client
node_suggestions -.->|"submits suggestion"| node_suggestions_api
node_suggestions_api -->|"checks user session"| node_server_client
node_suggestions_api -->|"validates recipients and saves"| node_admin_client
node_attendance -.->|"checks in"| node_attendance_api
node_attendance_api -->|"checks user session"| node_server_client
node_attendance_api -->|"records attendance"| node_admin_client
node_attendance_api -->|"verifies token"| node_attendance_rules
node_admin_actor -->|"opens"| node_admin_console
node_admin_console -->|"loads admin page data"| node_server_client
node_admin_actor -->|"manages members"| node_admin_members
node_admin_actor -->|"manages groups"| node_admin_groups
node_admin_actor -->|"manages attendance"| node_admin_attendance
node_admin_actor -->|"edits meetings"| node_admin_meeting
node_admin_actor -->|"manages messages"| node_admin_messages
node_admin_actor -->|"manages photos"| node_admin_photos
node_admin_actor -->|"reviews reports"| node_admin_reports
node_admin_actor -->|"reviews suggestions"| node_admin_suggestions
node_admin_actor -->|"changes settings"| node_admin_settings
node_admin_api -.->|"authorizes requests"| node_access_guard
node_access_guard -->|"checks admin session"| node_server_client
node_admin_api -.->|"uses privileged access"| node_admin_client
node_server_client -.->|"reads and writes"| node_database
node_browser_client -.->|"reads and writes"| node_database
node_admin_client -.->|"privileged data access"| node_database

click node_login "https://github.com/twety24/aghapy/blob/main/app/login/page.jsx"
click node_register "https://github.com/twety24/aghapy/blob/main/app/register/page.jsx"
click node_auth_callback "https://github.com/twety24/aghapy/blob/main/app/auth/callback/route.js"
click node_access_guard "https://github.com/twety24/aghapy/blob/main/lib/guard.js"
click node_dashboard "https://github.com/twety24/aghapy/blob/main/app/dashboard/page.jsx"
click node_attendance "https://github.com/twety24/aghapy/blob/main/app/scan/page.jsx"
click node_attendance_api "https://github.com/twety24/aghapy/blob/main/app/api/attendance/checkin/route.js"
click node_attendance_rules "https://github.com/twety24/aghapy/blob/main/lib/attendance.js"
click node_messages "https://github.com/twety24/aghapy/blob/main/app/messages/page.jsx"
click node_message_list "https://github.com/twety24/aghapy/blob/main/components/MessageList.jsx"
click node_chats "https://github.com/twety24/aghapy/blob/main/app/chats/page.jsx"
click node_photos "https://github.com/twety24/aghapy/blob/main/app/photos/page.jsx"
click node_meeting "https://github.com/twety24/aghapy/blob/main/app/meeting/page.jsx"
click node_suggestions "https://github.com/twety24/aghapy/blob/main/app/suggestions/page.jsx"
click node_suggestions_api "https://github.com/twety24/aghapy/blob/main/app/api/suggestions/route.js"
click node_profile "https://github.com/twety24/aghapy/blob/main/app/profile/page.jsx"
click node_admin_console "https://github.com/twety24/aghapy/blob/main/app/admin/page.jsx"
click node_admin_members "https://github.com/twety24/aghapy/blob/main/app/admin/members/page.jsx"
click node_admin_groups "https://github.com/twety24/aghapy/blob/main/app/admin/groups/page.jsx"
click node_admin_attendance "https://github.com/twety24/aghapy/blob/main/app/admin/attendance/page.jsx"
click node_admin_meeting "https://github.com/twety24/aghapy/blob/main/app/admin/meeting/page.jsx"
click node_admin_messages "https://github.com/twety24/aghapy/blob/main/app/admin/messages/page.jsx"
click node_admin_photos "https://github.com/twety24/aghapy/blob/main/app/admin/photos/page.jsx"
click node_admin_reports "https://github.com/twety24/aghapy/blob/main/app/admin/reports/page.jsx"
click node_admin_suggestions "https://github.com/twety24/aghapy/blob/main/app/admin/suggestions/page.jsx"
click node_admin_settings "https://github.com/twety24/aghapy/blob/main/app/admin/settings/page.jsx"
click node_admin_api "https://github.com/twety24/aghapy/tree/main/app/api/admin"
click node_server_client "https://github.com/twety24/aghapy/blob/main/lib/supabase/server.js"
click node_browser_client "https://github.com/twety24/aghapy/blob/main/lib/supabase/client.js"
click node_admin_client "https://github.com/twety24/aghapy/blob/main/lib/supabase/admin.js"
click node_language "https://github.com/twety24/aghapy/blob/main/components/LangProvider.jsx"

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_callback,node_access_guard toneBlue
class node_dashboard,node_attendance,node_attendance_api,node_messages,node_message_list,node_chats,node_photos,node_meeting,node_suggestions,node_suggestions_api,node_profile,node_database toneAmber
class node_admin_console,node_admin_members,node_admin_groups,node_admin_attendance,node_admin_meeting,node_admin_messages,node_admin_photos,node_admin_reports,node_admin_suggestions,node_admin_settings,node_admin_api toneMint
class node_attendance_rules,node_server_client,node_browser_client,node_admin_client,node_language toneRose
class node_member_actor,node_admin_actor toneIndigo
```

## Components

### Identity and access

- [Sign in](https://github.com/twety24/aghapy/blob/main/app/login/page.jsx): `app/login/page.jsx`
- [Registration](https://github.com/twety24/aghapy/blob/main/app/register/page.jsx): `app/register/page.jsx`
- [Auth callback](https://github.com/twety24/aghapy/blob/main/app/auth/callback/route.js): `app/auth/callback/route.js`
- [Admin authorization](https://github.com/twety24/aghapy/blob/main/lib/guard.js): `lib/guard.js`

### Member experience

- [Member dashboard](https://github.com/twety24/aghapy/blob/main/app/dashboard/page.jsx): `app/dashboard/page.jsx`
- [QR attendance](https://github.com/twety24/aghapy/blob/main/app/scan/page.jsx): `app/scan/page.jsx`
- [Attendance API](https://github.com/twety24/aghapy/blob/main/app/api/attendance/checkin/route.js): `app/api/attendance/checkin/route.js`
- [Messages](https://github.com/twety24/aghapy/blob/main/app/messages/page.jsx): `app/messages/page.jsx`
- [Message list](https://github.com/twety24/aghapy/blob/main/components/MessageList.jsx): `components/MessageList.jsx`
- [Group chats](https://github.com/twety24/aghapy/blob/main/app/chats/page.jsx): `app/chats/page.jsx`
- [Photo gallery](https://github.com/twety24/aghapy/blob/main/app/photos/page.jsx): `app/photos/page.jsx`
- [Meeting information](https://github.com/twety24/aghapy/blob/main/app/meeting/page.jsx): `app/meeting/page.jsx`
- [Suggestions](https://github.com/twety24/aghapy/blob/main/app/suggestions/page.jsx): `app/suggestions/page.jsx`
- [Suggestion submission](https://github.com/twety24/aghapy/blob/main/app/api/suggestions/route.js): `app/api/suggestions/route.js`
- [Member profile](https://github.com/twety24/aghapy/blob/main/app/profile/page.jsx): `app/profile/page.jsx`

### Administration

- [Admin console](https://github.com/twety24/aghapy/blob/main/app/admin/page.jsx): `app/admin/page.jsx`
- [Member management](https://github.com/twety24/aghapy/blob/main/app/admin/members/page.jsx): `app/admin/members/page.jsx`
- [Group management](https://github.com/twety24/aghapy/blob/main/app/admin/groups/page.jsx): `app/admin/groups/page.jsx`
- [Attendance administration](https://github.com/twety24/aghapy/blob/main/app/admin/attendance/page.jsx): `app/admin/attendance/page.jsx`
- [Meeting editor](https://github.com/twety24/aghapy/blob/main/app/admin/meeting/page.jsx): `app/admin/meeting/page.jsx`
- [Admin messaging](https://github.com/twety24/aghapy/blob/main/app/admin/messages/page.jsx): `app/admin/messages/page.jsx`
- [Photo administration](https://github.com/twety24/aghapy/blob/main/app/admin/photos/page.jsx): `app/admin/photos/page.jsx`
- [Reports](https://github.com/twety24/aghapy/blob/main/app/admin/reports/page.jsx): `app/admin/reports/page.jsx`
- [Suggestion review](https://github.com/twety24/aghapy/blob/main/app/admin/suggestions/page.jsx): `app/admin/suggestions/page.jsx`
- [Admin settings](https://github.com/twety24/aghapy/blob/main/app/admin/settings/page.jsx): `app/admin/settings/page.jsx`
- [Admin API routes](https://github.com/twety24/aghapy/tree/main/app/api/admin): `app/api/admin`

### Shared services

- [Attendance tokens](https://github.com/twety24/aghapy/blob/main/lib/attendance.js): `lib/attendance.js`
- [Server Supabase client](https://github.com/twety24/aghapy/blob/main/lib/supabase/server.js): `lib/supabase/server.js`
- [Browser Supabase client](https://github.com/twety24/aghapy/blob/main/lib/supabase/client.js): `lib/supabase/client.js`
- [Privileged Supabase client](https://github.com/twety24/aghapy/blob/main/lib/supabase/admin.js): `lib/supabase/admin.js`
- [Language provider](https://github.com/twety24/aghapy/blob/main/components/LangProvider.jsx): `components/LangProvider.jsx`

### Other components

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

## Connections

- Member → Sign in: signs in
- Member → Registration: registers
- Sign in → Browser Supabase client: authenticates with (evidence: `app/login/page.jsx`)
- Registration → Browser Supabase client: creates account with (evidence: `app/register/page.jsx`)
- Auth callback → Server Supabase client: exchanges auth code (evidence: `app/auth/callback/route.js`)
- Member → Member dashboard: opens
- Member dashboard → Server Supabase client: loads account data (evidence: `app/dashboard/page.jsx`)
- Member dashboard → Language provider: gets translations (evidence: `app/dashboard/page.jsx`)
- Member dashboard → Messages: links to (evidence: `app/dashboard/page.jsx`)
- Member dashboard → Photo gallery: links to (evidence: `app/dashboard/page.jsx`)
- Member dashboard → Meeting information: links to (evidence: `app/dashboard/page.jsx`)
- Member dashboard → Suggestions: links to (evidence: `app/dashboard/page.jsx`)
- Member dashboard → Group chats: links to (evidence: `app/dashboard/page.jsx`)
- Member dashboard → QR attendance: links to (evidence: `app/dashboard/page.jsx`)
- Messages → Server Supabase client: loads messages (evidence: `app/messages/page.jsx`)
- Messages → Message list: renders (evidence: `app/messages/page.jsx`)
- Meeting information → Server Supabase client: loads meeting data (evidence: `app/meeting/page.jsx`)
- Suggestions → Suggestion submission: submits suggestion
- Suggestion submission → Server Supabase client: checks user session (evidence: `app/api/suggestions/route.js`)
- Suggestion submission → Privileged Supabase client: validates recipients and saves (evidence: `app/api/suggestions/route.js`)
- QR attendance → Attendance API: checks in
- Attendance API → Server Supabase client: checks user session (evidence: `app/api/attendance/checkin/route.js`)
- Attendance API → Privileged Supabase client: records attendance (evidence: `app/api/attendance/checkin/route.js`)
- Attendance API → Attendance tokens: verifies token (evidence: `app/api/attendance/checkin/route.js`)
- Administrator → Admin console: opens
- Admin console → Server Supabase client: loads admin page data (evidence: `app/admin/page.jsx`)
- Administrator → Member management: manages members
- Administrator → Group management: manages groups
- Administrator → Attendance administration: manages attendance
- Administrator → Meeting editor: edits meetings
- Administrator → Admin messaging: manages messages
- Administrator → Photo administration: manages photos
- Administrator → Reports: reviews reports
- Administrator → Suggestion review: reviews suggestions
- Administrator → Admin settings: changes settings
- Admin API routes → Admin authorization: authorizes requests (evidence: `app/api/admin/storage-cleanup/route.js`)
- Admin authorization → Server Supabase client: checks admin session (evidence: `lib/guard.js`)
- Admin API routes → Privileged Supabase client: uses privileged access (evidence: `app/api/admin/storage-cleanup/route.js`)
- Server Supabase client → Supabase: reads and writes
- Browser Supabase client → Supabase: reads and writes
- Privileged Supabase client → Supabase: privileged data access
