# thabetaltartoori/brainy-bunch architecture

> Architecture diagram of the GitHub repository thabetaltartoori/brainy-bunch, 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/thabetaltartoori/brainy-bunch
- Repository: https://github.com/thabetaltartoori/brainy-bunch

## Overview

Brainy Bunch is a bilingual school-management application centered on staff recording student notes and monthly payments, while parents sign in to view only their own children’s information. The React client calls a Node/Express API; server-side role checks scope access before domain routes use the selected in-memory or Supabase store. The README also documents test results, staff management, announcements, fee summaries, and Arabic/English RTL support. Several route and storage relationships are supported by the SOURCE INDEX rather than full excerpts; unshown wiring is left out.

Main entry points: [`client/src/App.jsx`](https://github.com/thabetaltartoori/brainy-bunch/blob/master/client/src/App.jsx) (App routing), [`server/src/index.js`](https://github.com/thabetaltartoori/brainy-bunch/blob/master/server/src/index.js) (Express application), [`client/src/api.js`](https://github.com/thabetaltartoori/brainy-bunch/blob/master/client/src/api.js) (API client), [`server/src/access.js`](https://github.com/thabetaltartoori/brainy-bunch/blob/master/server/src/access.js) (Role access and scoping)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client experience"]
  node_app["App routing<br/>[App.jsx]"]
  node_login["Sign in<br/>[Login.jsx]"]
  node_students_ui["Student records<br/>[Students.jsx]"]
  node_profile_ui["Student profile<br/>[StudentProfile.jsx]"]
  node_payments_ui["Payments<br/>[Payments.jsx]"]
  node_notes_ui["Notes<br/>[Notes.jsx]"]
  node_staff_ui["Staff accounts<br/>[Staff.jsx]"]
  node_announcements_ui["Announcements<br/>[Announcements.jsx]"]
  node_dashboard_ui["Dashboard<br/>[Dashboard.jsx]"]
  node_client_api["API client<br/>[api.js]"]
  node_localization["Language and formatting<br/>[i18n.jsx]"]
  node_shell["Navigation and banner<br/>[Shell.jsx]"]
end

subgraph group_server["API and domain"]
  node_server_entry["Express application<br/>[index.js]"]
  node_auth_routes["Authentication routes<br/>[auth.js]"]
  node_student_routes["Student routes<br/>[students.js]"]
  node_notes_routes["Notes routes<br/>[notes.js]"]
  node_payment_routes["Payment routes<br/>[payments.js]"]
  node_assessment_routes["Assessment routes<br/>[assessments.js]"]
  node_user_routes["User routes<br/>[users.js]"]
  node_meta_routes["Meta and fee data<br/>[meta.js]"]
  node_access["Role access and scoping<br/>[access.js]"]
  node_auth_core["Password and sessions<br/>[auth.js]"]
  node_fees["Fee summaries<br/>[fees.js]"]
  node_http_helpers["HTTP validation<br/>[http.js]"]
end

subgraph group_storage["Persistence"]
  node_memory_store[("Demo store<br/>[memory.js]")]
  node_supabase_store[("Supabase store<br/>[supabase.js]")]
  node_seed_data["Demo seed data<br/>[seed.js]"]
end

subgraph group_runtime["Runtime adapters"]
  node_worker["Cloudflare adapter<br/>[index.js]"]
  node_netlify["Netlify function adapter<br/>[api.mjs]"]
end

node_school_users(("School users"))

node_school_users -->|"use"| node_app
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_dashboard_ui
node_app -->|"routes to"| node_students_ui
node_app -->|"routes to"| node_profile_ui
node_app -->|"routes to"| node_payments_ui
node_app -->|"routes to"| node_notes_ui
node_app -->|"routes to"| node_staff_ui
node_app -->|"routes to"| node_announcements_ui
node_login -->|"calls"| node_client_api
node_students_ui -->|"calls"| node_client_api
node_profile_ui -->|"calls"| node_client_api
node_payments_ui -->|"calls"| node_client_api
node_notes_ui -->|"calls"| node_client_api
node_staff_ui -->|"calls"| node_client_api
node_announcements_ui -->|"calls"| node_client_api
node_app -->|"provides"| node_localization
node_app -->|"uses"| node_shell
node_client_api -.->|"requests API"| node_server_entry
node_server_entry -->|"registers"| node_auth_routes
node_server_entry -->|"registers"| node_student_routes
node_server_entry -->|"registers"| node_notes_routes
node_server_entry -->|"registers"| node_payment_routes
node_server_entry -->|"registers"| node_assessment_routes
node_server_entry -->|"registers"| node_user_routes
node_server_entry -->|"registers"| node_meta_routes
node_server_entry -->|"selects store"| node_memory_store
node_server_entry -->|"selects store"| node_supabase_store
node_server_entry -->|"parses sessions"| node_auth_core
node_auth_routes -->|"uses"| node_auth_core
node_auth_routes -->|"checks access"| node_access
node_student_routes -->|"scopes records"| node_access
node_student_routes -->|"summarizes fees"| node_fees
node_notes_routes -->|"checks access"| node_access
node_payment_routes -->|"checks access"| node_access
node_assessment_routes -->|"checks access"| node_access
node_user_routes -->|"checks access"| node_access
node_user_routes -->|"uses"| node_auth_core
node_meta_routes -->|"checks access"| node_access
node_meta_routes -->|"uses"| node_fees
node_auth_routes -->|"uses"| node_http_helpers
node_student_routes -->|"uses"| node_http_helpers
node_notes_routes -->|"uses"| node_http_helpers
node_payment_routes -->|"uses"| node_http_helpers
node_assessment_routes -->|"uses"| node_http_helpers
node_user_routes -->|"uses"| node_http_helpers
node_meta_routes -->|"uses"| node_http_helpers
node_access -->|"summarizes"| node_fees

click node_app "https://github.com/thabetaltartoori/brainy-bunch/blob/master/client/src/App.jsx"
click node_login "https://github.com/thabetaltartoori/brainy-bunch/blob/master/client/src/pages/Login.jsx"
click node_students_ui "https://github.com/thabetaltartoori/brainy-bunch/blob/master/client/src/pages/Students.jsx"
click node_profile_ui "https://github.com/thabetaltartoori/brainy-bunch/blob/master/client/src/pages/StudentProfile.jsx"
click node_payments_ui "https://github.com/thabetaltartoori/brainy-bunch/blob/master/client/src/pages/Payments.jsx"
click node_notes_ui "https://github.com/thabetaltartoori/brainy-bunch/blob/master/client/src/pages/Notes.jsx"
click node_staff_ui "https://github.com/thabetaltartoori/brainy-bunch/blob/master/client/src/pages/Staff.jsx"
click node_announcements_ui "https://github.com/thabetaltartoori/brainy-bunch/blob/master/client/src/pages/Announcements.jsx"
click node_dashboard_ui "https://github.com/thabetaltartoori/brainy-bunch/blob/master/client/src/pages/Dashboard.jsx"
click node_client_api "https://github.com/thabetaltartoori/brainy-bunch/blob/master/client/src/api.js"
click node_localization "https://github.com/thabetaltartoori/brainy-bunch/blob/master/client/src/i18n.jsx"
click node_shell "https://github.com/thabetaltartoori/brainy-bunch/blob/master/client/src/components/Shell.jsx"
click node_server_entry "https://github.com/thabetaltartoori/brainy-bunch/blob/master/server/src/index.js"
click node_auth_routes "https://github.com/thabetaltartoori/brainy-bunch/blob/master/server/src/routes/auth.js"
click node_student_routes "https://github.com/thabetaltartoori/brainy-bunch/blob/master/server/src/routes/students.js"
click node_notes_routes "https://github.com/thabetaltartoori/brainy-bunch/blob/master/server/src/routes/notes.js"
click node_payment_routes "https://github.com/thabetaltartoori/brainy-bunch/blob/master/server/src/routes/payments.js"
click node_assessment_routes "https://github.com/thabetaltartoori/brainy-bunch/blob/master/server/src/routes/assessments.js"
click node_user_routes "https://github.com/thabetaltartoori/brainy-bunch/blob/master/server/src/routes/users.js"
click node_meta_routes "https://github.com/thabetaltartoori/brainy-bunch/blob/master/server/src/routes/meta.js"
click node_access "https://github.com/thabetaltartoori/brainy-bunch/blob/master/server/src/access.js"
click node_auth_core "https://github.com/thabetaltartoori/brainy-bunch/blob/master/server/src/auth.js"
click node_fees "https://github.com/thabetaltartoori/brainy-bunch/blob/master/server/src/fees.js"
click node_http_helpers "https://github.com/thabetaltartoori/brainy-bunch/blob/master/server/src/http.js"
click node_memory_store "https://github.com/thabetaltartoori/brainy-bunch/blob/master/server/src/store/memory.js"
click node_supabase_store "https://github.com/thabetaltartoori/brainy-bunch/blob/master/server/src/store/supabase.js"
click node_seed_data "https://github.com/thabetaltartoori/brainy-bunch/blob/master/server/src/store/seed.js"
click node_worker "https://github.com/thabetaltartoori/brainy-bunch/blob/master/worker/index.js"
click node_netlify "https://github.com/thabetaltartoori/brainy-bunch/blob/master/server/netlify/functions/api.mjs"

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_app,node_login,node_students_ui,node_profile_ui,node_payments_ui,node_notes_ui,node_staff_ui,node_announcements_ui,node_dashboard_ui,node_client_api,node_localization,node_shell,node_school_users toneBlue
class node_server_entry,node_auth_routes,node_student_routes,node_notes_routes,node_payment_routes,node_assessment_routes,node_user_routes,node_meta_routes,node_access,node_auth_core,node_fees,node_http_helpers toneAmber
class node_memory_store,node_supabase_store,node_seed_data toneMint
class node_worker,node_netlify toneRose
```

## Components

### Client experience

- [App routing](https://github.com/thabetaltartoori/brainy-bunch/blob/master/client/src/App.jsx): `client/src/App.jsx`
- [Sign in](https://github.com/thabetaltartoori/brainy-bunch/blob/master/client/src/pages/Login.jsx): `client/src/pages/Login.jsx`
- [Student records](https://github.com/thabetaltartoori/brainy-bunch/blob/master/client/src/pages/Students.jsx): `client/src/pages/Students.jsx`
- [Student profile](https://github.com/thabetaltartoori/brainy-bunch/blob/master/client/src/pages/StudentProfile.jsx): `client/src/pages/StudentProfile.jsx`
- [Payments](https://github.com/thabetaltartoori/brainy-bunch/blob/master/client/src/pages/Payments.jsx): `client/src/pages/Payments.jsx`
- [Notes](https://github.com/thabetaltartoori/brainy-bunch/blob/master/client/src/pages/Notes.jsx): `client/src/pages/Notes.jsx`
- [Staff accounts](https://github.com/thabetaltartoori/brainy-bunch/blob/master/client/src/pages/Staff.jsx): `client/src/pages/Staff.jsx`
- [Announcements](https://github.com/thabetaltartoori/brainy-bunch/blob/master/client/src/pages/Announcements.jsx): `client/src/pages/Announcements.jsx`
- [Dashboard](https://github.com/thabetaltartoori/brainy-bunch/blob/master/client/src/pages/Dashboard.jsx): `client/src/pages/Dashboard.jsx`
- [API client](https://github.com/thabetaltartoori/brainy-bunch/blob/master/client/src/api.js): `client/src/api.js`
- [Language and formatting](https://github.com/thabetaltartoori/brainy-bunch/blob/master/client/src/i18n.jsx): `client/src/i18n.jsx`
- [Navigation and banner](https://github.com/thabetaltartoori/brainy-bunch/blob/master/client/src/components/Shell.jsx): `client/src/components/Shell.jsx`

### API and domain

- [Express application](https://github.com/thabetaltartoori/brainy-bunch/blob/master/server/src/index.js): `server/src/index.js`
- [Authentication routes](https://github.com/thabetaltartoori/brainy-bunch/blob/master/server/src/routes/auth.js): `server/src/routes/auth.js`
- [Student routes](https://github.com/thabetaltartoori/brainy-bunch/blob/master/server/src/routes/students.js): `server/src/routes/students.js`
- [Notes routes](https://github.com/thabetaltartoori/brainy-bunch/blob/master/server/src/routes/notes.js): `server/src/routes/notes.js`
- [Payment routes](https://github.com/thabetaltartoori/brainy-bunch/blob/master/server/src/routes/payments.js): `server/src/routes/payments.js`
- [Assessment routes](https://github.com/thabetaltartoori/brainy-bunch/blob/master/server/src/routes/assessments.js): `server/src/routes/assessments.js`
- [User routes](https://github.com/thabetaltartoori/brainy-bunch/blob/master/server/src/routes/users.js): `server/src/routes/users.js`
- [Meta and fee data](https://github.com/thabetaltartoori/brainy-bunch/blob/master/server/src/routes/meta.js): `server/src/routes/meta.js`
- [Role access and scoping](https://github.com/thabetaltartoori/brainy-bunch/blob/master/server/src/access.js): `server/src/access.js`
- [Password and sessions](https://github.com/thabetaltartoori/brainy-bunch/blob/master/server/src/auth.js): `server/src/auth.js`
- [Fee summaries](https://github.com/thabetaltartoori/brainy-bunch/blob/master/server/src/fees.js): `server/src/fees.js`
- [HTTP validation](https://github.com/thabetaltartoori/brainy-bunch/blob/master/server/src/http.js): `server/src/http.js`

### Persistence

- [Demo store](https://github.com/thabetaltartoori/brainy-bunch/blob/master/server/src/store/memory.js): `server/src/store/memory.js`
- [Supabase store](https://github.com/thabetaltartoori/brainy-bunch/blob/master/server/src/store/supabase.js): `server/src/store/supabase.js`
- [Demo seed data](https://github.com/thabetaltartoori/brainy-bunch/blob/master/server/src/store/seed.js): `server/src/store/seed.js`

### Runtime adapters

- [Cloudflare adapter](https://github.com/thabetaltartoori/brainy-bunch/blob/master/worker/index.js): `worker/index.js`
- [Netlify function adapter](https://github.com/thabetaltartoori/brainy-bunch/blob/master/server/netlify/functions/api.mjs): `server/netlify/functions/api.mjs`

### Other components

- **School users**

## Connections

- School users → App routing: use (evidence: `client/src/App.jsx`)
- App routing → Sign in: routes to (evidence: `client/src/App.jsx`)
- App routing → Dashboard: routes to (evidence: `client/src/App.jsx`)
- App routing → Student records: routes to (evidence: `client/src/App.jsx`)
- App routing → Student profile: routes to (evidence: `client/src/App.jsx`)
- App routing → Payments: routes to (evidence: `client/src/App.jsx`)
- App routing → Notes: routes to (evidence: `client/src/App.jsx`)
- App routing → Staff accounts: routes to (evidence: `client/src/App.jsx`)
- App routing → Announcements: routes to (evidence: `client/src/App.jsx`)
- Sign in → API client: calls (evidence: `client/src/pages/Login.jsx`)
- Student records → API client: calls (evidence: `client/src/pages/Students.jsx`)
- Student profile → API client: calls (evidence: `client/src/pages/StudentProfile.jsx`)
- Payments → API client: calls (evidence: `client/src/pages/Payments.jsx`)
- Notes → API client: calls (evidence: `client/src/pages/Notes.jsx`)
- Staff accounts → API client: calls (evidence: `client/src/pages/Staff.jsx`)
- Announcements → API client: calls (evidence: `client/src/pages/Announcements.jsx`)
- App routing → Language and formatting: provides (evidence: `client/src/App.jsx`)
- App routing → Navigation and banner: uses (evidence: `client/src/App.jsx`)
- API client → Express application: requests API
- Express application → Authentication routes: registers (evidence: `server/src/index.js`)
- Express application → Student routes: registers (evidence: `server/src/index.js`)
- Express application → Notes routes: registers (evidence: `server/src/index.js`)
- Express application → Payment routes: registers (evidence: `server/src/index.js`)
- Express application → Assessment routes: registers (evidence: `server/src/index.js`)
- Express application → User routes: registers (evidence: `server/src/index.js`)
- Express application → Meta and fee data: registers (evidence: `server/src/index.js`)
- Express application → Demo store: selects store (evidence: `server/src/index.js`)
- Express application → Supabase store: selects store (evidence: `server/src/index.js`)
- Express application → Password and sessions: parses sessions (evidence: `server/src/index.js`)
- Authentication routes → Password and sessions: uses (evidence: `server/src/routes/auth.js`)
- Authentication routes → Role access and scoping: checks access (evidence: `server/src/routes/auth.js`)
- Student routes → Role access and scoping: scopes records (evidence: `server/src/routes/students.js`)
- Student routes → Fee summaries: summarizes fees (evidence: `server/src/routes/students.js`)
- Notes routes → Role access and scoping: checks access (evidence: `server/src/routes/notes.js`)
- Payment routes → Role access and scoping: checks access (evidence: `server/src/routes/payments.js`)
- Assessment routes → Role access and scoping: checks access (evidence: `server/src/routes/assessments.js`)
- User routes → Role access and scoping: checks access (evidence: `server/src/routes/users.js`)
- User routes → Password and sessions: uses (evidence: `server/src/routes/users.js`)
- Meta and fee data → Role access and scoping: checks access (evidence: `server/src/routes/meta.js`)
- Meta and fee data → Fee summaries: uses (evidence: `server/src/routes/meta.js`)
- Authentication routes → HTTP validation: uses (evidence: `server/src/routes/auth.js`)
- Student routes → HTTP validation: uses (evidence: `server/src/routes/students.js`)
- Notes routes → HTTP validation: uses (evidence: `server/src/routes/notes.js`)
- Payment routes → HTTP validation: uses (evidence: `server/src/routes/payments.js`)
- Assessment routes → HTTP validation: uses (evidence: `server/src/routes/assessments.js`)
- User routes → HTTP validation: uses (evidence: `server/src/routes/users.js`)
- Meta and fee data → HTTP validation: uses (evidence: `server/src/routes/meta.js`)
- Role access and scoping → Fee summaries: summarizes (evidence: `server/src/access.js`)
