# yvanshaw1/glow-projetoaldo architecture

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

- Interactive diagram: https://gitdiagram.com/yvanshaw1/glow-projetoaldo
- Repository: https://github.com/yvanshaw1/glow-projetoaldo

## Overview

Glow is a public and client portal plus an administrative panel for an automotive detailing business. The evidenced end-to-end workflow is account login or registration: portal forms validate input, send same-origin API requests, and authentication routes delegate to the auth service, which coordinates Supabase Auth and account records. The repository also contains authorization, administration permissions, and business-rule modules for pricing, scheduling, editing, and status transitions. Those rule modules are present in the tree, but their callers and broader business workflows were not sampled, so their connections are omitted.

Main entry points: [`src/server/services/auth.ts`](https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/server/services/auth.ts) (Auth service), [`src/server/auth/session.ts`](https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/server/auth/session.ts) (Session operations), [`src/server/supabase/clients.ts`](https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/server/supabase/clients.ts) (Supabase clients), [`src/shared/validation/auth.ts`](https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/shared/validation/auth.ts) (Auth validation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_portal["Portal experience"]
  node_login_page["Login page<br/>[page.tsx]"]
  node_register_page["Registration page<br/>[page.tsx]"]
  node_login_form["Login form<br/>[login-form.tsx]"]
  node_register_form["Registration form<br/>[register-form.tsx]"]
  node_next_param["Return navigation<br/>[next-param.ts]"]
  node_api_client["API client<br/>[api-client.ts]"]
end

subgraph group_auth_api["Authentication API"]
  node_auth_validation["Auth validation<br/>[auth.ts]"]
  node_login_route["Login endpoint<br/>[route.ts]"]
  node_register_route["Registration endpoint<br/>[route.ts]"]
  node_me_route["Session endpoint<br/>[route.ts]"]
  node_logout_route["Logout endpoint<br/>[route.ts]"]
  node_http_handler["HTTP handler<br/>[handler.ts]"]
  node_http_response["Response formatting<br/>[respond.ts]"]
end

subgraph group_auth_domain["Authentication domain"]
  node_auth_service["Auth service<br/>[auth.ts]"]
  node_auth_session["Session operations<br/>[session.ts]"]
  node_auth_accounts["Auth accounts<br/>[accounts.ts]"]
  node_login_attempts["Login throttling<br/>[login-attempts.ts]"]
  node_access_guards["Access guards<br/>[guards.ts]"]
  node_clients_repo["Client records<br/>[clients.ts]"]
  node_staff_repo["Staff records<br/>[staff.ts]"]
  node_supabase_clients["Supabase clients<br/>[clients.ts]"]
  node_permissions["Admin permissions<br/>[permissions.ts]"]
  node_profiles["Account profiles<br/>[profiles.ts]"]
end

subgraph group_platform["Business rules"]
  node_pricing_rules["Pricing rules<br/>[pricing.ts]"]
  node_scheduling_rules["Scheduling rules<br/>[scheduling.ts]"]
  node_editing_rules["Editing rules<br/>[editing.ts]"]
  node_status_rules["Status transitions"]
end

node_visitor(("Visitor or client"))
node_supabase[("Supabase Auth and PostgreSQL")]

node_visitor -->|"opens login"| node_login_page
node_visitor -->|"opens registration"| node_register_page
node_login_page -->|"renders"| node_login_form
node_register_page -->|"renders"| node_register_form
node_login_page -->|"uses navigation"| node_next_param
node_register_page -->|"uses navigation"| node_next_param
node_login_form -->|"sends requests"| node_api_client
node_register_form -->|"sends requests"| node_api_client
node_login_form -->|"validates input"| node_auth_validation
node_register_form -->|"validates input"| node_auth_validation
node_login_route -->|"wraps route"| node_http_handler
node_register_route -->|"wraps route"| node_http_handler
node_me_route -->|"wraps route"| node_http_handler
node_logout_route -->|"wraps route"| node_http_handler
node_login_route -->|"delegates login"| node_auth_service
node_register_route -->|"delegates registration"| node_auth_service
node_me_route -->|"loads session"| node_auth_service
node_logout_route -->|"delegates logout"| node_auth_service
node_login_route -->|"validates body"| node_auth_validation
node_register_route -->|"validates body"| node_auth_validation
node_auth_service -->|"manages accounts"| node_auth_accounts
node_auth_service -->|"reserves attempts"| node_login_attempts
node_auth_service -->|"manages session"| node_auth_session
node_auth_service -->|"writes client records"| node_clients_repo
node_auth_service -->|"clears staff flag"| node_staff_repo
node_auth_session -->|"loads client account"| node_clients_repo
node_auth_session -->|"loads staff account"| node_staff_repo
node_auth_session -->|"creates session client"| node_supabase_clients
node_clients_repo -->|"uses service client"| node_supabase_clients
node_staff_repo -->|"uses service client"| node_supabase_clients
node_supabase_clients -->|"connects to"| node_supabase
node_access_guards -->|"checks session"| node_auth_session
node_access_guards -->|"checks permissions"| node_permissions
node_auth_session -->|"computes permissions"| node_permissions
node_auth_session -->|"uses profile types"| node_profiles

click node_login_page "https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/app/(portal)/login/page.tsx"
click node_register_page "https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/app/(portal)/register/page.tsx"
click node_login_form "https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/components/portal/auth/login-form.tsx"
click node_register_form "https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/components/portal/auth/register-form.tsx"
click node_next_param "https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/components/portal/auth/next-param.ts"
click node_api_client "https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/lib/api-client.ts"
click node_auth_validation "https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/shared/validation/auth.ts"
click node_login_route "https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/app/api/auth/login/route.ts"
click node_register_route "https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/app/api/auth/register/route.ts"
click node_me_route "https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/app/api/auth/me/route.ts"
click node_logout_route "https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/app/api/auth/logout/route.ts"
click node_http_handler "https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/server/http/handler.ts"
click node_http_response "https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/server/http/respond.ts"
click node_auth_service "https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/server/services/auth.ts"
click node_auth_session "https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/server/auth/session.ts"
click node_auth_accounts "https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/server/auth/accounts.ts"
click node_login_attempts "https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/server/auth/login-attempts.ts"
click node_access_guards "https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/server/auth/guards.ts"
click node_clients_repo "https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/server/repositories/clients.ts"
click node_staff_repo "https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/server/repositories/staff.ts"
click node_supabase_clients "https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/server/supabase/clients.ts"
click node_permissions "https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/shared/constants/permissions.ts"
click node_profiles "https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/shared/constants/profiles.ts"
click node_pricing_rules "https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/server/rules/pricing.ts"
click node_scheduling_rules "https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/server/rules/scheduling.ts"
click node_editing_rules "https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/server/rules/editing.ts"
click node_status_rules "https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/server/rules/status-transitions.ts"

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_login_page,node_register_page,node_login_form,node_register_form,node_next_param,node_api_client,node_visitor toneBlue
class node_auth_validation,node_login_route,node_register_route,node_me_route,node_logout_route,node_http_handler,node_http_response,node_supabase toneAmber
class node_auth_service,node_auth_session,node_auth_accounts,node_login_attempts,node_access_guards,node_clients_repo,node_staff_repo,node_supabase_clients,node_permissions,node_profiles toneMint
class node_pricing_rules,node_scheduling_rules,node_editing_rules,node_status_rules toneRose
```

## Components

### Portal experience

- [Login page](https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/app/(portal)/login/page.tsx): `src/app/(portal)/login/page.tsx`
- [Registration page](https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/app/(portal)/register/page.tsx): `src/app/(portal)/register/page.tsx`
- [Login form](https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/components/portal/auth/login-form.tsx): `src/components/portal/auth/login-form.tsx`
- [Registration form](https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/components/portal/auth/register-form.tsx): `src/components/portal/auth/register-form.tsx`
- [Return navigation](https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/components/portal/auth/next-param.ts): `src/components/portal/auth/next-param.ts`
- [API client](https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/lib/api-client.ts): `src/lib/api-client.ts`

### Authentication API

- [Auth validation](https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/shared/validation/auth.ts): `src/shared/validation/auth.ts`
- [Login endpoint](https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/app/api/auth/login/route.ts): `src/app/api/auth/login/route.ts`
- [Registration endpoint](https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/app/api/auth/register/route.ts): `src/app/api/auth/register/route.ts`
- [Session endpoint](https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/app/api/auth/me/route.ts): `src/app/api/auth/me/route.ts`
- [Logout endpoint](https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/app/api/auth/logout/route.ts): `src/app/api/auth/logout/route.ts`
- [HTTP handler](https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/server/http/handler.ts): `src/server/http/handler.ts`
- [Response formatting](https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/server/http/respond.ts): `src/server/http/respond.ts`

### Authentication domain

- [Auth service](https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/server/services/auth.ts): `src/server/services/auth.ts`
- [Session operations](https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/server/auth/session.ts): `src/server/auth/session.ts`
- [Auth accounts](https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/server/auth/accounts.ts): `src/server/auth/accounts.ts`
- [Login throttling](https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/server/auth/login-attempts.ts): `src/server/auth/login-attempts.ts`
- [Access guards](https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/server/auth/guards.ts): `src/server/auth/guards.ts`
- [Client records](https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/server/repositories/clients.ts): `src/server/repositories/clients.ts`
- [Staff records](https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/server/repositories/staff.ts): `src/server/repositories/staff.ts`
- [Supabase clients](https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/server/supabase/clients.ts): `src/server/supabase/clients.ts`
- [Admin permissions](https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/shared/constants/permissions.ts): `src/shared/constants/permissions.ts`
- [Account profiles](https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/shared/constants/profiles.ts): `src/shared/constants/profiles.ts`

### Business rules

- [Pricing rules](https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/server/rules/pricing.ts): `src/server/rules/pricing.ts`
- [Scheduling rules](https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/server/rules/scheduling.ts): `src/server/rules/scheduling.ts`
- [Editing rules](https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/server/rules/editing.ts): `src/server/rules/editing.ts`
- [Status transitions](https://github.com/yvanshaw1/glow-projetoaldo/blob/main/src/server/rules/status-transitions.ts): `src/server/rules/status-transitions.ts`

### Other components

- **Visitor or client**
- **Supabase Auth and PostgreSQL**

## Connections

- Visitor or client → Login page: opens login (evidence: `README.md`)
- Visitor or client → Registration page: opens registration (evidence: `README.md`)
- Login page → Login form: renders (evidence: `src/app/(portal)/login/page.tsx`)
- Registration page → Registration form: renders (evidence: `src/app/(portal)/register/page.tsx`)
- Login page → Return navigation: uses navigation (evidence: `src/app/(portal)/login/page.tsx`)
- Registration page → Return navigation: uses navigation (evidence: `src/app/(portal)/register/page.tsx`)
- Login form → API client: sends requests (evidence: `src/components/portal/auth/login-form.tsx`)
- Registration form → API client: sends requests (evidence: `src/components/portal/auth/register-form.tsx`)
- Login form → Auth validation: validates input (evidence: `src/components/portal/auth/login-form.tsx`)
- Registration form → Auth validation: validates input (evidence: `src/components/portal/auth/register-form.tsx`)
- Login endpoint → HTTP handler: wraps route (evidence: `src/app/api/auth/login/route.ts`)
- Registration endpoint → HTTP handler: wraps route (evidence: `src/app/api/auth/register/route.ts`)
- Session endpoint → HTTP handler: wraps route (evidence: `src/app/api/auth/me/route.ts`)
- Logout endpoint → HTTP handler: wraps route (evidence: `src/app/api/auth/logout/route.ts`)
- Login endpoint → Auth service: delegates login (evidence: `src/app/api/auth/login/route.ts`)
- Registration endpoint → Auth service: delegates registration (evidence: `src/app/api/auth/register/route.ts`)
- Session endpoint → Auth service: loads session (evidence: `src/app/api/auth/me/route.ts`)
- Logout endpoint → Auth service: delegates logout (evidence: `src/app/api/auth/logout/route.ts`)
- Login endpoint → Auth validation: validates body (evidence: `src/app/api/auth/login/route.ts`)
- Registration endpoint → Auth validation: validates body (evidence: `src/app/api/auth/register/route.ts`)
- Auth service → Auth accounts: manages accounts (evidence: `src/server/services/auth.ts`)
- Auth service → Login throttling: reserves attempts (evidence: `src/server/services/auth.ts`)
- Auth service → Session operations: manages session (evidence: `src/server/services/auth.ts`)
- Auth service → Client records: writes client records (evidence: `src/server/services/auth.ts`)
- Auth service → Staff records: clears staff flag (evidence: `src/server/services/auth.ts`)
- Session operations → Client records: loads client account (evidence: `src/server/auth/session.ts`)
- Session operations → Staff records: loads staff account (evidence: `src/server/auth/session.ts`)
- Session operations → Supabase clients: creates session client (evidence: `src/server/auth/session.ts`)
- Client records → Supabase clients: uses service client (evidence: `src/server/repositories/clients.ts`)
- Staff records → Supabase clients: uses service client (evidence: `src/server/repositories/staff.ts`)
- Supabase clients → Supabase Auth and PostgreSQL: connects to (evidence: `src/server/supabase/clients.ts`)
- Access guards → Session operations: checks session (evidence: `src/server/auth/guards.ts`)
- Access guards → Admin permissions: checks permissions (evidence: `src/server/auth/guards.ts`)
- Session operations → Admin permissions: computes permissions (evidence: `src/server/auth/session.ts`)
- Session operations → Account profiles: uses profile types (evidence: `src/server/auth/session.ts`)
