# unai-tech/my_vidyon architecture

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

- Interactive diagram: https://gitdiagram.com/unai-tech/my_vidyon
- Repository: https://github.com/unai-tech/my_vidyon

## Overview

My_Vidyon is a multi-role school ERP mobile/web application. A user signs in, the app resolves their identity and role, and the entry screen routes them to role-specific workflows such as academics, admissions, fees, administration, and stakeholder reporting. The sampled sources show Supabase-backed auth, role permissions, and several dashboard integrations. The README provides no capability detail; domain coverage here is based on the route tree and SOURCE INDEX, so links between unsampled screens and services are omitted rather than inferred.

Main entry points: [`app/index.tsx`](https://github.com/unai-tech/my_vidyon/blob/main/app/index.tsx) (Role routing), [`src/lib/supabase.ts`](https://github.com/unai-tech/my_vidyon/blob/main/src/lib/supabase.ts) (Supabase client), [`src/hooks/useAuth.tsx`](https://github.com/unai-tech/my_vidyon/blob/main/src/hooks/useAuth.tsx) (Identity and session), [`src/context/RBACContext.tsx`](https://github.com/unai-tech/my_vidyon/blob/main/src/context/RBACContext.tsx) (Permission context)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and access"]
  node_login["Sign-in<br/>[login.tsx]"]
  node_auth["Identity and session<br/>[useAuth.tsx]"]
  node_entrypoint["Role routing<br/>[index.tsx]"]
end

subgraph group_platform["Shared platform"]
  node_rbac_context["Permission context<br/>[RBACContext.tsx]"]
  node_rbac_policy["Permission rules<br/>[rbac.ts]"]
  node_storage[("Secure session storage<br/>[storage.ts]")]
  node_supabase_client["Supabase client<br/>[supabase.ts]"]
  node_shared_ui["Shared interface components"]
  node_file_upload["File uploads<br/>[fileUpload.ts]"]
end

subgraph group_education["Academic workflows"]
  node_faculty["Faculty workflows"]
  node_student["Student learning"]
end

subgraph group_operations["Institution operations"]
  node_institution["Institution management"]
  node_admin["Platform administration"]
  node_finance["Finance and accounting"]
  node_management_modal["Stakeholder management"]
end

subgraph group_community["Community and services"]
  node_parent["Parent portal"]
  node_stakeholder["Stakeholder overview<br/>[index.tsx]"]
  node_canteen["Canteen operations<br/>[index.tsx]"]
  node_events_ads["Events and advertising"]
  node_stakeholder_dashboard["Stakeholder metrics"]
  node_canteen_dashboard["Canteen dashboard data"]
end

node_user(("ERP user"))
node_supabase_service[("Supabase backend")]

node_user -->|"signs in"| node_login
node_login -->|"uses session"| node_auth
node_login -.->|"renders"| node_shared_ui
node_auth -->|"authenticates"| node_supabase_client
node_auth -->|"reads tokens"| node_storage
node_entrypoint -->|"checks session"| node_auth
node_entrypoint -->|"loads data"| node_supabase_client
node_entrypoint -->|"routes by role"| node_institution
node_entrypoint -->|"routes by role"| node_stakeholder
node_entrypoint -->|"routes by role"| node_faculty
node_entrypoint -->|"routes by role"| node_student
node_entrypoint -->|"routes by role"| node_parent
node_entrypoint -->|"routes by role"| node_canteen
node_rbac_context -->|"reads identity"| node_auth
node_rbac_context -->|"fetches permissions"| node_supabase_client
node_rbac_context -->|"checks access"| node_rbac_policy
node_supabase_client -->|"persists sessions"| node_storage
node_supabase_client -->|"connects to"| node_supabase_service
node_stakeholder -->|"loads metrics"| node_stakeholder_dashboard
node_stakeholder_dashboard -->|"queries data"| node_supabase_client
node_stakeholder_dashboard -->|"checks role"| node_rbac_context
node_canteen -->|"loads dashboard"| node_canteen_dashboard
node_canteen_dashboard -->|"queries data"| node_supabase_client
node_events_ads -->|"loads events"| node_supabase_client
node_events_ads -->|"reads user"| node_auth
node_admin -->|"uploads media"| node_file_upload
node_admin -->|"uses management"| node_management_modal
node_management_modal -->|"manages records"| node_supabase_client
node_institution -->|"uploads files"| node_file_upload

click node_login "https://github.com/unai-tech/my_vidyon/blob/main/app/(auth)/login.tsx"
click node_auth "https://github.com/unai-tech/my_vidyon/blob/main/src/hooks/useAuth.tsx"
click node_entrypoint "https://github.com/unai-tech/my_vidyon/blob/main/app/index.tsx"
click node_rbac_context "https://github.com/unai-tech/my_vidyon/blob/main/src/context/RBACContext.tsx"
click node_rbac_policy "https://github.com/unai-tech/my_vidyon/blob/main/src/lib/rbac.ts"
click node_storage "https://github.com/unai-tech/my_vidyon/blob/main/src/lib/storage.ts"
click node_supabase_client "https://github.com/unai-tech/my_vidyon/blob/main/src/lib/supabase.ts"
click node_shared_ui "https://github.com/unai-tech/my_vidyon/tree/main/src/components/common"
click node_institution "https://github.com/unai-tech/my_vidyon/tree/main/app/(root)/institution"
click node_admin "https://github.com/unai-tech/my_vidyon/tree/main/app/(root)/admin"
click node_finance "https://github.com/unai-tech/my_vidyon/tree/main/app/(root)/accountant"
click node_faculty "https://github.com/unai-tech/my_vidyon/tree/main/app/(root)/faculty"
click node_student "https://github.com/unai-tech/my_vidyon/tree/main/app/(root)/student"
click node_parent "https://github.com/unai-tech/my_vidyon/tree/main/app/(root)/parent"
click node_stakeholder "https://github.com/unai-tech/my_vidyon/blob/main/app/(root)/stakeholder/index.tsx"
click node_canteen "https://github.com/unai-tech/my_vidyon/blob/main/app/(root)/canteen/index.tsx"
click node_events_ads "https://github.com/unai-tech/my_vidyon/blob/main/src/components/common/EventAdCarousel.tsx"
click node_stakeholder_dashboard "https://github.com/unai-tech/my_vidyon/blob/main/src/hooks/useStakeholderDashboard.ts"
click node_canteen_dashboard "https://github.com/unai-tech/my_vidyon/blob/main/src/hooks/useCanteenDashboard.ts"
click node_management_modal "https://github.com/unai-tech/my_vidyon/blob/main/src/components/stakeholder/StakeholderManagementModal.tsx"
click node_file_upload "https://github.com/unai-tech/my_vidyon/blob/main/src/utils/fileUpload.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_login,node_auth,node_entrypoint,node_user toneBlue
class node_rbac_context,node_rbac_policy,node_storage,node_supabase_client,node_shared_ui,node_file_upload,node_supabase_service toneAmber
class node_faculty,node_student toneMint
class node_institution,node_admin,node_finance,node_management_modal toneRose
class node_parent,node_stakeholder,node_canteen,node_events_ads,node_stakeholder_dashboard,node_canteen_dashboard toneIndigo
```

## Components

### Entry and access

- [Sign-in](https://github.com/unai-tech/my_vidyon/blob/main/app/(auth)/login.tsx): `app/(auth)/login.tsx`
- [Identity and session](https://github.com/unai-tech/my_vidyon/blob/main/src/hooks/useAuth.tsx): `src/hooks/useAuth.tsx`
- [Role routing](https://github.com/unai-tech/my_vidyon/blob/main/app/index.tsx): `app/index.tsx`

### Shared platform

- [Permission context](https://github.com/unai-tech/my_vidyon/blob/main/src/context/RBACContext.tsx): `src/context/RBACContext.tsx`
- [Permission rules](https://github.com/unai-tech/my_vidyon/blob/main/src/lib/rbac.ts): `src/lib/rbac.ts`
- [Secure session storage](https://github.com/unai-tech/my_vidyon/blob/main/src/lib/storage.ts): `src/lib/storage.ts`
- [Supabase client](https://github.com/unai-tech/my_vidyon/blob/main/src/lib/supabase.ts): `src/lib/supabase.ts`
- [Shared interface components](https://github.com/unai-tech/my_vidyon/tree/main/src/components/common): `src/components/common`
- [File uploads](https://github.com/unai-tech/my_vidyon/blob/main/src/utils/fileUpload.ts): `src/utils/fileUpload.ts`

### Academic workflows

- [Faculty workflows](https://github.com/unai-tech/my_vidyon/tree/main/app/(root)/faculty): `app/(root)/faculty`
- [Student learning](https://github.com/unai-tech/my_vidyon/tree/main/app/(root)/student): `app/(root)/student`

### Institution operations

- [Institution management](https://github.com/unai-tech/my_vidyon/tree/main/app/(root)/institution): `app/(root)/institution`
- [Platform administration](https://github.com/unai-tech/my_vidyon/tree/main/app/(root)/admin): `app/(root)/admin`
- [Finance and accounting](https://github.com/unai-tech/my_vidyon/tree/main/app/(root)/accountant): `app/(root)/accountant`
- [Stakeholder management](https://github.com/unai-tech/my_vidyon/blob/main/src/components/stakeholder/StakeholderManagementModal.tsx): `src/components/stakeholder/StakeholderManagementModal.tsx`

### Community and services

- [Parent portal](https://github.com/unai-tech/my_vidyon/tree/main/app/(root)/parent): `app/(root)/parent`
- [Stakeholder overview](https://github.com/unai-tech/my_vidyon/blob/main/app/(root)/stakeholder/index.tsx): `app/(root)/stakeholder/index.tsx`
- [Canteen operations](https://github.com/unai-tech/my_vidyon/blob/main/app/(root)/canteen/index.tsx): `app/(root)/canteen/index.tsx`
- [Events and advertising](https://github.com/unai-tech/my_vidyon/blob/main/src/components/common/EventAdCarousel.tsx): `src/components/common/EventAdCarousel.tsx`
- [Stakeholder metrics](https://github.com/unai-tech/my_vidyon/blob/main/src/hooks/useStakeholderDashboard.ts): `src/hooks/useStakeholderDashboard.ts`
- [Canteen dashboard data](https://github.com/unai-tech/my_vidyon/blob/main/src/hooks/useCanteenDashboard.ts): `src/hooks/useCanteenDashboard.ts`

### Other components

- **ERP user**
- **Supabase backend**

## Connections

- ERP user → Sign-in: signs in (evidence: `app/(auth)/login.tsx`)
- Sign-in → Identity and session: uses session (evidence: `app/(auth)/login.tsx`)
- Sign-in → Shared interface components: renders
- Identity and session → Supabase client: authenticates (evidence: `src/hooks/useAuth.tsx`)
- Identity and session → Secure session storage: reads tokens (evidence: `src/hooks/useAuth.tsx`)
- Role routing → Identity and session: checks session (evidence: `app/index.tsx`)
- Role routing → Supabase client: loads data (evidence: `app/index.tsx`)
- Role routing → Institution management: routes by role (evidence: `app/index.tsx`)
- Role routing → Stakeholder overview: routes by role (evidence: `app/index.tsx`)
- Role routing → Faculty workflows: routes by role (evidence: `app/index.tsx`)
- Role routing → Student learning: routes by role (evidence: `app/index.tsx`)
- Role routing → Parent portal: routes by role (evidence: `app/index.tsx`)
- Role routing → Canteen operations: routes by role (evidence: `app/index.tsx`)
- Permission context → Identity and session: reads identity (evidence: `src/context/RBACContext.tsx`)
- Permission context → Supabase client: fetches permissions (evidence: `src/context/RBACContext.tsx`)
- Permission context → Permission rules: checks access (evidence: `src/context/RBACContext.tsx`)
- Supabase client → Secure session storage: persists sessions (evidence: `src/lib/supabase.ts`)
- Supabase client → Supabase backend: connects to (evidence: `src/lib/supabase.ts`)
- Stakeholder overview → Stakeholder metrics: loads metrics (evidence: `src/hooks/useStakeholderDashboard.ts`)
- Stakeholder metrics → Supabase client: queries data (evidence: `src/hooks/useStakeholderDashboard.ts`)
- Stakeholder metrics → Permission context: checks role (evidence: `src/hooks/useStakeholderDashboard.ts`)
- Canteen operations → Canteen dashboard data: loads dashboard (evidence: `app/(root)/canteen/index.tsx`)
- Canteen dashboard data → Supabase client: queries data (evidence: `src/hooks/useCanteenDashboard.ts`)
- Events and advertising → Supabase client: loads events (evidence: `src/components/common/EventAdCarousel.tsx`)
- Events and advertising → Identity and session: reads user (evidence: `src/components/common/EventAdCarousel.tsx`)
- Platform administration → File uploads: uploads media (evidence: `app/(root)/admin/ads/index.tsx`)
- Platform administration → Stakeholder management: uses management (evidence: `app/(root)/admin/onboarding/index.tsx`)
- Stakeholder management → Supabase client: manages records (evidence: `src/components/stakeholder/StakeholderManagementModal.tsx`)
- Institution management → File uploads: uploads files
