# emiliofex20/clinica-del-auto architecture

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

- Interactive diagram: https://gitdiagram.com/emiliofex20/clinica-del-auto
- Repository: https://github.com/emiliofex20/clinica-del-auto

## Overview

Clínica del Auto is a vehicle inspection and delivery application for technicians and administrators. The principal workflow is to sign in, create an inspection with customer and vehicle details, record checklist answers and observations, attach vehicle photos, and then review or edit inspection records; administrators can also delete them. Supabase provides authentication, database, and photo storage. The graph reflects sampled source and tree-supported features; unsampled action and route internals limit some wiring detail.

Main entry points: [`app/inspections/actions.ts`](https://github.com/emiliofex20/clinica-del-auto/blob/main/app/inspections/actions.ts) (Inspection actions), [`lib/supabase/server.ts`](https://github.com/emiliofex20/clinica-del-auto/blob/main/lib/supabase/server.ts) (Server Supabase client), [`app/inspections/page.tsx`](https://github.com/emiliofex20/clinica-del-auto/blob/main/app/inspections/page.tsx) (Inspection list), [`app/inspections/new/new-inspection-form.tsx`](https://github.com/emiliofex20/clinica-del-auto/blob/main/app/inspections/new/new-inspection-form.tsx) (Inspection form)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and navigation"]
  node_login["Sign in<br/>[page.tsx]"]
  node_login_actions["Login actions<br/>[actions.ts]"]
end

subgraph group_inspection["Inspection workflow"]
  node_inspection_list["Inspection list<br/>[page.tsx]"]
  node_new_page["New inspection page<br/>[page.tsx]"]
  node_new_form["Inspection form"]
  node_actions["Inspection actions<br/>[actions.ts]"]
  node_edit_page["Edit inspection<br/>[page.tsx]"]
end

subgraph group_admin["Administration"]
  node_admin_list["Admin inspections<br/>[page.tsx]"]
  node_delete_button["Delete control"]
end

subgraph group_platform["Data and offline"]
  node_server_client["Server Supabase client<br/>[server.ts]"]
  node_browser_client["Browser Supabase client<br/>[client.ts]"]
  node_supabase_auth["Supabase auth"]
  node_supabase_db[("Supabase database")]
  node_photo_storage[("Photo storage")]
  node_root_layout["Application layout<br/>[layout.tsx]"]
  node_pwa_register["PWA registration<br/>[PWARegister.tsx]"]
  node_service_worker["Service worker<br/>[sw.js]"]
  node_cache[("Asset cache")]
end

node_staff(("Staff user"))

node_staff -->|"opens"| node_login
node_login -->|"submits credentials"| node_login_actions
node_login_actions -->|"creates client"| node_server_client
node_server_client -->|"authenticates"| node_supabase_auth
node_staff -->|"opens records"| node_inspection_list
node_inspection_list -->|"creates client"| node_server_client
node_inspection_list -->|"reads profiles and inspections"| node_supabase_db
node_inspection_list -->|"opens creation"| node_new_page
node_new_page -->|"renders form"| node_new_form
node_staff -->|"enters inspection"| node_new_form
node_new_form -->|"creates client"| node_browser_client
node_new_form -->|"uploads photos"| node_photo_storage
node_new_form -->|"submits form"| node_actions
node_actions -->|"creates client"| node_server_client
node_actions -->|"checks user"| node_supabase_auth
node_actions -->|"checks permissions and writes records"| node_supabase_db
node_inspection_list -->|"opens edit"| node_edit_page
node_edit_page -->|"creates client"| node_server_client
node_edit_page -->|"reads inspection and checklist"| node_supabase_db
node_edit_page -->|"binds update action"| node_actions
node_staff -->|"opens admin records"| node_admin_list
node_admin_list -->|"creates client"| node_server_client
node_admin_list -->|"checks role and reads inspections"| node_supabase_db
node_admin_list -->|"renders delete control"| node_delete_button
node_delete_button -->|"submits deletion"| node_actions
node_actions -->|"checks admin and deletes inspection"| node_supabase_db
node_root_layout -->|"renders"| node_pwa_register
node_pwa_register -->|"registers"| node_service_worker
node_service_worker -->|"caches assets"| node_cache

click node_login "https://github.com/emiliofex20/clinica-del-auto/blob/main/app/login/page.tsx"
click node_login_actions "https://github.com/emiliofex20/clinica-del-auto/blob/main/app/login/actions.ts"
click node_inspection_list "https://github.com/emiliofex20/clinica-del-auto/blob/main/app/inspections/page.tsx"
click node_new_page "https://github.com/emiliofex20/clinica-del-auto/blob/main/app/inspections/new/page.tsx"
click node_new_form "https://github.com/emiliofex20/clinica-del-auto/blob/main/app/inspections/new/new-inspection-form.tsx"
click node_actions "https://github.com/emiliofex20/clinica-del-auto/blob/main/app/inspections/actions.ts"
click node_edit_page "https://github.com/emiliofex20/clinica-del-auto/blob/main/app/inspections/%5Bid%5D/edit/page.tsx"
click node_admin_list "https://github.com/emiliofex20/clinica-del-auto/blob/main/app/admin/inspections/page.tsx"
click node_delete_button "https://github.com/emiliofex20/clinica-del-auto/blob/main/app/admin/inspections/DeleteInspectionButton.tsx"
click node_server_client "https://github.com/emiliofex20/clinica-del-auto/blob/main/lib/supabase/server.ts"
click node_browser_client "https://github.com/emiliofex20/clinica-del-auto/blob/main/lib/supabase/client.ts"
click node_root_layout "https://github.com/emiliofex20/clinica-del-auto/blob/main/app/layout.tsx"
click node_pwa_register "https://github.com/emiliofex20/clinica-del-auto/blob/main/components/PWARegister.tsx"
click node_service_worker "https://github.com/emiliofex20/clinica-del-auto/blob/main/public/sw.js"

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,node_login_actions,node_staff toneBlue
class node_inspection_list,node_new_page,node_new_form,node_actions,node_edit_page toneAmber
class node_admin_list,node_delete_button toneMint
class node_server_client,node_browser_client,node_supabase_auth,node_supabase_db,node_photo_storage,node_root_layout,node_pwa_register,node_service_worker,node_cache toneRose
```

## Components

### Access and navigation

- [Sign in](https://github.com/emiliofex20/clinica-del-auto/blob/main/app/login/page.tsx): `app/login/page.tsx`
- [Login actions](https://github.com/emiliofex20/clinica-del-auto/blob/main/app/login/actions.ts): `app/login/actions.ts`

### Inspection workflow

- [Inspection list](https://github.com/emiliofex20/clinica-del-auto/blob/main/app/inspections/page.tsx): `app/inspections/page.tsx`
- [New inspection page](https://github.com/emiliofex20/clinica-del-auto/blob/main/app/inspections/new/page.tsx): `app/inspections/new/page.tsx`
- [Inspection form](https://github.com/emiliofex20/clinica-del-auto/blob/main/app/inspections/new/new-inspection-form.tsx): `app/inspections/new/new-inspection-form.tsx`
- [Inspection actions](https://github.com/emiliofex20/clinica-del-auto/blob/main/app/inspections/actions.ts): `app/inspections/actions.ts`
- [Edit inspection](https://github.com/emiliofex20/clinica-del-auto/blob/main/app/inspections/%5Bid%5D/edit/page.tsx): `app/inspections/[id]/edit/page.tsx`

### Administration

- [Admin inspections](https://github.com/emiliofex20/clinica-del-auto/blob/main/app/admin/inspections/page.tsx): `app/admin/inspections/page.tsx`
- [Delete control](https://github.com/emiliofex20/clinica-del-auto/blob/main/app/admin/inspections/DeleteInspectionButton.tsx): `app/admin/inspections/DeleteInspectionButton.tsx`

### Data and offline

- [Server Supabase client](https://github.com/emiliofex20/clinica-del-auto/blob/main/lib/supabase/server.ts): `lib/supabase/server.ts`
- [Browser Supabase client](https://github.com/emiliofex20/clinica-del-auto/blob/main/lib/supabase/client.ts): `lib/supabase/client.ts`
- **Supabase auth**
- **Supabase database**
- **Photo storage**
- [Application layout](https://github.com/emiliofex20/clinica-del-auto/blob/main/app/layout.tsx): `app/layout.tsx`
- [PWA registration](https://github.com/emiliofex20/clinica-del-auto/blob/main/components/PWARegister.tsx): `components/PWARegister.tsx`
- [Service worker](https://github.com/emiliofex20/clinica-del-auto/blob/main/public/sw.js): `public/sw.js`
- **Asset cache**

### Other components

- **Staff user**

## Connections

- Staff user → Sign in: opens
- Sign in → Login actions: submits credentials
- Login actions → Server Supabase client: creates client
- Server Supabase client → Supabase auth: authenticates
- Staff user → Inspection list: opens records
- Inspection list → Server Supabase client: creates client
- Inspection list → Supabase database: reads profiles and inspections
- Inspection list → New inspection page: opens creation
- New inspection page → Inspection form: renders form
- Staff user → Inspection form: enters inspection
- Inspection form → Browser Supabase client: creates client
- Inspection form → Photo storage: uploads photos
- Inspection form → Inspection actions: submits form
- Inspection actions → Server Supabase client: creates client
- Inspection actions → Supabase auth: checks user
- Inspection actions → Supabase database: checks permissions and writes records
- Inspection list → Edit inspection: opens edit
- Edit inspection → Server Supabase client: creates client
- Edit inspection → Supabase database: reads inspection and checklist
- Edit inspection → Inspection actions: binds update action
- Staff user → Admin inspections: opens admin records
- Admin inspections → Server Supabase client: creates client
- Admin inspections → Supabase database: checks role and reads inspections
- Admin inspections → Delete control: renders delete control
- Delete control → Inspection actions: submits deletion
- Inspection actions → Supabase database: checks admin and deletes inspection
- Application layout → PWA registration: renders
- PWA registration → Service worker: registers
- Service worker → Asset cache: caches assets
