# 23-75125-pixel/ecolearn architecture

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

- Interactive diagram: https://gitdiagram.com/23-75125-pixel/ecolearn
- Repository: https://github.com/23-75125-pixel/ecolearn

## Overview

ECoLearn is a web platform for tutor vetting and student appointments. Students browse approved tutors and book available appointment slots; tutors submit applications, manage their profiles and availability; administrators review applications. Dashboards and notifications support these workflows. Supabase provides authentication and data access, with booking and cancellation enforced through database functions and row-level security. The map uses the README and source-index references; unsampled action and query implementations are represented only where their callers or documented behavior establish the relationship.

Main entry points: [`lib/supabase/server.ts`](https://github.com/23-75125-pixel/ecolearn/blob/main/lib/supabase/server.ts) (Supabase server client), [`app/tutor/dashboard/page.tsx`](https://github.com/23-75125-pixel/ecolearn/blob/main/app/tutor/dashboard/page.tsx) (Tutor dashboard), [`components/notifications/notification-list.tsx`](https://github.com/23-75125-pixel/ecolearn/blob/main/components/notifications/notification-list.tsx) (Notifications), [`app/tutor/actions.ts`](https://github.com/23-75125-pixel/ecolearn/blob/main/app/tutor/actions.ts) (Tutor actions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Identity"]
  node_auth_ui["Sign-in and signup<br/>[page.tsx]"]
  node_auth_actions["Auth actions<br/>[actions.ts]"]
  node_auth_callback["Auth callback<br/>[route.ts]"]
  node_profile_guard["Session and role guard<br/>[session.ts]"]
end

subgraph group_tutoring["Tutor lifecycle"]
  node_tutor_apply["Tutor application"]
  node_admin_review["Application review<br/>[page.tsx]"]
  node_review_actions["Review decisions<br/>[review-actions.tsx]"]
  node_tutor_profile["Tutor profile editing<br/>[profile-editor.tsx]"]
  node_tutor_availability["Availability management"]
  node_tutor_actions["Tutor actions<br/>[actions.ts]"]
end

subgraph group_appointments["Appointments"]
  node_tutor_directory["Tutor directory"]
  node_tutor_detail["Tutor details<br/>[page.tsx]"]
  node_booking["Slot booking<br/>[booking-form.tsx]"]
end

subgraph group_operations["Role dashboards"]
  node_student_dashboard["Student dashboard<br/>[page.tsx]"]
  node_tutor_dashboard["Tutor dashboard<br/>[page.tsx]"]
  node_admin_dashboard["Admin dashboard<br/>[page.tsx]"]
  node_notifications["Notifications"]
end

subgraph group_platform["Shared services"]
  node_supabase_client["Supabase server client<br/>[server.ts]"]
  node_database[("Supabase database and auth")]
  node_schema_types["Database types<br/>[database.types.ts]"]
end

node_visitor(("Visitor / user"))

node_visitor -->|"signs in"| node_auth_ui
node_auth_ui -->|"submits credentials"| node_auth_actions
node_auth_actions -.->|"uses client"| node_supabase_client
node_auth_callback -->|"uses client"| node_supabase_client
node_profile_guard -->|"creates client"| node_supabase_client
node_supabase_client -->|"reads and writes"| node_database
node_tutor_apply -.->|"submits application"| node_tutor_actions
node_review_actions -->|"renders in review"| node_admin_review
node_review_actions -.->|"requests decisions"| node_database
node_tutor_availability -->|"manages slots"| node_tutor_actions
node_tutor_profile -.->|"updates profile"| node_tutor_actions
node_tutor_dashboard -->|"renders form"| node_tutor_apply
node_tutor_dashboard -->|"renders manager"| node_tutor_availability
node_tutor_dashboard -->|"renders editor"| node_tutor_profile
node_tutor_directory -.->|"links tutor"| node_tutor_detail
node_tutor_detail -->|"renders booking"| node_booking
node_booking -->|"books slot"| node_database
node_student_dashboard -.->|"reads appointments"| node_database
node_student_dashboard -->|"renders list"| node_notifications
node_tutor_dashboard -->|"renders list"| node_notifications
node_admin_dashboard -.->|"reads review data"| node_database
node_notifications -.->|"marks read"| node_database
node_supabase_client -->|"types client"| node_schema_types

click node_auth_ui "https://github.com/23-75125-pixel/ecolearn/blob/main/app/(auth)/login/page.tsx"
click node_auth_actions "https://github.com/23-75125-pixel/ecolearn/blob/main/app/(auth)/actions.ts"
click node_auth_callback "https://github.com/23-75125-pixel/ecolearn/blob/main/app/(auth)/callback/route.ts"
click node_profile_guard "https://github.com/23-75125-pixel/ecolearn/blob/main/lib/auth/session.ts"
click node_tutor_apply "https://github.com/23-75125-pixel/ecolearn/blob/main/components/tutor/application-form.tsx"
click node_admin_review "https://github.com/23-75125-pixel/ecolearn/blob/main/app/admin/applications/%5Bid%5D/page.tsx"
click node_review_actions "https://github.com/23-75125-pixel/ecolearn/blob/main/components/admin/review-actions.tsx"
click node_tutor_profile "https://github.com/23-75125-pixel/ecolearn/blob/main/components/tutor/profile-editor.tsx"
click node_tutor_availability "https://github.com/23-75125-pixel/ecolearn/blob/main/components/tutor/availability-manager.tsx"
click node_tutor_actions "https://github.com/23-75125-pixel/ecolearn/blob/main/app/tutor/actions.ts"
click node_tutor_directory "https://github.com/23-75125-pixel/ecolearn/blob/main/components/tutors/tutor-directory.tsx"
click node_tutor_detail "https://github.com/23-75125-pixel/ecolearn/blob/main/app/(public)/tutors/%5BtutorId%5D/page.tsx"
click node_booking "https://github.com/23-75125-pixel/ecolearn/blob/main/components/student/booking-form.tsx"
click node_student_dashboard "https://github.com/23-75125-pixel/ecolearn/blob/main/app/student/dashboard/page.tsx"
click node_tutor_dashboard "https://github.com/23-75125-pixel/ecolearn/blob/main/app/tutor/dashboard/page.tsx"
click node_admin_dashboard "https://github.com/23-75125-pixel/ecolearn/blob/main/app/admin/dashboard/page.tsx"
click node_notifications "https://github.com/23-75125-pixel/ecolearn/blob/main/components/notifications/notification-list.tsx"
click node_supabase_client "https://github.com/23-75125-pixel/ecolearn/blob/main/lib/supabase/server.ts"
click node_schema_types "https://github.com/23-75125-pixel/ecolearn/blob/main/types/database.types.ts"

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_auth_ui,node_auth_actions,node_auth_callback,node_profile_guard,node_visitor toneBlue
class node_tutor_apply,node_admin_review,node_review_actions,node_tutor_profile,node_tutor_availability,node_tutor_actions toneAmber
class node_tutor_directory,node_tutor_detail,node_booking toneMint
class node_student_dashboard,node_tutor_dashboard,node_admin_dashboard,node_notifications toneRose
class node_supabase_client,node_database,node_schema_types toneIndigo
```

## Components

### Identity

- [Sign-in and signup](https://github.com/23-75125-pixel/ecolearn/blob/main/app/(auth)/login/page.tsx): `app/(auth)/login/page.tsx`
- [Auth actions](https://github.com/23-75125-pixel/ecolearn/blob/main/app/(auth)/actions.ts): `app/(auth)/actions.ts`
- [Auth callback](https://github.com/23-75125-pixel/ecolearn/blob/main/app/(auth)/callback/route.ts): `app/(auth)/callback/route.ts`
- [Session and role guard](https://github.com/23-75125-pixel/ecolearn/blob/main/lib/auth/session.ts): `lib/auth/session.ts`

### Tutor lifecycle

- [Tutor application](https://github.com/23-75125-pixel/ecolearn/blob/main/components/tutor/application-form.tsx): `components/tutor/application-form.tsx`
- [Application review](https://github.com/23-75125-pixel/ecolearn/blob/main/app/admin/applications/%5Bid%5D/page.tsx): `app/admin/applications/[id]/page.tsx`
- [Review decisions](https://github.com/23-75125-pixel/ecolearn/blob/main/components/admin/review-actions.tsx): `components/admin/review-actions.tsx`
- [Tutor profile editing](https://github.com/23-75125-pixel/ecolearn/blob/main/components/tutor/profile-editor.tsx): `components/tutor/profile-editor.tsx`
- [Availability management](https://github.com/23-75125-pixel/ecolearn/blob/main/components/tutor/availability-manager.tsx): `components/tutor/availability-manager.tsx`
- [Tutor actions](https://github.com/23-75125-pixel/ecolearn/blob/main/app/tutor/actions.ts): `app/tutor/actions.ts`

### Appointments

- [Tutor directory](https://github.com/23-75125-pixel/ecolearn/blob/main/components/tutors/tutor-directory.tsx): `components/tutors/tutor-directory.tsx`
- [Tutor details](https://github.com/23-75125-pixel/ecolearn/blob/main/app/(public)/tutors/%5BtutorId%5D/page.tsx): `app/(public)/tutors/[tutorId]/page.tsx`
- [Slot booking](https://github.com/23-75125-pixel/ecolearn/blob/main/components/student/booking-form.tsx): `components/student/booking-form.tsx`

### Role dashboards

- [Student dashboard](https://github.com/23-75125-pixel/ecolearn/blob/main/app/student/dashboard/page.tsx): `app/student/dashboard/page.tsx`
- [Tutor dashboard](https://github.com/23-75125-pixel/ecolearn/blob/main/app/tutor/dashboard/page.tsx): `app/tutor/dashboard/page.tsx`
- [Admin dashboard](https://github.com/23-75125-pixel/ecolearn/blob/main/app/admin/dashboard/page.tsx): `app/admin/dashboard/page.tsx`
- [Notifications](https://github.com/23-75125-pixel/ecolearn/blob/main/components/notifications/notification-list.tsx): `components/notifications/notification-list.tsx`

### Shared services

- [Supabase server client](https://github.com/23-75125-pixel/ecolearn/blob/main/lib/supabase/server.ts): `lib/supabase/server.ts`
- **Supabase database and auth**
- [Database types](https://github.com/23-75125-pixel/ecolearn/blob/main/types/database.types.ts): `types/database.types.ts`

### Other components

- **Visitor / user**

## Connections

- Visitor / user → Sign-in and signup: signs in (evidence: `README.md`)
- Sign-in and signup → Auth actions: submits credentials (evidence: `app/(auth)/login/page.tsx`)
- Auth actions → Supabase server client: uses client
- Auth callback → Supabase server client: uses client (evidence: `app/(auth)/callback/route.ts`)
- Session and role guard → Supabase server client: creates client (evidence: `lib/auth/session.ts`)
- Supabase server client → Supabase database and auth: reads and writes (evidence: `lib/supabase/server.ts`)
- Tutor application → Tutor actions: submits application
- Review decisions → Application review: renders in review (evidence: `app/admin/applications/[id]/page.tsx`)
- Review decisions → Supabase database and auth: requests decisions
- Availability management → Tutor actions: manages slots (evidence: `components/tutor/availability-manager.tsx`)
- Tutor profile editing → Tutor actions: updates profile
- Tutor dashboard → Tutor application: renders form (evidence: `app/tutor/dashboard/page.tsx`)
- Tutor dashboard → Availability management: renders manager (evidence: `app/tutor/dashboard/page.tsx`)
- Tutor dashboard → Tutor profile editing: renders editor (evidence: `app/tutor/dashboard/page.tsx`)
- Tutor directory → Tutor details: links tutor
- Tutor details → Slot booking: renders booking (evidence: `app/(public)/tutors/[tutorId]/page.tsx`)
- Slot booking → Supabase database and auth: books slot (evidence: `README.md`)
- Student dashboard → Supabase database and auth: reads appointments
- Student dashboard → Notifications: renders list (evidence: `app/student/dashboard/page.tsx`)
- Tutor dashboard → Notifications: renders list (evidence: `app/tutor/dashboard/page.tsx`)
- Admin dashboard → Supabase database and auth: reads review data
- Notifications → Supabase database and auth: marks read
- Supabase server client → Database types: types client (evidence: `lib/supabase/server.ts`)
