# lcrisantosi7-cris/alfapet architecture

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

- Interactive diagram: https://gitdiagram.com/lcrisantosi7-cris/alfapet
- Repository: https://github.com/lcrisantosi7-cris/alfapet

## Overview

AlfaPet is a role-aware veterinary clinic management web app. Users authenticate, then use routed operational and clinical modules to record and review patients, appointments, care, inventory, sales, and reports. Server controllers enforce access and validate submissions before delegating to module repositories backed by Supabase. The README documents wider capabilities such as owner management, audit, and database-enforced scheduling safeguards; unsampled feature links are shown only where documented, while code-level edges cite available evidence.

Main entry points: [`app/routes/app-layout.tsx`](https://github.com/lcrisantosi7-cris/alfapet/blob/main/app/routes/app-layout.tsx) (Role-based shell), [`app/routes.ts`](https://github.com/lcrisantosi7-cris/alfapet/blob/main/app/routes.ts) (Route map), [`app/modules/auth`](https://github.com/lcrisantosi7-cris/alfapet/tree/main/app/modules/auth) (Sign-in and profiles), [`app/modules/pacientes`](https://github.com/lcrisantosi7-cris/alfapet/tree/main/app/modules/pacientes) (Patient records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["App and access"]
  node_route_map["Route map<br/>[routes.ts]"]
  node_auth["Sign-in and profiles"]
  node_app_layout["Role-based shell<br/>[app-layout.tsx]"]
end

subgraph group_care["Clinical care"]
  node_patients["Patient records"]
  node_consultations["Consultations"]
  node_history["Clinical history"]
  node_vaccines["Vaccinations"]
  node_surgeries["Surgery workflow"]
  node_lab["Lab orders"]
  node_admissions["Hospital admissions"]
end

subgraph group_operations["Clinic operations"]
  node_appointments["Appointments"]
  node_products["Products and stock"]
  node_sales["Sales and checkout"]
  node_admin["Users and settings"]
  node_staff_admin["Staff management"]
end

subgraph group_insights["Management insights"]
  node_dashboard["Clinic dashboard"]
  node_reports["Operational reports"]
end

subgraph group_platform["Shared services"]
  node_supabase_client["Supabase session client<br/>[client.server.ts]"]
  node_security["Request security"]
  node_theme["Theme and app frame<br/>[theme.server.ts]"]
  node_notifications["Feedback and alerts"]
end

node_staff(("Clinic users"))
node_supabase[("Supabase Auth and PostgreSQL")]

node_staff -->|"opens routes"| node_route_map
node_route_map -->|"routes sign-in"| node_auth
node_route_map -->|"mounts modules"| node_app_layout
node_staff -.->|"signs in"| node_auth
node_auth -->|"creates session"| node_supabase_client
node_supabase_client -.->|"authenticates"| node_supabase
node_app_layout -.->|"serves module"| node_patients
node_app_layout -.->|"serves module"| node_appointments
node_app_layout -.->|"serves module"| node_consultations
node_app_layout -.->|"serves module"| node_history
node_app_layout -.->|"serves module"| node_vaccines
node_app_layout -.->|"serves module"| node_surgeries
node_app_layout -.->|"serves module"| node_lab
node_app_layout -.->|"serves module"| node_admissions
node_app_layout -.->|"serves module"| node_products
node_app_layout -.->|"serves module"| node_sales
node_app_layout -.->|"serves module"| node_admin
node_app_layout -.->|"serves module"| node_staff_admin
node_app_layout -.->|"serves module"| node_dashboard
node_app_layout -.->|"serves module"| node_reports
node_patients -.->|"reads and updates"| node_supabase
node_appointments -.->|"manages schedule"| node_supabase
node_consultations -.->|"records care"| node_supabase
node_history -.->|"reads clinical history"| node_supabase
node_vaccines -.->|"records doses"| node_supabase
node_surgeries -.->|"updates workflow"| node_supabase
node_lab -.->|"updates orders"| node_supabase
node_admissions -.->|"records stays"| node_supabase
node_products -.->|"updates stock"| node_supabase
node_sales -.->|"registers sales"| node_supabase
node_admin -.->|"manages roles"| node_supabase
node_staff_admin -.->|"manages staff"| node_supabase
node_dashboard -.->|"loads indicators"| node_supabase
node_reports -.->|"queries reports"| node_supabase
node_app_layout -.->|"protects requests"| node_security
node_theme -->|"sets appearance"| node_app_layout
node_notifications -.->|"shows feedback"| node_app_layout

click node_route_map "https://github.com/lcrisantosi7-cris/alfapet/blob/main/app/routes.ts"
click node_auth "https://github.com/lcrisantosi7-cris/alfapet/tree/main/app/modules/auth"
click node_app_layout "https://github.com/lcrisantosi7-cris/alfapet/blob/main/app/routes/app-layout.tsx"
click node_patients "https://github.com/lcrisantosi7-cris/alfapet/tree/main/app/modules/pacientes"
click node_appointments "https://github.com/lcrisantosi7-cris/alfapet/tree/main/app/modules/citas"
click node_consultations "https://github.com/lcrisantosi7-cris/alfapet/tree/main/app/modules/consultas"
click node_history "https://github.com/lcrisantosi7-cris/alfapet/tree/main/app/modules/historial"
click node_vaccines "https://github.com/lcrisantosi7-cris/alfapet/tree/main/app/modules/vacunas"
click node_surgeries "https://github.com/lcrisantosi7-cris/alfapet/tree/main/app/modules/cirugias"
click node_lab "https://github.com/lcrisantosi7-cris/alfapet/tree/main/app/modules/analisis"
click node_admissions "https://github.com/lcrisantosi7-cris/alfapet/tree/main/app/modules/internamiento"
click node_products "https://github.com/lcrisantosi7-cris/alfapet/tree/main/app/modules/productos"
click node_sales "https://github.com/lcrisantosi7-cris/alfapet/tree/main/app/modules/ventas"
click node_admin "https://github.com/lcrisantosi7-cris/alfapet/tree/main/app/modules/admin"
click node_staff_admin "https://github.com/lcrisantosi7-cris/alfapet/tree/main/app/modules/personal"
click node_dashboard "https://github.com/lcrisantosi7-cris/alfapet/tree/main/app/modules/dashboard"
click node_reports "https://github.com/lcrisantosi7-cris/alfapet/tree/main/app/modules/reportes"
click node_supabase_client "https://github.com/lcrisantosi7-cris/alfapet/blob/main/app/core/supabase/client.server.ts"
click node_security "https://github.com/lcrisantosi7-cris/alfapet/tree/main/app/core/security"
click node_theme "https://github.com/lcrisantosi7-cris/alfapet/blob/main/app/core/theme/theme.server.ts"
click node_notifications "https://github.com/lcrisantosi7-cris/alfapet/tree/main/app/core/feedback"

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_route_map,node_auth,node_app_layout,node_staff toneBlue
class node_patients,node_consultations,node_history,node_vaccines,node_surgeries,node_lab,node_admissions,node_supabase toneAmber
class node_appointments,node_products,node_sales,node_admin,node_staff_admin toneMint
class node_dashboard,node_reports toneRose
class node_supabase_client,node_security,node_theme,node_notifications toneIndigo
```

## Components

### App and access

- [Route map](https://github.com/lcrisantosi7-cris/alfapet/blob/main/app/routes.ts): `app/routes.ts`
- [Sign-in and profiles](https://github.com/lcrisantosi7-cris/alfapet/tree/main/app/modules/auth): `app/modules/auth`
- [Role-based shell](https://github.com/lcrisantosi7-cris/alfapet/blob/main/app/routes/app-layout.tsx): `app/routes/app-layout.tsx`

### Clinical care

- [Patient records](https://github.com/lcrisantosi7-cris/alfapet/tree/main/app/modules/pacientes): `app/modules/pacientes`
- [Consultations](https://github.com/lcrisantosi7-cris/alfapet/tree/main/app/modules/consultas): `app/modules/consultas`
- [Clinical history](https://github.com/lcrisantosi7-cris/alfapet/tree/main/app/modules/historial): `app/modules/historial`
- [Vaccinations](https://github.com/lcrisantosi7-cris/alfapet/tree/main/app/modules/vacunas): `app/modules/vacunas`
- [Surgery workflow](https://github.com/lcrisantosi7-cris/alfapet/tree/main/app/modules/cirugias): `app/modules/cirugias`
- [Lab orders](https://github.com/lcrisantosi7-cris/alfapet/tree/main/app/modules/analisis): `app/modules/analisis`
- [Hospital admissions](https://github.com/lcrisantosi7-cris/alfapet/tree/main/app/modules/internamiento): `app/modules/internamiento`

### Clinic operations

- [Appointments](https://github.com/lcrisantosi7-cris/alfapet/tree/main/app/modules/citas): `app/modules/citas`
- [Products and stock](https://github.com/lcrisantosi7-cris/alfapet/tree/main/app/modules/productos): `app/modules/productos`
- [Sales and checkout](https://github.com/lcrisantosi7-cris/alfapet/tree/main/app/modules/ventas): `app/modules/ventas`
- [Users and settings](https://github.com/lcrisantosi7-cris/alfapet/tree/main/app/modules/admin): `app/modules/admin`
- [Staff management](https://github.com/lcrisantosi7-cris/alfapet/tree/main/app/modules/personal): `app/modules/personal`

### Management insights

- [Clinic dashboard](https://github.com/lcrisantosi7-cris/alfapet/tree/main/app/modules/dashboard): `app/modules/dashboard`
- [Operational reports](https://github.com/lcrisantosi7-cris/alfapet/tree/main/app/modules/reportes): `app/modules/reportes`

### Shared services

- [Supabase session client](https://github.com/lcrisantosi7-cris/alfapet/blob/main/app/core/supabase/client.server.ts): `app/core/supabase/client.server.ts`
- [Request security](https://github.com/lcrisantosi7-cris/alfapet/tree/main/app/core/security): `app/core/security`
- [Theme and app frame](https://github.com/lcrisantosi7-cris/alfapet/blob/main/app/core/theme/theme.server.ts): `app/core/theme/theme.server.ts`
- [Feedback and alerts](https://github.com/lcrisantosi7-cris/alfapet/tree/main/app/core/feedback): `app/core/feedback`

### Other components

- **Clinic users**
- **Supabase Auth and PostgreSQL**

## Connections

- Clinic users → Route map: opens routes (evidence: `app/routes.ts`)
- Route map → Sign-in and profiles: routes sign-in (evidence: `app/routes.ts`)
- Route map → Role-based shell: mounts modules (evidence: `app/routes.ts`)
- Clinic users → Sign-in and profiles: signs in
- Sign-in and profiles → Supabase session client: creates session (evidence: `app/modules/auth/controller/login.controller.server.ts`)
- Supabase session client → Supabase Auth and PostgreSQL: authenticates
- Role-based shell → Patient records: serves module
- Role-based shell → Appointments: serves module
- Role-based shell → Consultations: serves module
- Role-based shell → Clinical history: serves module
- Role-based shell → Vaccinations: serves module
- Role-based shell → Surgery workflow: serves module
- Role-based shell → Lab orders: serves module
- Role-based shell → Hospital admissions: serves module
- Role-based shell → Products and stock: serves module
- Role-based shell → Sales and checkout: serves module
- Role-based shell → Users and settings: serves module
- Role-based shell → Staff management: serves module
- Role-based shell → Clinic dashboard: serves module
- Role-based shell → Operational reports: serves module
- Patient records → Supabase Auth and PostgreSQL: reads and updates (evidence: `app/modules/pacientes/controller/patient-detail.controller.server.ts`)
- Appointments → Supabase Auth and PostgreSQL: manages schedule
- Consultations → Supabase Auth and PostgreSQL: records care
- Clinical history → Supabase Auth and PostgreSQL: reads clinical history
- Vaccinations → Supabase Auth and PostgreSQL: records doses (evidence: `app/modules/vacunas/controller/vacunas.controller.server.ts`)
- Surgery workflow → Supabase Auth and PostgreSQL: updates workflow (evidence: `app/modules/cirugias/controller/surgery-detail.controller.server.ts`)
- Lab orders → Supabase Auth and PostgreSQL: updates orders (evidence: `app/modules/analisis/controller/lab-order-detail.controller.server.ts`)
- Hospital admissions → Supabase Auth and PostgreSQL: records stays (evidence: `app/modules/internamiento/controller/admission-detail.controller.server.ts`)
- Products and stock → Supabase Auth and PostgreSQL: updates stock (evidence: `app/modules/productos/controller/producto-detail.controller.server.ts`)
- Sales and checkout → Supabase Auth and PostgreSQL: registers sales (evidence: `app/modules/ventas/controller/ventas.controller.server.ts`)
- Users and settings → Supabase Auth and PostgreSQL: manages roles
- Staff management → Supabase Auth and PostgreSQL: manages staff
- Clinic dashboard → Supabase Auth and PostgreSQL: loads indicators (evidence: `app/modules/dashboard/controller/dashboard.controller.server.ts`)
- Operational reports → Supabase Auth and PostgreSQL: queries reports
- Role-based shell → Request security: protects requests
- Theme and app frame → Role-based shell: sets appearance
- Feedback and alerts → Role-based shell: shows feedback (evidence: `app/core/feedback/ToastViewport.tsx`)
