# foxmaciel123/nina-para-est-tica-e-beleza architecture

> Architecture diagram of the GitHub repository foxmaciel123/nina-para-est-tica-e-beleza, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/foxmaciel123/nina-para-est-tica-e-beleza
- Repository: https://github.com/foxmaciel123/nina-para-est-tica-e-beleza

## Overview

Nina Beleza is a SaaS platform for AI-assisted customer service, lead qualification, and appointment scheduling for beauty and aesthetics businesses. A clinic user signs in, configures the clinic and assistant, handles WhatsApp conversations, and manages contacts, pipeline deals, appointments, and orders. The README also describes clinic-specific onboarding and pipeline stages. The frontend and Supabase integration are evidenced in source references; several backend capabilities are represented from the repository tree, so their runtime connections are left unverified.

Main entry points: [`src/App.tsx`](https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/App.tsx) (Application routes), [`src/integrations/supabase/client.ts`](https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/integrations/supabase/client.ts) (Supabase client), [`supabase/functions/nina-orchestrator/index.ts`](https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/supabase/functions/nina-orchestrator/index.ts) (Nina orchestrator), [`src/pages/Auth.tsx`](https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/pages/Auth.tsx) (Sign-in)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Web experience"]
  node_app["Application routes<br/>[App.tsx]"]
  node_auth_page["Sign-in<br/>[Auth.tsx]"]
  node_auth["Authentication state<br/>[useAuth.tsx]"]
  node_brand["Brand context<br/>[useBrand.tsx]"]
  node_button["Button component<br/>[Button.tsx]"]
  node_dialog["Dialog primitive<br/>[dialog.tsx]"]
  node_input["Input primitive<br/>[input.tsx]"]
  node_label["Label primitive<br/>[label.tsx]"]
end

subgraph group_clinic["Clinic workflow"]
  node_chat["Conversation inbox<br/>[ChatInterface.tsx]"]
  node_conversations["Conversation state"]
  node_contacts["Contacts<br/>[Contacts.tsx]"]
  node_pipeline["Deal pipeline<br/>[Kanban.tsx]"]
  node_scheduling["Appointments<br/>[Scheduling.tsx]"]
  node_orders["Orders<br/>[Orders.tsx]"]
  node_team["Team<br/>[Team.tsx]"]
  node_clinic_settings["Clinic settings<br/>[Settings.tsx]"]
  node_procedures["Procedure catalog"]
  node_onboarding["Clinic onboarding"]
  node_dashboard["Clinic dashboard<br/>[Dashboard.tsx]"]
  node_niche["Niche registry<br/>[registry.ts]"]
  node_niche_hook["Niche selection<br/>[useNiche.ts]"]
  node_company_settings["Clinic settings state"]
  node_api["Application data API<br/>[api.ts]"]
end

subgraph group_platform["Platform administration"]
  node_supabase_client["Supabase client<br/>[client.ts]"]
  node_supabase[("Supabase services")]
  node_owner["Owner administration"]
  node_agency["Agency dashboard"]
end

subgraph group_backend["AI and messaging"]
  node_whatsapp["WhatsApp integration<br/>[index.ts]"]
  node_orchestrator["Nina orchestrator<br/>[index.ts]"]
  node_ai_shared["AI helpers<br/>[ai.ts]"]
  node_shared_niches["Backend niche rules<br/>[niches.ts]"]
  node_campaigns["Campaign dispatch<br/>[Disparo.tsx]"]
  node_followup["Follow-up sequences<br/>[FollowUp.tsx]"]
end

node_user(("Clinic user"))

node_user -->|"signs in"| node_auth_page
node_auth_page -->|"uses auth"| node_auth
node_auth -->|"authenticates through"| node_supabase_client
node_app -->|"routes to"| node_auth_page
node_app -->|"routes to"| node_chat
node_app -->|"routes to"| node_contacts
node_app -->|"routes to"| node_pipeline
node_app -->|"routes to"| node_scheduling
node_app -->|"routes to"| node_orders
node_app -->|"routes to"| node_team
node_app -->|"routes to"| node_clinic_settings
node_app -->|"renders"| node_onboarding
node_app -->|"routes to"| node_owner
node_chat -->|"uses state"| node_conversations
node_conversations -->|"fetches and updates"| node_api
node_contacts -->|"reads data"| node_api
node_orders -->|"queries"| node_supabase_client
node_api -->|"queries and writes"| node_supabase_client
node_supabase_client -.->|"connects to"| node_supabase
node_clinic_settings -.->|"includes catalog"| node_procedures
node_procedures -->|"selects niche"| node_niche_hook
node_niche_hook -->|"uses registry"| node_niche
node_app -->|"provides context"| node_company_settings
node_company_settings -->|"loads settings"| node_supabase_client
node_app -->|"provides context"| node_brand
node_brand -.->|"loads brand data"| node_supabase_client
node_owner -->|"uses data service"| node_supabase_client
node_app -.->|"routes to"| node_agency
node_user -.->|"messages clinic"| node_whatsapp
node_whatsapp -.->|"invokes assistant"| node_orchestrator
node_orchestrator -->|"uses AI helpers"| node_ai_shared
node_orchestrator -->|"loads niche rules"| node_shared_niches
node_user -.->|"manages outreach"| node_campaigns
node_user -.->|"manages sequences"| node_followup

