# gaberuseff/isnad architecture

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

- Interactive diagram: https://gitdiagram.com/gaberuseff/isnad
- Repository: https://github.com/gaberuseff/isnad

## Overview

This is a React/TypeScript administrative application with role-based login and separate admin and call-center areas. The main supported workflow is app startup, authentication and role-based routing, then access to employee or user management; employee data operations are exposed through Supabase-backed services. The tree also includes customer and request routes and Supabase user-management functions, but their behavior is not shown in the sampled source. Dashed edges mark those unverified integrations; other links are limited to references visible in excerpts or the source index.

Main entry points: [`src/features/auth/hooks/useAuth.ts`](https://github.com/gaberuseff/isnad/blob/main/src/features/auth/hooks/useAuth.ts) (Auth state), [`src/main.tsx`](https://github.com/gaberuseff/isnad/blob/main/src/main.tsx) (App entry), [`src/routeTree.gen.ts`](https://github.com/gaberuseff/isnad/blob/main/src/routeTree.gen.ts) (Route tree), [`src/routes/_authenticated/admin/route.tsx`](https://github.com/gaberuseff/isnad/blob/main/src/routes/_authenticated/admin/route.tsx) (Admin area)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application Shell"]
  node_entry["App entry<br/>[main.tsx]"]
  node_providers["App providers<br/>[Providers.tsx]"]
  node_routes["Route tree<br/>[routeTree.gen.ts]"]
  node_adminarea["Admin area<br/>[route.tsx]"]
  node_callcenter["Call-center area<br/>[route.tsx]"]
  node_header["Shared header<br/>[Header.tsx]"]
  node_nav["Admin navigation<br/>[Nav.tsx]"]
  node_queryclient["Query cache<br/>[queryClient.ts]"]
  node_theme["Theme provider<br/>[theme.tsx]"]
end

subgraph group_auth["Authentication"]
  node_loginpage["Login page<br/>[index.tsx]"]
  node_loginform["Login form<br/>[LoginForm.tsx]"]
  node_authstate["Auth state<br/>[useAuth.ts]"]
  node_authapi["Auth API<br/>[apiAuth.ts]"]
end

subgraph group_admin["Administration"]
  node_employees["Employee management<br/>[EmployeeLayout.tsx]"]
  node_employeehooks["Employee operations"]
  node_users["User management<br/>[UsersLayout.tsx]"]
  node_userhooks["User operations"]
end

subgraph group_data["Data Services"]
  node_supabase["Supabase client<br/>[supabase.ts]"]
  node_employeeapi["Employee API<br/>[apiEmployees.ts]"]
  node_userapi["User API<br/>[apiUsers.ts]"]
  node_userfunctions["User functions"]
end

node_operator(("Staff user"))

node_operator -->|"opens app"| node_entry
node_entry -->|"renders"| node_providers
node_entry -->|"configures router"| node_routes
node_entry -->|"loads auth"| node_authstate
node_providers -->|"uses cache"| node_queryclient
node_providers -->|"provides theme"| node_theme
node_routes -->|"routes to"| node_adminarea
node_routes -->|"routes to"| node_callcenter
node_routes -->|"routes to"| node_loginpage
node_loginpage -->|"renders"| node_loginform
node_loginpage -->|"checks auth"| node_authstate
node_authstate -->|"loads current user"| node_authapi
node_authapi -->|"calls auth and profiles"| node_supabase
node_adminarea -->|"checks role"| node_authstate
node_adminarea -->|"renders"| node_header
node_adminarea -->|"renders"| node_nav
node_callcenter -->|"checks role"| node_authstate
node_callcenter -->|"renders"| node_header
node_header -->|"uses toggle"| node_theme
node_employees -.->|"uses operations"| node_employeehooks
node_employeehooks -->|"calls operations"| node_employeeapi
node_employeeapi -->|"reads and writes"| node_supabase
node_users -.->|"uses operations"| node_userhooks
node_userhooks -->|"calls operations"| node_userapi
node_userapi -->|"reads and writes"| node_supabase
node_userfunctions -.->|"manages accounts"| node_supabase

click node_entry "https://github.com/gaberuseff/isnad/blob/main/src/main.tsx"
click node_providers "https://github.com/gaberuseff/isnad/blob/main/src/Providers.tsx"
click node_routes "https://github.com/gaberuseff/isnad/blob/main/src/routeTree.gen.ts"
click node_adminarea "https://github.com/gaberuseff/isnad/blob/main/src/routes/_authenticated/admin/route.tsx"
click node_callcenter "https://github.com/gaberuseff/isnad/blob/main/src/routes/_authenticated/call-center/route.tsx"
click node_loginpage "https://github.com/gaberuseff/isnad/blob/main/src/routes/login/index.tsx"
click node_loginform "https://github.com/gaberuseff/isnad/blob/main/src/features/auth/components/LoginForm.tsx"
click node_authstate "https://github.com/gaberuseff/isnad/blob/main/src/features/auth/hooks/useAuth.ts"
click node_authapi "https://github.com/gaberuseff/isnad/blob/main/src/services/apiAuth.ts"
click node_supabase "https://github.com/gaberuseff/isnad/blob/main/src/services/supabase.ts"
click node_employees "https://github.com/gaberuseff/isnad/blob/main/src/features/admin/employees/components/EmployeeLayout.tsx"
click node_employeehooks "https://github.com/gaberuseff/isnad/tree/main/src/features/admin/employees/hooks"
click node_employeeapi "https://github.com/gaberuseff/isnad/blob/main/src/services/apiEmployees.ts"
click node_users "https://github.com/gaberuseff/isnad/blob/main/src/features/admin/users/components/UsersLayout.tsx"
click node_userhooks "https://github.com/gaberuseff/isnad/tree/main/src/features/admin/users/hooks"
click node_userapi "https://github.com/gaberuseff/isnad/blob/main/src/services/apiUsers.ts"
click node_userfunctions "https://github.com/gaberuseff/isnad/tree/main/supabase/functions"
click node_header "https://github.com/gaberuseff/isnad/blob/main/src/layouts/Header.tsx"
click node_nav "https://github.com/gaberuseff/isnad/blob/main/src/layouts/Nav.tsx"
click node_queryclient "https://github.com/gaberuseff/isnad/blob/main/src/lib/queryClient.ts"
click node_theme "https://github.com/gaberuseff/isnad/blob/main/src/lib/theme.tsx"

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_entry,node_providers,node_routes,node_adminarea,node_callcenter,node_header,node_nav,node_queryclient,node_theme,node_operator toneBlue
class node_loginpage,node_loginform,node_authstate,node_authapi toneAmber
class node_employees,node_employeehooks,node_users,node_userhooks toneMint
class node_supabase,node_employeeapi,node_userapi,node_userfunctions toneRose
```

## Components

### Application Shell

- [App entry](https://github.com/gaberuseff/isnad/blob/main/src/main.tsx): `src/main.tsx`
- [App providers](https://github.com/gaberuseff/isnad/blob/main/src/Providers.tsx): `src/Providers.tsx`
- [Route tree](https://github.com/gaberuseff/isnad/blob/main/src/routeTree.gen.ts): `src/routeTree.gen.ts`
- [Admin area](https://github.com/gaberuseff/isnad/blob/main/src/routes/_authenticated/admin/route.tsx): `src/routes/_authenticated/admin/route.tsx`
- [Call-center area](https://github.com/gaberuseff/isnad/blob/main/src/routes/_authenticated/call-center/route.tsx): `src/routes/_authenticated/call-center/route.tsx`
- [Shared header](https://github.com/gaberuseff/isnad/blob/main/src/layouts/Header.tsx): `src/layouts/Header.tsx`
- [Admin navigation](https://github.com/gaberuseff/isnad/blob/main/src/layouts/Nav.tsx): `src/layouts/Nav.tsx`
- [Query cache](https://github.com/gaberuseff/isnad/blob/main/src/lib/queryClient.ts): `src/lib/queryClient.ts`
- [Theme provider](https://github.com/gaberuseff/isnad/blob/main/src/lib/theme.tsx): `src/lib/theme.tsx`

### Authentication

- [Login page](https://github.com/gaberuseff/isnad/blob/main/src/routes/login/index.tsx): `src/routes/login/index.tsx`
- [Login form](https://github.com/gaberuseff/isnad/blob/main/src/features/auth/components/LoginForm.tsx): `src/features/auth/components/LoginForm.tsx`
- [Auth state](https://github.com/gaberuseff/isnad/blob/main/src/features/auth/hooks/useAuth.ts): `src/features/auth/hooks/useAuth.ts`
- [Auth API](https://github.com/gaberuseff/isnad/blob/main/src/services/apiAuth.ts): `src/services/apiAuth.ts`

### Administration

- [Employee management](https://github.com/gaberuseff/isnad/blob/main/src/features/admin/employees/components/EmployeeLayout.tsx): `src/features/admin/employees/components/EmployeeLayout.tsx`
- [Employee operations](https://github.com/gaberuseff/isnad/tree/main/src/features/admin/employees/hooks): `src/features/admin/employees/hooks`
- [User management](https://github.com/gaberuseff/isnad/blob/main/src/features/admin/users/components/UsersLayout.tsx): `src/features/admin/users/components/UsersLayout.tsx`
- [User operations](https://github.com/gaberuseff/isnad/tree/main/src/features/admin/users/hooks): `src/features/admin/users/hooks`

### Data Services

- [Supabase client](https://github.com/gaberuseff/isnad/blob/main/src/services/supabase.ts): `src/services/supabase.ts`
- [Employee API](https://github.com/gaberuseff/isnad/blob/main/src/services/apiEmployees.ts): `src/services/apiEmployees.ts`
- [User API](https://github.com/gaberuseff/isnad/blob/main/src/services/apiUsers.ts): `src/services/apiUsers.ts`
- [User functions](https://github.com/gaberuseff/isnad/tree/main/supabase/functions): `supabase/functions`

### Other components

- **Staff user**

## Connections

- Staff user → App entry: opens app
- App entry → App providers: renders (evidence: `src/main.tsx`)
- App entry → Route tree: configures router (evidence: `src/main.tsx`)
- App entry → Auth state: loads auth (evidence: `src/main.tsx`)
- App providers → Query cache: uses cache (evidence: `src/Providers.tsx`)
- App providers → Theme provider: provides theme (evidence: `src/Providers.tsx`)
- Route tree → Admin area: routes to (evidence: `src/routeTree.gen.ts`)
- Route tree → Call-center area: routes to (evidence: `src/routeTree.gen.ts`)
- Route tree → Login page: routes to (evidence: `src/routeTree.gen.ts`)
- Login page → Login form: renders (evidence: `src/routes/login/index.tsx`)
- Login page → Auth state: checks auth (evidence: `src/routes/login/index.tsx`)
- Auth state → Auth API: loads current user (evidence: `src/features/auth/hooks/useAuth.ts`)
- Auth API → Supabase client: calls auth and profiles (evidence: `src/services/apiAuth.ts`)
- Admin area → Auth state: checks role (evidence: `src/routes/_authenticated/admin/route.tsx`)
- Admin area → Shared header: renders (evidence: `src/routes/_authenticated/admin/route.tsx`)
- Admin area → Admin navigation: renders (evidence: `src/routes/_authenticated/admin/route.tsx`)
- Call-center area → Auth state: checks role (evidence: `src/routes/_authenticated/call-center/route.tsx`)
- Call-center area → Shared header: renders (evidence: `src/routes/_authenticated/call-center/route.tsx`)
- Shared header → Theme provider: uses toggle (evidence: `src/layouts/Header.tsx`)
- Employee management → Employee operations: uses operations
- Employee operations → Employee API: calls operations (evidence: `src/features/admin/employees/hooks/useCreateEmployee.ts`)
- Employee API → Supabase client: reads and writes (evidence: `src/services/apiEmployees.ts`)
- User management → User operations: uses operations
- User operations → User API: calls operations (evidence: `src/features/admin/users/hooks/useCreateUser.ts`)
- User API → Supabase client: reads and writes (evidence: `src/services/apiUsers.ts`)
- User functions → Supabase client: manages accounts
