# suporteeligi-cpu/eligi-fron-tend architecture

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

- Interactive diagram: https://gitdiagram.com/suporteeligi-cpu/eligi-fron-tend
- Repository: https://github.com/suporteeligi-cpu/eligi-fron-tend

## Overview

Eligi is a salon and barbershop management web app. A user signs in or registers, the auth hook fetches their account and routes them to onboarding or the dashboard; dashboard areas support scheduling, client management, sales, finance and other business operations. The sampled code shows shared API access and several feature-level data hooks, but most dashboard routes and integrations were not inspected, so their internal connections are omitted. Paths for unsampled capabilities point to exact directories from the tree.

Main entry points: [`src/lib/apiClient.ts`](https://github.com/suporteeligi-cpu/eligi-fron-tend/blob/main/src/lib/apiClient.ts) (API client), [`src/features/finance-hub/useFinanceHub.ts`](https://github.com/suporteeligi-cpu/eligi-fron-tend/blob/main/src/features/finance-hub/useFinanceHub.ts) (Finance overview), [`src/hooks/useAuth.ts`](https://github.com/suporteeligi-cpu/eligi-fron-tend/blob/main/src/hooks/useAuth.ts) (Auth workflow), [`src/lib/auth.api.ts`](https://github.com/suporteeligi-cpu/eligi-fron-tend/blob/main/src/lib/auth.api.ts) (Auth requests)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Identity and access"]
  node_auth_hook["Auth workflow<br/>[useAuth.ts]"]
  node_auth_api["Auth requests<br/>[auth.api.ts]"]
  node_auth_types["Account types<br/>[auth.types.ts]"]
end

subgraph group_platform["API platform"]
  node_api_client["API client<br/>[apiClient.ts]"]
  node_refresh["Session refresh<br/>[refreshSession.ts]"]
  node_backend["Eligi API"]
end

subgraph group_operations["Business operations"]
  node_dashboard["Dashboard<br/>[page.tsx]"]
  node_agenda["Appointment scheduling"]
  node_booking["Booking details"]
  node_clients["Client management"]
  node_services["Service catalog"]
  node_team["Team management"]
  node_stock["Stock management"]
  node_anamnesis["Client anamnesis"]
end

subgraph group_finance["Finance and insights"]
  node_sales["Point of sale"]
  node_finance_hub["Finance overview<br/>[useFinanceHub.ts]"]
  node_expenses["Expense tracking"]
  node_reports["Reports"]
  node_payouts["Commissions and payouts"]
  node_fiscal["Fiscal documents"]
end

subgraph group_support["Business setup"]
  node_business_profile["Business profile"]
  node_onboarding["Business onboarding"]
end

node_user(("Business user"))

node_user -->|"signs in"| node_auth_hook
node_auth_hook -->|"requests auth"| node_auth_api
node_auth_api -->|"sends requests"| node_api_client
node_auth_api -->|"returns account"| node_auth_types
node_auth_hook -->|"routes by role"| node_dashboard
node_auth_hook -->|"routes new businesses"| node_onboarding
node_api_client -->|"calls API"| node_backend
node_api_client -->|"refreshes session"| node_refresh
node_finance_hub -->|"fetches finance data"| node_api_client
node_finance_hub -->|"reads cash flow"| node_reports
node_finance_hub -->|"reads sales totals"| node_sales
node_finance_hub -->|"reads payout data"| node_payouts
node_expenses -->|"loads expenses"| node_api_client
node_business_profile -->|"loads profile"| node_api_client
node_clients -->|"loads client data"| node_api_client

click node_auth_hook "https://github.com/suporteeligi-cpu/eligi-fron-tend/blob/main/src/hooks/useAuth.ts"
click node_auth_api "https://github.com/suporteeligi-cpu/eligi-fron-tend/blob/main/src/lib/auth.api.ts"
click node_auth_types "https://github.com/suporteeligi-cpu/eligi-fron-tend/blob/main/src/types/auth.types.ts"
click node_dashboard "https://github.com/suporteeligi-cpu/eligi-fron-tend/blob/main/src/app/dashboard/page.tsx"
click node_api_client "https://github.com/suporteeligi-cpu/eligi-fron-tend/blob/main/src/lib/apiClient.ts"
click node_refresh "https://github.com/suporteeligi-cpu/eligi-fron-tend/blob/main/src/lib/refreshSession.ts"
click node_agenda "https://github.com/suporteeligi-cpu/eligi-fron-tend/tree/main/src/features/agenda"
click node_booking "https://github.com/suporteeligi-cpu/eligi-fron-tend/tree/main/src/features/booking"
click node_clients "https://github.com/suporteeligi-cpu/eligi-fron-tend/tree/main/src/features/clients"
click node_services "https://github.com/suporteeligi-cpu/eligi-fron-tend/tree/main/src/app/dashboard/servicos"
click node_team "https://github.com/suporteeligi-cpu/eligi-fron-tend/tree/main/src/app/dashboard/equipe"
click node_sales "https://github.com/suporteeligi-cpu/eligi-fron-tend/tree/main/src/app/dashboard/caixa"
click node_finance_hub "https://github.com/suporteeligi-cpu/eligi-fron-tend/blob/main/src/features/finance-hub/useFinanceHub.ts"
click node_expenses "https://github.com/suporteeligi-cpu/eligi-fron-tend/tree/main/src/features/expenses"
click node_reports "https://github.com/suporteeligi-cpu/eligi-fron-tend/tree/main/src/features/reports"
click node_payouts "https://github.com/suporteeligi-cpu/eligi-fron-tend/tree/main/src/features/payouts"
click node_fiscal "https://github.com/suporteeligi-cpu/eligi-fron-tend/tree/main/src/features/fiscal"
click node_stock "https://github.com/suporteeligi-cpu/eligi-fron-tend/tree/main/src/features/stock"
click node_anamnesis "https://github.com/suporteeligi-cpu/eligi-fron-tend/tree/main/src/features/anamnesis"
click node_business_profile "https://github.com/suporteeligi-cpu/eligi-fron-tend/blob/main/src/features/settings/hooks/useBusinessProfileDraft.ts"
click node_onboarding "https://github.com/suporteeligi-cpu/eligi-fron-tend/tree/main/src/app/onboarding"

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_hook,node_auth_api,node_auth_types,node_user toneBlue
class node_api_client,node_refresh,node_backend toneAmber
class node_dashboard,node_agenda,node_booking,node_clients,node_services,node_team,node_stock,node_anamnesis toneMint
class node_sales,node_finance_hub,node_expenses,node_reports,node_payouts,node_fiscal toneRose
class node_business_profile,node_onboarding toneIndigo
```

## Components

### Identity and access

- [Auth workflow](https://github.com/suporteeligi-cpu/eligi-fron-tend/blob/main/src/hooks/useAuth.ts): `src/hooks/useAuth.ts`
- [Auth requests](https://github.com/suporteeligi-cpu/eligi-fron-tend/blob/main/src/lib/auth.api.ts): `src/lib/auth.api.ts`
- [Account types](https://github.com/suporteeligi-cpu/eligi-fron-tend/blob/main/src/types/auth.types.ts): `src/types/auth.types.ts`

### API platform

- [API client](https://github.com/suporteeligi-cpu/eligi-fron-tend/blob/main/src/lib/apiClient.ts): `src/lib/apiClient.ts`
- [Session refresh](https://github.com/suporteeligi-cpu/eligi-fron-tend/blob/main/src/lib/refreshSession.ts): `src/lib/refreshSession.ts`
- **Eligi API**

### Business operations

- [Dashboard](https://github.com/suporteeligi-cpu/eligi-fron-tend/blob/main/src/app/dashboard/page.tsx): `src/app/dashboard/page.tsx`
- [Appointment scheduling](https://github.com/suporteeligi-cpu/eligi-fron-tend/tree/main/src/features/agenda): `src/features/agenda`
- [Booking details](https://github.com/suporteeligi-cpu/eligi-fron-tend/tree/main/src/features/booking): `src/features/booking`
- [Client management](https://github.com/suporteeligi-cpu/eligi-fron-tend/tree/main/src/features/clients): `src/features/clients`
- [Service catalog](https://github.com/suporteeligi-cpu/eligi-fron-tend/tree/main/src/app/dashboard/servicos): `src/app/dashboard/servicos`
- [Team management](https://github.com/suporteeligi-cpu/eligi-fron-tend/tree/main/src/app/dashboard/equipe): `src/app/dashboard/equipe`
- [Stock management](https://github.com/suporteeligi-cpu/eligi-fron-tend/tree/main/src/features/stock): `src/features/stock`
- [Client anamnesis](https://github.com/suporteeligi-cpu/eligi-fron-tend/tree/main/src/features/anamnesis): `src/features/anamnesis`

### Finance and insights

- [Point of sale](https://github.com/suporteeligi-cpu/eligi-fron-tend/tree/main/src/app/dashboard/caixa): `src/app/dashboard/caixa`
- [Finance overview](https://github.com/suporteeligi-cpu/eligi-fron-tend/blob/main/src/features/finance-hub/useFinanceHub.ts): `src/features/finance-hub/useFinanceHub.ts`
- [Expense tracking](https://github.com/suporteeligi-cpu/eligi-fron-tend/tree/main/src/features/expenses): `src/features/expenses`
- [Reports](https://github.com/suporteeligi-cpu/eligi-fron-tend/tree/main/src/features/reports): `src/features/reports`
- [Commissions and payouts](https://github.com/suporteeligi-cpu/eligi-fron-tend/tree/main/src/features/payouts): `src/features/payouts`
- [Fiscal documents](https://github.com/suporteeligi-cpu/eligi-fron-tend/tree/main/src/features/fiscal): `src/features/fiscal`

### Business setup

- [Business profile](https://github.com/suporteeligi-cpu/eligi-fron-tend/blob/main/src/features/settings/hooks/useBusinessProfileDraft.ts): `src/features/settings/hooks/useBusinessProfileDraft.ts`
- [Business onboarding](https://github.com/suporteeligi-cpu/eligi-fron-tend/tree/main/src/app/onboarding): `src/app/onboarding`

### Other components

- **Business user**

## Connections

- Business user → Auth workflow: signs in (evidence: `src/hooks/useAuth.ts`)
- Auth workflow → Auth requests: requests auth (evidence: `src/hooks/useAuth.ts`)
- Auth requests → API client: sends requests (evidence: `src/lib/auth.api.ts`)
- Auth requests → Account types: returns account (evidence: `src/lib/auth.api.ts`)
- Auth workflow → Dashboard: routes by role (evidence: `src/hooks/useAuth.ts`)
- Auth workflow → Business onboarding: routes new businesses (evidence: `src/hooks/useAuth.ts`)
- API client → Eligi API: calls API (evidence: `src/lib/apiClient.ts`)
- API client → Session refresh: refreshes session (evidence: `src/lib/apiClient.ts`)
- Finance overview → API client: fetches finance data (evidence: `src/features/finance-hub/useFinanceHub.ts`)
- Finance overview → Reports: reads cash flow (evidence: `src/features/finance-hub/useFinanceHub.ts`)
- Finance overview → Point of sale: reads sales totals (evidence: `src/features/finance-hub/useFinanceHub.ts`)
- Finance overview → Commissions and payouts: reads payout data (evidence: `src/features/finance-hub/useFinanceHub.ts`)
- Expense tracking → API client: loads expenses (evidence: `src/features/expenses/hooks/useExpenses.ts`)
- Business profile → API client: loads profile (evidence: `src/features/settings/hooks/useBusinessProfileDraft.ts`)
- Client management → API client: loads client data
