# kaynarocha/petvet architecture

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

- Interactive diagram: https://gitdiagram.com/kaynarocha/petvet
- Repository: https://github.com/kaynarocha/petvet

## Overview

PetVet is a browser-based veterinary practice management frontend. A user signs in, the login flow authenticates and loads the current user, then the system exposes dashboard and CRUD areas for appointments, companies, pets, services, tutors, and users. The sampled code shows shared API authentication state and form-to-service calls; the README gives no further product detail. Backend implementation and most domain services were not sampled, so their internal behavior and links are left unspecified.

Main entry points: [`front/app/services/api.ts`](https://github.com/kaynarocha/petvet/blob/main/front/app/services/api.ts) (HTTP API client), [`front/app/login/page.tsx`](https://github.com/kaynarocha/petvet/blob/main/front/app/login/page.tsx) (Login screen), [`front/app/(sistema)/usuarios/components/UsuarioForm.tsx`](https://github.com/kaynarocha/petvet/blob/main/front/app/(sistema)/usuarios/components/UsuarioForm.tsx) (User form), [`front/app/services/usuarioService.ts`](https://github.com/kaynarocha/petvet/blob/main/front/app/services/usuarioService.ts) (User service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and session"]
  node_login["Login screen<br/>[page.tsx]"]
  node_authservice["Authentication service<br/>[authService.ts]"]
  node_authstate["Auth state<br/>[authSlice.ts]"]
  node_store["Redux store<br/>[store.ts]"]
end

subgraph group_operations["Practice operations"]
  node_dashboard["Dashboard<br/>[page.tsx]"]
  node_appointments["Appointments"]
  node_appointmentform["Appointment form"]
  node_pets["Pets"]
  node_petform["Pet form<br/>[PetForm.tsx]"]
end

subgraph group_records["Business records"]
  node_userservice["User service<br/>[usuarioService.ts]"]
  node_companies["Companies"]
  node_companyform["Company form<br/>[EmpresaForm.tsx]"]
  node_services["Services"]
  node_serviceform["Service form<br/>[ServicoForm.tsx]"]
  node_tutors["Tutors"]
  node_tutorform["Tutor form<br/>[TutorForm.tsx]"]
  node_cep["Address lookup<br/>[enderecoService.ts]"]
  node_userpages["User management"]
  node_userform["User form<br/>[UsuarioForm.tsx]"]
  node_companyservice["Company service<br/>[empresaService.ts]"]
end

subgraph group_transport["API transport"]
  node_api["HTTP API client<br/>[api.ts]"]
end

node_user(("User"))
node_backend{{"Backend API"}}

node_user -->|"signs in"| node_login
node_login -->|"requests login"| node_authservice
node_login -->|"loads user"| node_userservice
node_login -->|"dispatches login"| node_authstate
node_authservice -->|"posts credentials"| node_api
node_userservice -->|"sends requests"| node_api
node_api -->|"sends HTTP"| node_backend
node_api -->|"reads token"| node_store
node_api -->|"dispatches logout"| node_authstate
node_user -.->|"opens system"| node_dashboard
node_appointments -->|"renders form"| node_appointmentform
node_companies -->|"renders form"| node_companyform
node_services -->|"renders form"| node_serviceform
node_userpages -->|"renders form"| node_userform
node_userform -->|"saves user"| node_userservice
node_userform -->|"loads companies"| node_companyservice
node_tutorform -->|"looks up address"| node_cep

click node_login "https://github.com/kaynarocha/petvet/blob/main/front/app/login/page.tsx"
click node_authservice "https://github.com/kaynarocha/petvet/blob/main/front/app/services/authService.ts"
click node_authstate "https://github.com/kaynarocha/petvet/blob/main/front/app/redux/slices/authSlice.ts"
click node_userservice "https://github.com/kaynarocha/petvet/blob/main/front/app/services/usuarioService.ts"
click node_dashboard "https://github.com/kaynarocha/petvet/blob/main/front/app/(sistema)/home/page.tsx"
click node_appointments "https://github.com/kaynarocha/petvet/tree/main/front/app/(sistema)/agendamentos"
click node_appointmentform "https://github.com/kaynarocha/petvet/blob/main/front/app/(sistema)/agendamentos/components/AgendamentoForm.tsx"
click node_companies "https://github.com/kaynarocha/petvet/tree/main/front/app/(sistema)/empresas"
click node_companyform "https://github.com/kaynarocha/petvet/blob/main/front/app/(sistema)/empresas/components/EmpresaForm.tsx"
click node_pets "https://github.com/kaynarocha/petvet/tree/main/front/app/(sistema)/pets"
click node_petform "https://github.com/kaynarocha/petvet/blob/main/front/app/(sistema)/pets/components/PetForm.tsx"
click node_services "https://github.com/kaynarocha/petvet/tree/main/front/app/(sistema)/servicos"
click node_serviceform "https://github.com/kaynarocha/petvet/blob/main/front/app/(sistema)/servicos/components/ServicoForm.tsx"
click node_tutors "https://github.com/kaynarocha/petvet/tree/main/front/app/(sistema)/tutores"
click node_tutorform "https://github.com/kaynarocha/petvet/blob/main/front/app/(sistema)/tutores/components/TutorForm.tsx"
click node_cep "https://github.com/kaynarocha/petvet/blob/main/front/app/services/enderecoService.ts"
click node_userpages "https://github.com/kaynarocha/petvet/tree/main/front/app/(sistema)/usuarios"
click node_userform "https://github.com/kaynarocha/petvet/blob/main/front/app/(sistema)/usuarios/components/UsuarioForm.tsx"
click node_companyservice "https://github.com/kaynarocha/petvet/blob/main/front/app/services/empresaService.ts"
click node_api "https://github.com/kaynarocha/petvet/blob/main/front/app/services/api.ts"
click node_store "https://github.com/kaynarocha/petvet/blob/main/front/app/redux/store.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,node_authservice,node_authstate,node_store,node_user toneBlue
class node_dashboard,node_appointments,node_appointmentform,node_pets,node_petform toneAmber
class node_userservice,node_companies,node_companyform,node_services,node_serviceform,node_tutors,node_tutorform,node_cep,node_userpages,node_userform,node_companyservice,node_backend toneMint
class node_api toneRose
```

## Components

### Access and session

- [Login screen](https://github.com/kaynarocha/petvet/blob/main/front/app/login/page.tsx): `front/app/login/page.tsx`
- [Authentication service](https://github.com/kaynarocha/petvet/blob/main/front/app/services/authService.ts): `front/app/services/authService.ts`
- [Auth state](https://github.com/kaynarocha/petvet/blob/main/front/app/redux/slices/authSlice.ts): `front/app/redux/slices/authSlice.ts`
- [Redux store](https://github.com/kaynarocha/petvet/blob/main/front/app/redux/store.ts): `front/app/redux/store.ts`

### Practice operations

- [Dashboard](https://github.com/kaynarocha/petvet/blob/main/front/app/(sistema)/home/page.tsx): `front/app/(sistema)/home/page.tsx`
- [Appointments](https://github.com/kaynarocha/petvet/tree/main/front/app/(sistema)/agendamentos): `front/app/(sistema)/agendamentos`
- [Appointment form](https://github.com/kaynarocha/petvet/blob/main/front/app/(sistema)/agendamentos/components/AgendamentoForm.tsx): `front/app/(sistema)/agendamentos/components/AgendamentoForm.tsx`
- [Pets](https://github.com/kaynarocha/petvet/tree/main/front/app/(sistema)/pets): `front/app/(sistema)/pets`
- [Pet form](https://github.com/kaynarocha/petvet/blob/main/front/app/(sistema)/pets/components/PetForm.tsx): `front/app/(sistema)/pets/components/PetForm.tsx`

### Business records

- [User service](https://github.com/kaynarocha/petvet/blob/main/front/app/services/usuarioService.ts): `front/app/services/usuarioService.ts`
- [Companies](https://github.com/kaynarocha/petvet/tree/main/front/app/(sistema)/empresas): `front/app/(sistema)/empresas`
- [Company form](https://github.com/kaynarocha/petvet/blob/main/front/app/(sistema)/empresas/components/EmpresaForm.tsx): `front/app/(sistema)/empresas/components/EmpresaForm.tsx`
- [Services](https://github.com/kaynarocha/petvet/tree/main/front/app/(sistema)/servicos): `front/app/(sistema)/servicos`
- [Service form](https://github.com/kaynarocha/petvet/blob/main/front/app/(sistema)/servicos/components/ServicoForm.tsx): `front/app/(sistema)/servicos/components/ServicoForm.tsx`
- [Tutors](https://github.com/kaynarocha/petvet/tree/main/front/app/(sistema)/tutores): `front/app/(sistema)/tutores`
- [Tutor form](https://github.com/kaynarocha/petvet/blob/main/front/app/(sistema)/tutores/components/TutorForm.tsx): `front/app/(sistema)/tutores/components/TutorForm.tsx`
- [Address lookup](https://github.com/kaynarocha/petvet/blob/main/front/app/services/enderecoService.ts): `front/app/services/enderecoService.ts`
- [User management](https://github.com/kaynarocha/petvet/tree/main/front/app/(sistema)/usuarios): `front/app/(sistema)/usuarios`
- [User form](https://github.com/kaynarocha/petvet/blob/main/front/app/(sistema)/usuarios/components/UsuarioForm.tsx): `front/app/(sistema)/usuarios/components/UsuarioForm.tsx`
- [Company service](https://github.com/kaynarocha/petvet/blob/main/front/app/services/empresaService.ts): `front/app/services/empresaService.ts`

### API transport

- [HTTP API client](https://github.com/kaynarocha/petvet/blob/main/front/app/services/api.ts): `front/app/services/api.ts`

### Other components

- **User**
- **Backend API**

## Connections

- User → Login screen: signs in (evidence: `front/app/login/page.tsx`)
- Login screen → Authentication service: requests login (evidence: `front/app/login/page.tsx`)
- Login screen → User service: loads user (evidence: `front/app/login/page.tsx`)
- Login screen → Auth state: dispatches login (evidence: `front/app/login/page.tsx`)
- Authentication service → HTTP API client: posts credentials (evidence: `front/app/services/authService.ts`)
- User service → HTTP API client: sends requests (evidence: `front/app/services/usuarioService.ts`)
- HTTP API client → Backend API: sends HTTP (evidence: `front/app/services/api.ts`)
- HTTP API client → Redux store: reads token (evidence: `front/app/services/api.ts`)
- HTTP API client → Auth state: dispatches logout (evidence: `front/app/services/api.ts`)
- User → Dashboard: opens system
- Appointments → Appointment form: renders form (evidence: `front/app/(sistema)/agendamentos/novo/page.tsx`)
- Companies → Company form: renders form (evidence: `front/app/(sistema)/empresas/novo/page.tsx`)
- Services → Service form: renders form (evidence: `front/app/(sistema)/servicos/novo/page.tsx`)
- User management → User form: renders form (evidence: `front/app/(sistema)/usuarios/novo/page.tsx`)
- User form → User service: saves user (evidence: `front/app/(sistema)/usuarios/components/UsuarioForm.tsx`)
- User form → Company service: loads companies (evidence: `front/app/(sistema)/usuarios/components/UsuarioForm.tsx`)
- Tutor form → Address lookup: looks up address (evidence: `front/app/(sistema)/tutores/components/TutorForm.tsx`)
