# caiofugii/sanorte-vistorias-frontend architecture

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

- Interactive diagram: https://gitdiagram.com/caiofugii/sanorte-vistorias-frontend
- Repository: https://github.com/caiofugii/sanorte-vistorias-frontend

## Overview

Sanorte Vistorias is a field-inspection frontend for quality, safety, and related operational work, integrated with a NestJS API. The principal workflow is to sign in, select the inspection context and checklist, record and manage inspection results, then review outcomes through lists, dashboards, and analytics. Administration covers reference data, checklists, teams, contracts, service orders, and investment works; reporting includes report forms and PDF generation. The graph follows shown routing and repository calls. Several page-to-data relationships and unsampled subsystem internals are not shown, so they are omitted rather than inferred.

Main entry points: [`src/app/router.tsx`](https://github.com/caiofugii/sanorte-vistorias-frontend/blob/main/src/app/router.tsx) (Role-aware router), [`src/app/App.tsx`](https://github.com/caiofugii/sanorte-vistorias-frontend/blob/main/src/app/App.tsx) (Application shell), [`src/repositories/AppRepository.ts`](https://github.com/caiofugii/sanorte-vistorias-frontend/blob/main/src/repositories/AppRepository.ts) (Application repository), [`src/pages/NewInspectionPage.tsx`](https://github.com/caiofugii/sanorte-vistorias-frontend/blob/main/src/pages/NewInspectionPage.tsx) (Create inspection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App access"]
  node_app["Application shell<br/>[App.tsx]"]
  node_router["Role-aware router<br/>[router.tsx]"]
  node_shell["Authenticated shell<br/>[AppShell.tsx]"]
  node_login["Login page<br/>[LoginPage.tsx]"]
end

subgraph group_inspection["Inspection workflow"]
  node_new_inspection["Create inspection"]
  node_fill_inspection["Fill inspection"]
  node_inspection_detail["Inspection detail"]
  node_inspection_lists["Inspection lists"]
end

subgraph group_operations["Operations administration"]
  node_checklist_editor["Checklist editor"]
  node_service_orders["Service orders"]
  node_admin_pages["Reference management"]
  node_investment_works["Investment works"]
end

subgraph group_insights["Analytics reports"]
  node_dashboard["Dashboard<br/>[DashboardPage.tsx]"]
  node_analytics["Quality and safety analytics"]
  node_reports["Report forms<br/>[ReportFormPage.tsx]"]
  node_inspection_pdf["Inspection PDF<br/>[inspectionPdf.ts]"]
  node_report_pdf["Report PDF templates"]
end

subgraph group_data["Data and domain"]
  node_auth_store["Authentication state<br/>[authStore.ts]"]
  node_reference_store["Reference state<br/>[referenceStore.ts]"]
  node_inspection_store["Inspection state<br/>[inspectionStore.ts]"]
  node_app_repository["Application repository<br/>[AppRepository.ts]"]
  node_api_repository["API repository<br/>[ApiRepository.ts]"]
  node_api_client["HTTP client<br/>[apiClient.ts]"]
  node_domain_rules["Inspection rules"]
end

node_field_user(("Field user"))
node_backend[("NestJS API")]

node_field_user -.->|"opens"| node_app
node_app -->|"mounts routes"| node_router
node_app -->|"loads references"| node_reference_store
node_app -->|"loads identity"| node_auth_store
node_router -->|"wraps protected routes"| node_shell
node_router -->|"routes to"| node_login
node_router -->|"routes to"| node_new_inspection
node_router -->|"routes to"| node_fill_inspection
node_router -->|"routes to"| node_inspection_detail
node_router -->|"routes to"| node_inspection_lists
node_router -->|"routes to"| node_checklist_editor
node_router -->|"routes to"| node_service_orders
node_router -->|"routes to"| node_investment_works
node_router -->|"routes to"| node_dashboard
node_router -->|"routes to"| node_analytics
node_router -->|"routes to"| node_reports
node_auth_store -->|"delegates auth"| node_app_repository
node_reference_store -->|"loads cached data"| node_app_repository
node_new_inspection -->|"creates inspection"| node_app_repository
node_new_inspection -->|"applies rules"| node_domain_rules
node_app_repository -->|"delegates operations"| node_api_repository
node_api_repository -->|"sends requests"| node_api_client
node_api_client -->|"calls API"| node_backend
node_inspection_pdf -.->|"shares PDF layout"| node_report_pdf

click node_app "https://github.com/caiofugii/sanorte-vistorias-frontend/blob/main/src/app/App.tsx"
click node_router "https://github.com/caiofugii/sanorte-vistorias-frontend/blob/main/src/app/router.tsx"
click node_shell "https://github.com/caiofugii/sanorte-vistorias-frontend/blob/main/src/app/AppShell.tsx"
click node_login "https://github.com/caiofugii/sanorte-vistorias-frontend/blob/main/src/pages/LoginPage.tsx"
click node_new_inspection "https://github.com/caiofugii/sanorte-vistorias-frontend/blob/main/src/pages/NewInspectionPage.tsx"
click node_fill_inspection "https://github.com/caiofugii/sanorte-vistorias-frontend/blob/main/src/pages/FillInspectionPage.tsx"
click node_inspection_detail "https://github.com/caiofugii/sanorte-vistorias-frontend/blob/main/src/pages/InspectionDetailPage.tsx"
click node_inspection_lists "https://github.com/caiofugii/sanorte-vistorias-frontend/blob/main/src/pages/InspectionsPage.tsx"
click node_checklist_editor "https://github.com/caiofugii/sanorte-vistorias-frontend/blob/main/src/pages/ChecklistEditorPage.tsx"
click node_service_orders "https://github.com/caiofugii/sanorte-vistorias-frontend/blob/main/src/pages/ServiceOrdersPage.tsx"
click node_admin_pages "https://github.com/caiofugii/sanorte-vistorias-frontend/tree/main/src/pages"
click node_investment_works "https://github.com/caiofugii/sanorte-vistorias-frontend/blob/main/src/pages/InvestmentWorksPage.tsx"
click node_dashboard "https://github.com/caiofugii/sanorte-vistorias-frontend/blob/main/src/pages/DashboardPage.tsx"
click node_analytics "https://github.com/caiofugii/sanorte-vistorias-frontend/tree/main/src/pages/analytics"
click node_reports "https://github.com/caiofugii/sanorte-vistorias-frontend/blob/main/src/pages/ReportFormPage.tsx"
click node_inspection_pdf "https://github.com/caiofugii/sanorte-vistorias-frontend/blob/main/src/utils/inspectionPdf.ts"
click node_report_pdf "https://github.com/caiofugii/sanorte-vistorias-frontend/tree/main/src/utils/report-pdf/templates"
click node_auth_store "https://github.com/caiofugii/sanorte-vistorias-frontend/blob/main/src/stores/authStore.ts"
click node_reference_store "https://github.com/caiofugii/sanorte-vistorias-frontend/blob/main/src/stores/referenceStore.ts"
click node_inspection_store "https://github.com/caiofugii/sanorte-vistorias-frontend/blob/main/src/stores/inspectionStore.ts"
click node_app_repository "https://github.com/caiofugii/sanorte-vistorias-frontend/blob/main/src/repositories/AppRepository.ts"
click node_api_repository "https://github.com/caiofugii/sanorte-vistorias-frontend/blob/main/src/api/repositories/ApiRepository.ts"
click node_api_client "https://github.com/caiofugii/sanorte-vistorias-frontend/blob/main/src/api/apiClient.ts"
click node_domain_rules "https://github.com/caiofugii/sanorte-vistorias-frontend/tree/main/src/domain/rules"

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_router,node_shell,node_login,node_field_user toneBlue
class node_new_inspection,node_fill_inspection,node_inspection_detail,node_inspection_lists,node_backend toneAmber
class node_checklist_editor,node_service_orders,node_admin_pages,node_investment_works toneMint
class node_dashboard,node_analytics,node_reports,node_inspection_pdf,node_report_pdf toneRose
class node_auth_store,node_reference_store,node_inspection_store,node_app_repository,node_api_repository,node_api_client,node_domain_rules toneIndigo
```

## Components

### App access

- [Application shell](https://github.com/caiofugii/sanorte-vistorias-frontend/blob/main/src/app/App.tsx): `src/app/App.tsx`
- [Role-aware router](https://github.com/caiofugii/sanorte-vistorias-frontend/blob/main/src/app/router.tsx): `src/app/router.tsx`
- [Authenticated shell](https://github.com/caiofugii/sanorte-vistorias-frontend/blob/main/src/app/AppShell.tsx): `src/app/AppShell.tsx`
- [Login page](https://github.com/caiofugii/sanorte-vistorias-frontend/blob/main/src/pages/LoginPage.tsx): `src/pages/LoginPage.tsx`

### Inspection workflow

- [Create inspection](https://github.com/caiofugii/sanorte-vistorias-frontend/blob/main/src/pages/NewInspectionPage.tsx): `src/pages/NewInspectionPage.tsx`
- [Fill inspection](https://github.com/caiofugii/sanorte-vistorias-frontend/blob/main/src/pages/FillInspectionPage.tsx): `src/pages/FillInspectionPage.tsx`
- [Inspection detail](https://github.com/caiofugii/sanorte-vistorias-frontend/blob/main/src/pages/InspectionDetailPage.tsx): `src/pages/InspectionDetailPage.tsx`
- [Inspection lists](https://github.com/caiofugii/sanorte-vistorias-frontend/blob/main/src/pages/InspectionsPage.tsx): `src/pages/InspectionsPage.tsx`

### Operations administration

- [Checklist editor](https://github.com/caiofugii/sanorte-vistorias-frontend/blob/main/src/pages/ChecklistEditorPage.tsx): `src/pages/ChecklistEditorPage.tsx`
- [Service orders](https://github.com/caiofugii/sanorte-vistorias-frontend/blob/main/src/pages/ServiceOrdersPage.tsx): `src/pages/ServiceOrdersPage.tsx`
- [Reference management](https://github.com/caiofugii/sanorte-vistorias-frontend/tree/main/src/pages): `src/pages`
- [Investment works](https://github.com/caiofugii/sanorte-vistorias-frontend/blob/main/src/pages/InvestmentWorksPage.tsx): `src/pages/InvestmentWorksPage.tsx`

### Analytics reports

- [Dashboard](https://github.com/caiofugii/sanorte-vistorias-frontend/blob/main/src/pages/DashboardPage.tsx): `src/pages/DashboardPage.tsx`
- [Quality and safety analytics](https://github.com/caiofugii/sanorte-vistorias-frontend/tree/main/src/pages/analytics): `src/pages/analytics`
- [Report forms](https://github.com/caiofugii/sanorte-vistorias-frontend/blob/main/src/pages/ReportFormPage.tsx): `src/pages/ReportFormPage.tsx`
- [Inspection PDF](https://github.com/caiofugii/sanorte-vistorias-frontend/blob/main/src/utils/inspectionPdf.ts): `src/utils/inspectionPdf.ts`
- [Report PDF templates](https://github.com/caiofugii/sanorte-vistorias-frontend/tree/main/src/utils/report-pdf/templates): `src/utils/report-pdf/templates`

### Data and domain

- [Authentication state](https://github.com/caiofugii/sanorte-vistorias-frontend/blob/main/src/stores/authStore.ts): `src/stores/authStore.ts`
- [Reference state](https://github.com/caiofugii/sanorte-vistorias-frontend/blob/main/src/stores/referenceStore.ts): `src/stores/referenceStore.ts`
- [Inspection state](https://github.com/caiofugii/sanorte-vistorias-frontend/blob/main/src/stores/inspectionStore.ts): `src/stores/inspectionStore.ts`
- [Application repository](https://github.com/caiofugii/sanorte-vistorias-frontend/blob/main/src/repositories/AppRepository.ts): `src/repositories/AppRepository.ts`
- [API repository](https://github.com/caiofugii/sanorte-vistorias-frontend/blob/main/src/api/repositories/ApiRepository.ts): `src/api/repositories/ApiRepository.ts`
- [HTTP client](https://github.com/caiofugii/sanorte-vistorias-frontend/blob/main/src/api/apiClient.ts): `src/api/apiClient.ts`
- [Inspection rules](https://github.com/caiofugii/sanorte-vistorias-frontend/tree/main/src/domain/rules): `src/domain/rules`

### Other components

- **Field user**
- **NestJS API**

## Connections

- Field user → Application shell: opens
- Application shell → Role-aware router: mounts routes (evidence: `src/app/App.tsx`)
- Application shell → Reference state: loads references (evidence: `src/app/App.tsx`)
- Application shell → Authentication state: loads identity (evidence: `src/app/App.tsx`)
- Role-aware router → Authenticated shell: wraps protected routes (evidence: `src/app/router.tsx`)
- Role-aware router → Login page: routes to (evidence: `src/app/router.tsx`)
- Role-aware router → Create inspection: routes to (evidence: `src/app/router.tsx`)
- Role-aware router → Fill inspection: routes to (evidence: `src/app/router.tsx`)
- Role-aware router → Inspection detail: routes to (evidence: `src/app/router.tsx`)
- Role-aware router → Inspection lists: routes to (evidence: `src/app/router.tsx`)
- Role-aware router → Checklist editor: routes to (evidence: `src/app/router.tsx`)
- Role-aware router → Service orders: routes to (evidence: `src/app/router.tsx`)
- Role-aware router → Investment works: routes to (evidence: `src/app/router.tsx`)
- Role-aware router → Dashboard: routes to (evidence: `src/app/router.tsx`)
- Role-aware router → Quality and safety analytics: routes to (evidence: `src/app/router.tsx`)
- Role-aware router → Report forms: routes to (evidence: `src/app/router.tsx`)
- Authentication state → Application repository: delegates auth (evidence: `src/stores/authStore.ts`)
- Reference state → Application repository: loads cached data (evidence: `src/stores/referenceStore.ts`)
- Create inspection → Application repository: creates inspection (evidence: `src/pages/NewInspectionPage.tsx`)
- Create inspection → Inspection rules: applies rules (evidence: `src/pages/NewInspectionPage.tsx`)
- Application repository → API repository: delegates operations (evidence: `src/repositories/AppRepository.ts`)
- API repository → HTTP client: sends requests (evidence: `src/api/repositories/ApiRepository.ts`)
- HTTP client → NestJS API: calls API (evidence: `README.md`)
- Inspection PDF → Report PDF templates: shares PDF layout
