# menendezon/fabrirh architecture

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

- Interactive diagram: https://gitdiagram.com/menendezon/fabrirh
- Repository: https://github.com/menendezon/fabrirh

## Overview

Fabri RH is an internal HR-management application. The main user workflow is signing in, entering the authenticated workspace, and managing employee records; the README also documents dashboards, contracts and departures, documents, organization charts, and administration. The sampled code confirms authentication gating, the employee-list query/export flow, and API-key validation. Other documented capabilities are represented as product areas, but their internal call relationships are not inferred from unsampled source.

Main entry points: [`src/routes/_authenticated/employes/index.tsx`](https://github.com/menendezon/fabrirh/blob/main/src/routes/_authenticated/employes/index.tsx) (Employee directory), [`src/lib/employees.ts`](https://github.com/menendezon/fabrirh/blob/main/src/lib/employees.ts) (Employee data access), [`src/integrations/supabase/client.ts`](https://github.com/menendezon/fabrirh/blob/main/src/integrations/supabase/client.ts) (Supabase), [`src/routes/_authenticated/route.tsx`](https://github.com/menendezon/fabrirh/blob/main/src/routes/_authenticated/route.tsx) (Session and MFA gate)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and workspace"]
  node_auth_route["Sign-in<br/>[auth.tsx]"]
  node_auth_guard["Session and MFA gate<br/>[route.tsx]"]
  node_auth_context["Auth context<br/>[auth-context.tsx]"]
  node_workspace["App shell<br/>[app-shell.tsx]"]
  node_session["Session expiry<br/>[session-expiry.ts]"]
  node_button["Button UI<br/>[button.tsx]"]
  node_input["Input UI<br/>[input.tsx]"]
  node_label["Label UI<br/>[label.tsx]"]
  node_states["Loading and error states<br/>[states.tsx]"]
  node_brand["Branding<br/>[brand.tsx]"]
end

subgraph group_people["Employee management"]
  node_employee_list["Employee directory<br/>[index.tsx]"]
  node_employee_profile["Employee records<br/>[$employeeId.tsx]"]
  node_employee_service["Employee data access<br/>[employees.ts]"]
  node_employee_schemas["Employee validation"]
  node_employee_common["Employee form elements<br/>[common.tsx]"]
end

subgraph group_hr["HR operations"]
  node_contracts["Contracts and departures<br/>[contracts.ts]"]
  node_documents["Employee documents<br/>[documents.ts]"]
  node_org_chart["Organization chart<br/>[org-chart.ts]"]
  node_dashboard["Dashboard and metrics<br/>[dashboard.ts]"]
  node_reviews["Performance reviews<br/>[reviews.ts]"]
end

subgraph group_admin["Administration and API"]
  node_admin_routes["Administration<br/>[utilisateurs.tsx]"]
  node_api_route["Public API routes<br/>[index.tsx]"]
  node_api_server["API access service<br/>[server.ts]"]
  node_api_keys["API key handling<br/>[keys.ts]"]
end

subgraph group_data["Data and policy"]
  node_permissions["Permissions<br/>[permissions.ts]"]
  node_roles["Roles<br/>[roles.ts]"]
  node_referentials["HR referentials<br/>[referentials.ts]"]
  node_supabase[("Supabase<br/>[client.ts]")]
end

node_staff(("HR user"))

node_staff -->|"signs in"| node_auth_route
node_auth_route -.->|"opens session"| node_auth_guard
node_auth_guard -->|"checks user"| node_supabase
node_auth_guard -->|"renders"| node_workspace
node_auth_guard -->|"provides auth"| node_auth_context
node_employee_list -->|"queries employees"| node_employee_service
node_employee_service -->|"reads and writes"| node_supabase
node_employee_list -->|"uses validation"| node_employee_schemas
node_employee_list -->|"renders forms"| node_employee_common
node_employee_common -->|"uses employee data"| node_employee_service
node_staff -->|"manages staff"| node_employee_list
node_staff -->|"views records"| node_employee_profile
node_staff -->|"manages contracts"| node_contracts
node_staff -->|"manages documents"| node_documents
node_staff -->|"views organization"| node_org_chart
node_staff -->|"reviews dashboard"| node_dashboard
node_staff -->|"administers users"| node_admin_routes
node_admin_routes -.->|"manages access"| node_permissions
node_staff -->|"requests API data"| node_api_route
node_api_route -->|"authenticates request"| node_api_server
node_api_server -->|"validates keys"| node_api_keys
node_api_server -->|"reads key and logs"| node_supabase
node_auth_context -->|"loads current user"| node_roles
node_roles -->|"queries roles"| node_supabase
node_permissions -->|"checks permissions"| node_supabase
node_employee_service -->|"uses referentials"| node_referentials
node_employee_service -->|"uses schemas"| node_employee_schemas
node_employee_list -.->|"appears within"| node_workspace

click node_auth_route "https://github.com/menendezon/fabrirh/blob/main/src/routes/auth.tsx"
click node_auth_guard "https://github.com/menendezon/fabrirh/blob/main/src/routes/_authenticated/route.tsx"
click node_auth_context "https://github.com/menendezon/fabrirh/blob/main/src/lib/auth-context.tsx"
click node_workspace "https://github.com/menendezon/fabrirh/blob/main/src/components/app-shell.tsx"
click node_session "https://github.com/menendezon/fabrirh/blob/main/src/lib/session-expiry.ts"
click node_employee_list "https://github.com/menendezon/fabrirh/blob/main/src/routes/_authenticated/employes/index.tsx"
click node_employee_profile "https://github.com/menendezon/fabrirh/blob/main/src/routes/_authenticated/employes/%24employeeId.tsx"
click node_employee_service "https://github.com/menendezon/fabrirh/blob/main/src/lib/employees.ts"
click node_employee_schemas "https://github.com/menendezon/fabrirh/blob/main/src/lib/employee-schemas.ts"
click node_employee_common "https://github.com/menendezon/fabrirh/blob/main/src/components/employees/common.tsx"
click node_contracts "https://github.com/menendezon/fabrirh/blob/main/src/lib/contracts.ts"
click node_documents "https://github.com/menendezon/fabrirh/blob/main/src/lib/documents.ts"
click node_org_chart "https://github.com/menendezon/fabrirh/blob/main/src/lib/org-chart.ts"
click node_dashboard "https://github.com/menendezon/fabrirh/blob/main/src/lib/dashboard.ts"
click node_reviews "https://github.com/menendezon/fabrirh/blob/main/src/lib/reviews.ts"
click node_admin_routes "https://github.com/menendezon/fabrirh/blob/main/src/routes/_authenticated/utilisateurs.tsx"
click node_permissions "https://github.com/menendezon/fabrirh/blob/main/src/lib/permissions.ts"
click node_roles "https://github.com/menendezon/fabrirh/blob/main/src/lib/roles.ts"
click node_referentials "https://github.com/menendezon/fabrirh/blob/main/src/lib/referentials.ts"
click node_api_route "https://github.com/menendezon/fabrirh/blob/main/src/routes/api/v1/employees/index.tsx"
click node_api_server "https://github.com/menendezon/fabrirh/blob/main/src/lib/api/server.ts"
click node_api_keys "https://github.com/menendezon/fabrirh/blob/main/src/lib/api/keys.ts"
click node_supabase "https://github.com/menendezon/fabrirh/blob/main/src/integrations/supabase/client.ts"
click node_button "https://github.com/menendezon/fabrirh/blob/main/src/components/ui/button.tsx"
click node_input "https://github.com/menendezon/fabrirh/blob/main/src/components/ui/input.tsx"
click node_label "https://github.com/menendezon/fabrirh/blob/main/src/components/ui/label.tsx"
click node_states "https://github.com/menendezon/fabrirh/blob/main/src/components/states.tsx"
click node_brand "https://github.com/menendezon/fabrirh/blob/main/src/components/brand.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_auth_route,node_auth_guard,node_auth_context,node_workspace,node_session,node_button,node_input,node_label,node_states,node_brand,node_staff toneBlue
class node_employee_list,node_employee_profile,node_employee_service,node_employee_schemas,node_employee_common toneAmber
class node_contracts,node_documents,node_org_chart,node_dashboard,node_reviews toneMint
class node_admin_routes,node_api_route,node_api_server,node_api_keys toneRose
class node_permissions,node_roles,node_referentials,node_supabase toneIndigo
```

## Components

### Access and workspace

- [Sign-in](https://github.com/menendezon/fabrirh/blob/main/src/routes/auth.tsx): `src/routes/auth.tsx`
- [Session and MFA gate](https://github.com/menendezon/fabrirh/blob/main/src/routes/_authenticated/route.tsx): `src/routes/_authenticated/route.tsx`
- [Auth context](https://github.com/menendezon/fabrirh/blob/main/src/lib/auth-context.tsx): `src/lib/auth-context.tsx`
- [App shell](https://github.com/menendezon/fabrirh/blob/main/src/components/app-shell.tsx): `src/components/app-shell.tsx`
- [Session expiry](https://github.com/menendezon/fabrirh/blob/main/src/lib/session-expiry.ts): `src/lib/session-expiry.ts`
- [Button UI](https://github.com/menendezon/fabrirh/blob/main/src/components/ui/button.tsx): `src/components/ui/button.tsx`
- [Input UI](https://github.com/menendezon/fabrirh/blob/main/src/components/ui/input.tsx): `src/components/ui/input.tsx`
- [Label UI](https://github.com/menendezon/fabrirh/blob/main/src/components/ui/label.tsx): `src/components/ui/label.tsx`
- [Loading and error states](https://github.com/menendezon/fabrirh/blob/main/src/components/states.tsx): `src/components/states.tsx`
- [Branding](https://github.com/menendezon/fabrirh/blob/main/src/components/brand.tsx): `src/components/brand.tsx`

### Employee management

- [Employee directory](https://github.com/menendezon/fabrirh/blob/main/src/routes/_authenticated/employes/index.tsx): `src/routes/_authenticated/employes/index.tsx`
- [Employee records](https://github.com/menendezon/fabrirh/blob/main/src/routes/_authenticated/employes/%24employeeId.tsx): `src/routes/_authenticated/employes/$employeeId.tsx`
- [Employee data access](https://github.com/menendezon/fabrirh/blob/main/src/lib/employees.ts): `src/lib/employees.ts`
- [Employee validation](https://github.com/menendezon/fabrirh/blob/main/src/lib/employee-schemas.ts): `src/lib/employee-schemas.ts`
- [Employee form elements](https://github.com/menendezon/fabrirh/blob/main/src/components/employees/common.tsx): `src/components/employees/common.tsx`

### HR operations

- [Contracts and departures](https://github.com/menendezon/fabrirh/blob/main/src/lib/contracts.ts): `src/lib/contracts.ts`
- [Employee documents](https://github.com/menendezon/fabrirh/blob/main/src/lib/documents.ts): `src/lib/documents.ts`
- [Organization chart](https://github.com/menendezon/fabrirh/blob/main/src/lib/org-chart.ts): `src/lib/org-chart.ts`
- [Dashboard and metrics](https://github.com/menendezon/fabrirh/blob/main/src/lib/dashboard.ts): `src/lib/dashboard.ts`
- [Performance reviews](https://github.com/menendezon/fabrirh/blob/main/src/lib/reviews.ts): `src/lib/reviews.ts`

### Administration and API

- [Administration](https://github.com/menendezon/fabrirh/blob/main/src/routes/_authenticated/utilisateurs.tsx): `src/routes/_authenticated/utilisateurs.tsx`
- [Public API routes](https://github.com/menendezon/fabrirh/blob/main/src/routes/api/v1/employees/index.tsx): `src/routes/api/v1/employees/index.tsx`
- [API access service](https://github.com/menendezon/fabrirh/blob/main/src/lib/api/server.ts): `src/lib/api/server.ts`
- [API key handling](https://github.com/menendezon/fabrirh/blob/main/src/lib/api/keys.ts): `src/lib/api/keys.ts`

### Data and policy

- [Permissions](https://github.com/menendezon/fabrirh/blob/main/src/lib/permissions.ts): `src/lib/permissions.ts`
- [Roles](https://github.com/menendezon/fabrirh/blob/main/src/lib/roles.ts): `src/lib/roles.ts`
- [HR referentials](https://github.com/menendezon/fabrirh/blob/main/src/lib/referentials.ts): `src/lib/referentials.ts`
- [Supabase](https://github.com/menendezon/fabrirh/blob/main/src/integrations/supabase/client.ts): `src/integrations/supabase/client.ts`

### Other components

- **HR user**

## Connections

- HR user → Sign-in: signs in (evidence: `src/routes/auth.tsx`)
- Sign-in → Session and MFA gate: opens session
- Session and MFA gate → Supabase: checks user (evidence: `src/routes/_authenticated/route.tsx`)
- Session and MFA gate → App shell: renders (evidence: `src/routes/_authenticated/route.tsx`)
- Session and MFA gate → Auth context: provides auth (evidence: `src/routes/_authenticated/route.tsx`)
- Employee directory → Employee data access: queries employees (evidence: `src/routes/_authenticated/employes/index.tsx`)
- Employee data access → Supabase: reads and writes (evidence: `src/lib/employees.ts`)
- Employee directory → Employee validation: uses validation (evidence: `src/routes/_authenticated/employes/index.tsx`)
- Employee directory → Employee form elements: renders forms (evidence: `src/routes/_authenticated/employes/index.tsx`)
- Employee form elements → Employee data access: uses employee data (evidence: `src/components/employees/common.tsx`)
- HR user → Employee directory: manages staff (evidence: `README.md`)
- HR user → Employee records: views records (evidence: `README.md`)
- HR user → Contracts and departures: manages contracts (evidence: `README.md`)
- HR user → Employee documents: manages documents (evidence: `README.md`)
- HR user → Organization chart: views organization (evidence: `README.md`)
- HR user → Dashboard and metrics: reviews dashboard (evidence: `README.md`)
- HR user → Administration: administers users (evidence: `README.md`)
- Administration → Permissions: manages access
- HR user → Public API routes: requests API data (evidence: `README.md`)
- Public API routes → API access service: authenticates request (evidence: `src/routes/api/v1/employees/index.tsx`)
- API access service → API key handling: validates keys (evidence: `src/lib/api/server.ts`)
- API access service → Supabase: reads key and logs (evidence: `src/lib/api/server.ts`)
- Auth context → Roles: loads current user (evidence: `src/lib/auth-context.tsx`)
- Roles → Supabase: queries roles (evidence: `src/lib/roles.ts`)
- Permissions → Supabase: checks permissions (evidence: `src/lib/permissions.ts`)
- Employee data access → HR referentials: uses referentials (evidence: `src/lib/employees.ts`)
- Employee data access → Employee validation: uses schemas (evidence: `src/lib/employees.ts`)
- Employee directory → App shell: appears within (evidence: `src/routes/_authenticated/employes/index.tsx`)
