# globoccn/klabin-command-center architecture

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

- Interactive diagram: https://gitdiagram.com/globoccn/klabin-command-center
- Repository: https://github.com/globoccn/klabin-command-center

## Overview

Central Operacional Klabin is a React/TypeScript operations dashboard frontend backed by n8n webhooks. Users select a reporting period and operational filters, inspect summaries and domain-specific pages, and can generate reports or consult the governed assistant. The graph preserves the README’s documented capabilities; some route internals were not sampled, so those links rely on README statements rather than inspected route code.

Main entry points: [`src/routes/__root.tsx`](https://github.com/globoccn/klabin-command-center/blob/main/src/routes/__root.tsx) (App shell and routes), [`src/services/dashboardService.ts`](https://github.com/globoccn/klabin-command-center/blob/main/src/services/dashboardService.ts) (Dashboard queries), [`src/routes/index.tsx`](https://github.com/globoccn/klabin-command-center/blob/main/src/routes/index.tsx) (Executive overview), [`src/services/chatService.ts`](https://github.com/globoccn/klabin-command-center/blob/main/src/services/chatService.ts) (Chat service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_navigation["Application shell"]
  node_shell["App shell and routes<br/>[__root.tsx]"]
end

subgraph group_operations["Operational analysis"]
  node_overview["Executive overview<br/>[index.tsx]"]
  node_filters["Overview filters"]
  node_filterbar["Page filters<br/>[filter-bar.tsx]"]
  node_period["Shared analysis period<br/>[analysis-period.ts]"]
  node_tasks["Tasks and tickets<br/>[chamados.tsx]"]
  node_climate["Climate analysis<br/>[climatizacao.tsx]"]
  node_rounds["Rounds and preventive work<br/>[rondas.tsx]"]
  node_evidence["Evidence and audit<br/>[evidencias.tsx]"]
  node_quality["Data quality<br/>[qualidade.tsx]"]
  node_analysis["Period insights"]
end

subgraph group_services["API services"]
  node_dashboard["Dashboard queries"]
  node_api["HTTP API client<br/>[apiClient.ts]"]
  node_reportservice["Report service<br/>[reportService.ts]"]
  node_chatservice["Chat service<br/>[chatService.ts]"]
  node_types["Dashboard data types<br/>[dashboard.ts]"]
end

subgraph group_insights["Reports and assistant"]
  node_reports["Report workflow<br/>[relatorios.tsx]"]
  node_assistant["Assistant conversation"]
  node_assistantroute["Assistant page<br/>[assistente.tsx]"]
end

node_operator(("Operator"))
node_n8n{{"n8n webhooks"}}

node_operator -->|"opens dashboard"| node_shell
node_shell -->|"routes to"| node_overview
node_shell -->|"routes to"| node_tasks
node_shell -->|"routes to"| node_climate
node_shell -->|"routes to"| node_rounds
node_shell -->|"routes to"| node_evidence
node_shell -->|"routes to"| node_quality
node_shell -->|"routes to"| node_reports
node_shell -->|"routes to"| node_assistantroute
node_overview -->|"renders"| node_filters
node_overview -->|"derives insights"| node_analysis
node_filters -->|"loads filter options"| node_dashboard
node_filterbar -->|"loads filter options"| node_dashboard
node_filterbar -->|"saves selected period"| node_period
node_overview -->|"saves selected period"| node_period
node_overview -->|"loads overview data"| node_dashboard
node_climate -->|"loads climate data"| node_dashboard
node_rounds -->|"loads rounds data"| node_dashboard
node_quality -->|"loads quality data"| node_dashboard
node_dashboard -->|"requests endpoints"| node_api
node_dashboard -->|"reads shared period"| node_period
node_api -->|"calls webhooks"| node_n8n
node_reports -->|"generates and manages"| node_reportservice
node_reportservice -->|"requests and downloads"| node_api
node_assistantroute -->|"renders conversation"| node_assistant
node_assistant -->|"submits chat and feedback"| node_chatservice
node_chatservice -->|"sends chat requests"| node_api
node_chatservice -->|"uses governed chat"| node_n8n
node_dashboard -->|"types responses"| node_types
node_chatservice -->|"types chat data"| node_types
node_reportservice -->|"types report data"| node_types

click node_shell "https://github.com/globoccn/klabin-command-center/blob/main/src/routes/__root.tsx"
click node_overview "https://github.com/globoccn/klabin-command-center/blob/main/src/routes/index.tsx"
click node_filters "https://github.com/globoccn/klabin-command-center/blob/main/src/components/overview-filters.tsx"
click node_filterbar "https://github.com/globoccn/klabin-command-center/blob/main/src/components/filter-bar.tsx"
click node_period "https://github.com/globoccn/klabin-command-center/blob/main/src/lib/analysis-period.ts"
click node_tasks "https://github.com/globoccn/klabin-command-center/blob/main/src/routes/chamados.tsx"
click node_climate "https://github.com/globoccn/klabin-command-center/blob/main/src/routes/climatizacao.tsx"
click node_rounds "https://github.com/globoccn/klabin-command-center/blob/main/src/routes/rondas.tsx"
click node_evidence "https://github.com/globoccn/klabin-command-center/blob/main/src/routes/evidencias.tsx"
click node_quality "https://github.com/globoccn/klabin-command-center/blob/main/src/routes/qualidade.tsx"
click node_dashboard "https://github.com/globoccn/klabin-command-center/blob/main/src/services/dashboardService.ts"
click node_api "https://github.com/globoccn/klabin-command-center/blob/main/src/services/apiClient.ts"
click node_reports "https://github.com/globoccn/klabin-command-center/blob/main/src/routes/relatorios.tsx"
click node_reportservice "https://github.com/globoccn/klabin-command-center/blob/main/src/services/reportService.ts"
click node_assistant "https://github.com/globoccn/klabin-command-center/blob/main/src/components/assistant-conversation.tsx"
click node_assistantroute "https://github.com/globoccn/klabin-command-center/blob/main/src/routes/assistente.tsx"
click node_chatservice "https://github.com/globoccn/klabin-command-center/blob/main/src/services/chatService.ts"
click node_analysis "https://github.com/globoccn/klabin-command-center/blob/main/src/lib/overview-analysis.ts"
click node_types "https://github.com/globoccn/klabin-command-center/blob/main/src/types/dashboard.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_shell toneBlue
class node_overview,node_filters,node_filterbar,node_period,node_tasks,node_climate,node_rounds,node_evidence,node_quality,node_analysis toneAmber
class node_dashboard,node_api,node_reportservice,node_chatservice,node_types,node_n8n toneMint
class node_reports,node_assistant,node_assistantroute toneRose
class node_operator toneIndigo
```

## Components

### Application shell

- [App shell and routes](https://github.com/globoccn/klabin-command-center/blob/main/src/routes/__root.tsx): `src/routes/__root.tsx`

### Operational analysis

- [Executive overview](https://github.com/globoccn/klabin-command-center/blob/main/src/routes/index.tsx): `src/routes/index.tsx`
- [Overview filters](https://github.com/globoccn/klabin-command-center/blob/main/src/components/overview-filters.tsx): `src/components/overview-filters.tsx`
- [Page filters](https://github.com/globoccn/klabin-command-center/blob/main/src/components/filter-bar.tsx): `src/components/filter-bar.tsx`
- [Shared analysis period](https://github.com/globoccn/klabin-command-center/blob/main/src/lib/analysis-period.ts): `src/lib/analysis-period.ts`
- [Tasks and tickets](https://github.com/globoccn/klabin-command-center/blob/main/src/routes/chamados.tsx): `src/routes/chamados.tsx`
- [Climate analysis](https://github.com/globoccn/klabin-command-center/blob/main/src/routes/climatizacao.tsx): `src/routes/climatizacao.tsx`
- [Rounds and preventive work](https://github.com/globoccn/klabin-command-center/blob/main/src/routes/rondas.tsx): `src/routes/rondas.tsx`
- [Evidence and audit](https://github.com/globoccn/klabin-command-center/blob/main/src/routes/evidencias.tsx): `src/routes/evidencias.tsx`
- [Data quality](https://github.com/globoccn/klabin-command-center/blob/main/src/routes/qualidade.tsx): `src/routes/qualidade.tsx`
- [Period insights](https://github.com/globoccn/klabin-command-center/blob/main/src/lib/overview-analysis.ts): `src/lib/overview-analysis.ts`

### API services

- [Dashboard queries](https://github.com/globoccn/klabin-command-center/blob/main/src/services/dashboardService.ts): `src/services/dashboardService.ts`
- [HTTP API client](https://github.com/globoccn/klabin-command-center/blob/main/src/services/apiClient.ts): `src/services/apiClient.ts`
- [Report service](https://github.com/globoccn/klabin-command-center/blob/main/src/services/reportService.ts): `src/services/reportService.ts`
- [Chat service](https://github.com/globoccn/klabin-command-center/blob/main/src/services/chatService.ts): `src/services/chatService.ts`
- [Dashboard data types](https://github.com/globoccn/klabin-command-center/blob/main/src/types/dashboard.ts): `src/types/dashboard.ts`

### Reports and assistant

- [Report workflow](https://github.com/globoccn/klabin-command-center/blob/main/src/routes/relatorios.tsx): `src/routes/relatorios.tsx`
- [Assistant conversation](https://github.com/globoccn/klabin-command-center/blob/main/src/components/assistant-conversation.tsx): `src/components/assistant-conversation.tsx`
- [Assistant page](https://github.com/globoccn/klabin-command-center/blob/main/src/routes/assistente.tsx): `src/routes/assistente.tsx`

### Other components

- **Operator**
- **n8n webhooks**

## Connections

- Operator → App shell and routes: opens dashboard
- App shell and routes → Executive overview: routes to (evidence: `src/routeTree.gen.ts`)
- App shell and routes → Tasks and tickets: routes to (evidence: `src/routeTree.gen.ts`)
- App shell and routes → Climate analysis: routes to (evidence: `src/routeTree.gen.ts`)
- App shell and routes → Rounds and preventive work: routes to (evidence: `src/routeTree.gen.ts`)
- App shell and routes → Evidence and audit: routes to (evidence: `src/routeTree.gen.ts`)
- App shell and routes → Data quality: routes to (evidence: `src/routeTree.gen.ts`)
- App shell and routes → Report workflow: routes to (evidence: `src/routeTree.gen.ts`)
- App shell and routes → Assistant page: routes to (evidence: `src/routeTree.gen.ts`)
- Executive overview → Overview filters: renders (evidence: `src/routes/index.tsx`)
- Executive overview → Period insights: derives insights (evidence: `src/routes/index.tsx`)
- Overview filters → Dashboard queries: loads filter options (evidence: `src/components/overview-filters.tsx`)
- Page filters → Dashboard queries: loads filter options (evidence: `src/components/filter-bar.tsx`)
- Page filters → Shared analysis period: saves selected period (evidence: `src/components/filter-bar.tsx`)
- Executive overview → Shared analysis period: saves selected period (evidence: `src/routes/index.tsx`)
- Executive overview → Dashboard queries: loads overview data (evidence: `src/routes/index.tsx`)
- Climate analysis → Dashboard queries: loads climate data (evidence: `src/routes/climatizacao.tsx`)
- Rounds and preventive work → Dashboard queries: loads rounds data (evidence: `src/routes/rondas.tsx`)
- Data quality → Dashboard queries: loads quality data (evidence: `src/routes/qualidade.tsx`)
- Dashboard queries → HTTP API client: requests endpoints (evidence: `src/services/dashboardService.ts`)
- Dashboard queries → Shared analysis period: reads shared period (evidence: `src/services/dashboardService.ts`)
- HTTP API client → n8n webhooks: calls webhooks
- Report workflow → Report service: generates and manages (evidence: `src/routes/relatorios.tsx`)
- Report service → HTTP API client: requests and downloads (evidence: `src/services/reportService.ts`)
- Assistant page → Assistant conversation: renders conversation (evidence: `src/routes/assistente.tsx`)
- Assistant conversation → Chat service: submits chat and feedback (evidence: `src/components/assistant-conversation.tsx`)
- Chat service → HTTP API client: sends chat requests (evidence: `src/services/chatService.ts`)
- Chat service → n8n webhooks: uses governed chat
- Dashboard queries → Dashboard data types: types responses (evidence: `src/services/dashboardService.ts`)
- Chat service → Dashboard data types: types chat data (evidence: `src/services/chatService.ts`)
- Report service → Dashboard data types: types report data (evidence: `src/services/reportService.ts`)