click node_app "https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/App.tsx"
click node_auth_page "https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/pages/Auth.tsx"
click node_auth "https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/hooks/useAuth.tsx"
click node_brand "https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/hooks/useBrand.tsx"
click node_button "https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/components/Button.tsx"
click node_dialog "https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/components/ui/dialog.tsx"
click node_input "https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/components/ui/input.tsx"
click node_label "https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/components/ui/label.tsx"
click node_chat "https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/components/ChatInterface.tsx"
click node_conversations "https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/hooks/useConversations.ts"
click node_contacts "https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/components/Contacts.tsx"
click node_pipeline "https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/components/Kanban.tsx"
click node_scheduling "https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/components/Scheduling.tsx"
click node_orders "https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/components/orders/Orders.tsx"
click node_team "https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/components/Team.tsx"
click node_clinic_settings "https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/components/Settings.tsx"
click node_procedures "https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/components/settings/ProceduresManager.tsx"
click node_onboarding "https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/components/OnboardingWizard.tsx"
click node_dashboard "https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/components/Dashboard.tsx"
click node_niche "https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/niches/registry.ts"
click node_niche_hook "https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/hooks/useNiche.ts"
click node_company_settings "https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/hooks/useCompanySettings.tsx"
click node_api "https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/services/api.ts"
click node_supabase_client "https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/integrations/supabase/client.ts"
click node_owner "https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/tree/main/src/components/owner"
click node_agency "https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/tree/main/src/components/agency"
click node_whatsapp "https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/supabase/functions/whatsapp-webhook/index.ts"
click node_orchestrator "https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/supabase/functions/nina-orchestrator/index.ts"
click node_ai_shared "https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/supabase/functions/_shared/ai.ts"
click node_shared_niches "https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/supabase/functions/_shared/niches.ts"
click node_campaigns "https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/components/disparo/Disparo.tsx"
click node_followup "https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/components/followup/FollowUp.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_app,node_auth_page,node_auth,node_brand,node_button,node_dialog,node_input,node_label,node_user toneBlue
class node_chat,node_conversations,node_contacts,node_pipeline,node_scheduling,node_orders,node_team,node_clinic_settings,node_procedures,node_onboarding,node_dashboard,node_niche,node_niche_hook,node_company_settings,node_api toneAmber
class node_supabase_client,node_supabase,node_owner,node_agency toneMint
class node_whatsapp,node_orchestrator,node_ai_shared,node_shared_niches,node_campaigns,node_followup toneRose
```

## Components

### Web experience

- [Application routes](https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/App.tsx): `src/App.tsx`
- [Sign-in](https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/pages/Auth.tsx): `src/pages/Auth.tsx`
- [Authentication state](https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/hooks/useAuth.tsx): `src/hooks/useAuth.tsx`
- [Brand context](https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/hooks/useBrand.tsx): `src/hooks/useBrand.tsx`
- [Button component](https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/components/Button.tsx): `src/components/Button.tsx`
- [Dialog primitive](https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/components/ui/dialog.tsx): `src/components/ui/dialog.tsx`
- [Input primitive](https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/components/ui/input.tsx): `src/components/ui/input.tsx`
- [Label primitive](https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/components/ui/label.tsx): `src/components/ui/label.tsx`

### Clinic workflow

- [Conversation inbox](https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/components/ChatInterface.tsx): `src/components/ChatInterface.tsx`
- [Conversation state](https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/hooks/useConversations.ts): `src/hooks/useConversations.ts`
- [Contacts](https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/components/Contacts.tsx): `src/components/Contacts.tsx`
- [Deal pipeline](https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/components/Kanban.tsx): `src/components/Kanban.tsx`
- [Appointments](https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/components/Scheduling.tsx): `src/components/Scheduling.tsx`
- [Orders](https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/components/orders/Orders.tsx): `src/components/orders/Orders.tsx`
- [Team](https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/components/Team.tsx): `src/components/Team.tsx`
- [Clinic settings](https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/components/Settings.tsx): `src/components/Settings.tsx`
- [Procedure catalog](https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/components/settings/ProceduresManager.tsx): `src/components/settings/ProceduresManager.tsx`
- [Clinic onboarding](https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/components/OnboardingWizard.tsx): `src/components/OnboardingWizard.tsx`
- [Clinic dashboard](https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/components/Dashboard.tsx): `src/components/Dashboard.tsx`
- [Niche registry](https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/niches/registry.ts): `src/niches/registry.ts`
- [Niche selection](https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/hooks/useNiche.ts): `src/hooks/useNiche.ts`
- [Clinic settings state](https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/hooks/useCompanySettings.tsx): `src/hooks/useCompanySettings.tsx`
- [Application data API](https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/services/api.ts): `src/services/api.ts`

### Platform administration

- [Supabase client](https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/integrations/supabase/client.ts): `src/integrations/supabase/client.ts`
- **Supabase services**
- [Owner administration](https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/tree/main/src/components/owner): `src/components/owner`
- [Agency dashboard](https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/tree/main/src/components/agency): `src/components/agency`

### AI and messaging

- [WhatsApp integration](https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/supabase/functions/whatsapp-webhook/index.ts): `supabase/functions/whatsapp-webhook/index.ts`
- [Nina orchestrator](https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/supabase/functions/nina-orchestrator/index.ts): `supabase/functions/nina-orchestrator/index.ts`
- [AI helpers](https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/supabase/functions/_shared/ai.ts): `supabase/functions/_shared/ai.ts`
- [Backend niche rules](https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/supabase/functions/_shared/niches.ts): `supabase/functions/_shared/niches.ts`
- [Campaign dispatch](https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/components/disparo/Disparo.tsx): `src/components/disparo/Disparo.tsx`
- [Follow-up sequences](https://github.com/foxmaciel123/nina-para-est-tica-e-beleza/blob/main/src/components/followup/FollowUp.tsx): `src/components/followup/FollowUp.tsx`

### Other components

- **Clinic user**

## Connections

- Clinic user → Sign-in: signs in (evidence: `src/pages/Auth.tsx`)
- Sign-in → Authentication state: uses auth (evidence: `src/pages/Auth.tsx`)
- Authentication state → Supabase client: authenticates through (evidence: `src/hooks/useAuth.tsx`)
- Application routes → Sign-in: routes to (evidence: `src/App.tsx`)
- Application routes → Conversation inbox: routes to (evidence: `src/App.tsx`)
- Application routes → Contacts: routes to (evidence: `src/App.tsx`)
- Application routes → Deal pipeline: routes to (evidence: `src/App.tsx`)
- Application routes → Appointments: routes to (evidence: `src/App.tsx`)
- Application routes → Orders: routes to (evidence: `src/App.tsx`)
- Application routes → Team: routes to (evidence: `src/App.tsx`)
- Application routes → Clinic settings: routes to (evidence: `src/App.tsx`)
- Application routes → Clinic onboarding: renders (evidence: `src/App.tsx`)
- Application routes → Owner administration: routes to (evidence: `src/App.tsx`)
- Conversation inbox → Conversation state: uses state (evidence: `src/components/ChatInterface.tsx`)
- Conversation state → Application data API: fetches and updates (evidence: `src/hooks/useConversations.ts`)
- Contacts → Application data API: reads data (evidence: `src/components/Contacts.tsx`)
- Orders → Supabase client: queries (evidence: `src/components/orders/Orders.tsx`)
- Application data API → Supabase client: queries and writes (evidence: `src/services/api.ts`)
- Supabase client → Supabase services: connects to (evidence: `src/integrations/supabase/client.ts`)
- Clinic settings → Procedure catalog: includes catalog
- Procedure catalog → Niche selection: selects niche (evidence: `src/components/settings/ProceduresManager.tsx`)
- Niche selection → Niche registry: uses registry (evidence: `src/components/settings/ProceduresManager.tsx`)
- Application routes → Clinic settings state: provides context (evidence: `src/App.tsx`)
- Clinic settings state → Supabase client: loads settings (evidence: `src/hooks/useCompanySettings.tsx`)
- Application routes → Brand context: provides context (evidence: `src/App.tsx`)
- Brand context → Supabase client: loads brand data
- Owner administration → Supabase client: uses data service (evidence: `src/components/owner/OwnerAgencies.tsx`)
- Application routes → Agency dashboard: routes to (evidence: `src/App.tsx`)
- Clinic user → WhatsApp integration: messages clinic
- WhatsApp integration → Nina orchestrator: invokes assistant
- Nina orchestrator → AI helpers: uses AI helpers (evidence: `supabase/functions/nina-orchestrator/index.ts`)
- Nina orchestrator → Backend niche rules: loads niche rules (evidence: `supabase/functions/nina-orchestrator/index.ts`)
- Clinic user → Campaign dispatch: manages outreach
- Clinic user → Follow-up sequences: manages sequences
