# viniciusredes/projeto-agro architecture

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

- Interactive diagram: https://gitdiagram.com/viniciusredes/projeto-agro
- Repository: https://github.com/viniciusredes/projeto-agro

## Overview

Agro Frota is an in-memory fleet, maintenance, and inventory management MVP with a web management panel and a field-operator mobile app. The workflow is to record machine deployments and returns, track parts and purchases, open and close maintenance orders (including parts consumption and costs), and review fleet and stock status. The web and mobile clients call the backend API; the README documents the mobile QR, damage-photo, and operator flows. Backend internals and several mobile integrations were not excerpted, so those relationships are shown only where documented or left unconnected.

Main entry points: [`agro-backend/server.ts`](https://github.com/viniciusredes/projeto-agro/blob/main/agro-backend/server.ts) (HTTP API server), [`agro-frontend/src/app/features/inicio/inicio.ts`](https://github.com/viniciusredes/projeto-agro/blob/main/agro-frontend/src/app/features/inicio/inicio.ts) (Overview dashboard), [`agro-frontend/src/app/core/services/maquina.service.ts`](https://github.com/viniciusredes/projeto-agro/blob/main/agro-frontend/src/app/core/services/maquina.service.ts) (Fleet client service), [`agro-frontend/src/app/core/services/peca.service.ts`](https://github.com/viniciusredes/projeto-agro/blob/main/agro-frontend/src/app/core/services/peca.service.ts) (Inventory client service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["Operator and management clients"]
  node_dashboard["Overview dashboard<br/>[inicio.ts]"]
  node_web_fleet["Fleet screens"]
  node_web_stock["Inventory screens"]
  node_web_os["Service-order screens"]
  node_mobile_home["Operator home<br/>[index.tsx]"]
  node_mobile_machine["Machine actions<br/>[index.tsx]"]
  node_mobile_list["Machine list<br/>[maquinas.tsx]"]
  node_mobile_qr["QR scanning<br/>[escanear.tsx]"]
  node_mobile_damage["Damage report<br/>[avaria.tsx]"]
  node_mobile_photos["Damage photos<br/>[fotos-os.ts]"]
  node_mobile_camera["Camera capture<br/>[camera.tsx]"]
end

subgraph group_fleet["Fleet operations"]
  node_fleet_api["Fleet API<br/>[server.ts]"]
  node_web_fleet_service["Fleet client service<br/>[maquina.service.ts]"]
  node_mobile_machine_service["Mobile fleet service<br/>[maquinas.ts]"]
end

subgraph group_inventory["Parts inventory"]
  node_stock_api["Inventory API<br/>[server.ts]"]
  node_stock_service["Inventory client service<br/>[peca.service.ts]"]
end

subgraph group_maintenance["Maintenance records"]
  node_os_api["Maintenance API<br/>[server.ts]"]
  node_os_service["Service-order client"]
  node_mobile_os_service["Mobile order service<br/>[ordens-servico.ts]"]
end

subgraph group_platform["API and state"]
  node_api_server["HTTP API server<br/>[server.ts]"]
  node_memory_state[("In-memory state<br/>[server.ts]")]
  node_web_http["Web API transport<br/>[api.ts]"]
  node_mobile_http["Mobile API transport<br/>[api.ts]"]
end

node_manager(("Fleet manager"))
node_operator(("Field operator"))

node_manager -->|"views status"| node_dashboard
node_dashboard -->|"loads fleet"| node_web_fleet_service
node_dashboard -->|"loads stock"| node_stock_service
node_dashboard -->|"loads orders"| node_os_service
node_web_fleet -->|"requests fleet"| node_web_fleet_service
node_web_stock -->|"requests stock"| node_stock_service
node_web_os -->|"requests orders"| node_os_service
node_operator -.->|"uses app"| node_mobile_home
node_mobile_home -->|"loads machines"| node_mobile_machine_service
node_mobile_list -->|"loads machines"| node_mobile_machine_service
node_mobile_machine -->|"records actions"| node_mobile_machine_service
node_mobile_qr -.->|"opens machine"| node_mobile_machine
node_mobile_damage -.->|"opens corrective order"| node_mobile_os_service
node_mobile_damage -.->|"captures photos"| node_mobile_camera
node_mobile_camera -.->|"supplies images"| node_mobile_photos
node_mobile_photos -.->|"uploads photos"| node_mobile_os_service
node_web_fleet_service -->|"sends requests"| node_web_http
node_stock_service -->|"sends requests"| node_web_http
node_os_service -->|"sends requests"| node_web_http
node_mobile_machine_service -.->|"uses transport"| node_mobile_http
node_mobile_os_service -.->|"uses transport"| node_mobile_http
node_web_http -.->|"calls API"| node_api_server
node_mobile_http -.->|"calls API"| node_api_server
node_api_server -->|"routes fleet"| node_fleet_api
node_api_server -->|"routes inventory"| node_stock_api
node_api_server -->|"routes maintenance"| node_os_api
node_fleet_api -.->|"reads and writes"| node_memory_state
node_stock_api -.->|"reads and writes"| node_memory_state
node_os_api -.->|"reads and writes"| node_memory_state
node_web_fleet_service -.->|"requests fleet routes"| node_fleet_api
node_stock_service -.->|"requests inventory routes"| node_stock_api
node_os_service -.->|"requests order routes"| node_os_api

click node_dashboard "https://github.com/viniciusredes/projeto-agro/blob/main/agro-frontend/src/app/features/inicio/inicio.ts"
click node_web_fleet "https://github.com/viniciusredes/projeto-agro/tree/main/agro-frontend/src/app/features/maquinas"
click node_web_stock "https://github.com/viniciusredes/projeto-agro/tree/main/agro-frontend/src/app/features/estoque"
click node_web_os "https://github.com/viniciusredes/projeto-agro/tree/main/agro-frontend/src/app/features/ordens-servico"
click node_mobile_home "https://github.com/viniciusredes/projeto-agro/blob/main/agro-mobile/src/app/index.tsx"
click node_mobile_machine "https://github.com/viniciusredes/projeto-agro/blob/main/agro-mobile/src/app/maquina/%5Bid%5D/index.tsx"
click node_mobile_list "https://github.com/viniciusredes/projeto-agro/blob/main/agro-mobile/src/app/maquinas.tsx"
click node_mobile_qr "https://github.com/viniciusredes/projeto-agro/blob/main/agro-mobile/src/app/escanear.tsx"
click node_mobile_damage "https://github.com/viniciusredes/projeto-agro/blob/main/agro-mobile/src/app/maquina/%5Bid%5D/avaria.tsx"
click node_mobile_photos "https://github.com/viniciusredes/projeto-agro/blob/main/agro-mobile/src/servicos/fotos-os.ts"
click node_fleet_api "https://github.com/viniciusredes/projeto-agro/blob/main/agro-backend/server.ts"
click node_web_fleet_service "https://github.com/viniciusredes/projeto-agro/blob/main/agro-frontend/src/app/core/services/maquina.service.ts"
click node_stock_api "https://github.com/viniciusredes/projeto-agro/blob/main/agro-backend/server.ts"
click node_stock_service "https://github.com/viniciusredes/projeto-agro/blob/main/agro-frontend/src/app/core/services/peca.service.ts"
click node_os_api "https://github.com/viniciusredes/projeto-agro/blob/main/agro-backend/server.ts"
click node_os_service "https://github.com/viniciusredes/projeto-agro/blob/main/agro-frontend/src/app/core/services/ordem-servico.service.ts"
click node_mobile_machine_service "https://github.com/viniciusredes/projeto-agro/blob/main/agro-mobile/src/servicos/maquinas.ts"
click node_mobile_os_service "https://github.com/viniciusredes/projeto-agro/blob/main/agro-mobile/src/servicos/ordens-servico.ts"
click node_mobile_camera "https://github.com/viniciusredes/projeto-agro/blob/main/agro-mobile/src/componentes/camera.tsx"
click node_api_server "https://github.com/viniciusredes/projeto-agro/blob/main/agro-backend/server.ts"
click node_memory_state "https://github.com/viniciusredes/projeto-agro/blob/main/agro-backend/server.ts"
click node_web_http "https://github.com/viniciusredes/projeto-agro/blob/main/agro-frontend/src/app/core/api.ts"
click node_mobile_http "https://github.com/viniciusredes/projeto-agro/blob/main/agro-mobile/src/api.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_dashboard,node_web_fleet,node_web_stock,node_web_os,node_mobile_home,node_mobile_machine,node_mobile_list,node_mobile_qr,node_mobile_damage,node_mobile_photos,node_mobile_camera toneBlue
class node_fleet_api,node_web_fleet_service,node_mobile_machine_service toneAmber
class node_stock_api,node_stock_service toneMint
class node_os_api,node_os_service,node_mobile_os_service toneRose
class node_api_server,node_memory_state,node_web_http,node_mobile_http,node_manager,node_operator toneIndigo
```

## Components

### Operator and management clients

- [Overview dashboard](https://github.com/viniciusredes/projeto-agro/blob/main/agro-frontend/src/app/features/inicio/inicio.ts): `agro-frontend/src/app/features/inicio/inicio.ts`
- [Fleet screens](https://github.com/viniciusredes/projeto-agro/tree/main/agro-frontend/src/app/features/maquinas): `agro-frontend/src/app/features/maquinas`
- [Inventory screens](https://github.com/viniciusredes/projeto-agro/tree/main/agro-frontend/src/app/features/estoque): `agro-frontend/src/app/features/estoque`
- [Service-order screens](https://github.com/viniciusredes/projeto-agro/tree/main/agro-frontend/src/app/features/ordens-servico): `agro-frontend/src/app/features/ordens-servico`
- [Operator home](https://github.com/viniciusredes/projeto-agro/blob/main/agro-mobile/src/app/index.tsx): `agro-mobile/src/app/index.tsx`
- [Machine actions](https://github.com/viniciusredes/projeto-agro/blob/main/agro-mobile/src/app/maquina/%5Bid%5D/index.tsx): `agro-mobile/src/app/maquina/[id]/index.tsx`
- [Machine list](https://github.com/viniciusredes/projeto-agro/blob/main/agro-mobile/src/app/maquinas.tsx): `agro-mobile/src/app/maquinas.tsx`
- [QR scanning](https://github.com/viniciusredes/projeto-agro/blob/main/agro-mobile/src/app/escanear.tsx): `agro-mobile/src/app/escanear.tsx`
- [Damage report](https://github.com/viniciusredes/projeto-agro/blob/main/agro-mobile/src/app/maquina/%5Bid%5D/avaria.tsx): `agro-mobile/src/app/maquina/[id]/avaria.tsx`
- [Damage photos](https://github.com/viniciusredes/projeto-agro/blob/main/agro-mobile/src/servicos/fotos-os.ts): `agro-mobile/src/servicos/fotos-os.ts`
- [Camera capture](https://github.com/viniciusredes/projeto-agro/blob/main/agro-mobile/src/componentes/camera.tsx): `agro-mobile/src/componentes/camera.tsx`

### Fleet operations

- [Fleet API](https://github.com/viniciusredes/projeto-agro/blob/main/agro-backend/server.ts): `agro-backend/server.ts`
- [Fleet client service](https://github.com/viniciusredes/projeto-agro/blob/main/agro-frontend/src/app/core/services/maquina.service.ts): `agro-frontend/src/app/core/services/maquina.service.ts`
- [Mobile fleet service](https://github.com/viniciusredes/projeto-agro/blob/main/agro-mobile/src/servicos/maquinas.ts): `agro-mobile/src/servicos/maquinas.ts`

### Parts inventory

- [Inventory API](https://github.com/viniciusredes/projeto-agro/blob/main/agro-backend/server.ts): `agro-backend/server.ts`
- [Inventory client service](https://github.com/viniciusredes/projeto-agro/blob/main/agro-frontend/src/app/core/services/peca.service.ts): `agro-frontend/src/app/core/services/peca.service.ts`

### Maintenance records

- [Maintenance API](https://github.com/viniciusredes/projeto-agro/blob/main/agro-backend/server.ts): `agro-backend/server.ts`
- [Service-order client](https://github.com/viniciusredes/projeto-agro/blob/main/agro-frontend/src/app/core/services/ordem-servico.service.ts): `agro-frontend/src/app/core/services/ordem-servico.service.ts`
- [Mobile order service](https://github.com/viniciusredes/projeto-agro/blob/main/agro-mobile/src/servicos/ordens-servico.ts): `agro-mobile/src/servicos/ordens-servico.ts`

### API and state

- [HTTP API server](https://github.com/viniciusredes/projeto-agro/blob/main/agro-backend/server.ts): `agro-backend/server.ts`
- [In-memory state](https://github.com/viniciusredes/projeto-agro/blob/main/agro-backend/server.ts): `agro-backend/server.ts`
- [Web API transport](https://github.com/viniciusredes/projeto-agro/blob/main/agro-frontend/src/app/core/api.ts): `agro-frontend/src/app/core/api.ts`
- [Mobile API transport](https://github.com/viniciusredes/projeto-agro/blob/main/agro-mobile/src/api.ts): `agro-mobile/src/api.ts`

### Other components

- **Fleet manager**
- **Field operator**

## Connections

- Fleet manager → Overview dashboard: views status (evidence: `agro-frontend/src/app/features/inicio/inicio.ts`)
- Overview dashboard → Fleet client service: loads fleet (evidence: `agro-frontend/src/app/features/inicio/inicio.ts`)
- Overview dashboard → Inventory client service: loads stock (evidence: `agro-frontend/src/app/features/inicio/inicio.ts`)
- Overview dashboard → Service-order client: loads orders (evidence: `agro-frontend/src/app/features/inicio/inicio.ts`)
- Fleet screens → Fleet client service: requests fleet (evidence: `agro-frontend/src/app/features/maquinas/maquinas-lista/maquinas-lista.ts`)
- Inventory screens → Inventory client service: requests stock (evidence: `agro-frontend/src/app/features/estoque/pecas-lista/pecas-lista.ts`)
- Service-order screens → Service-order client: requests orders (evidence: `agro-frontend/src/app/features/ordens-servico/os-detalhe/os-detalhe.ts`)
- Field operator → Operator home: uses app
- Operator home → Mobile fleet service: loads machines (evidence: `agro-mobile/src/app/index.tsx`)
- Machine list → Mobile fleet service: loads machines (evidence: `agro-mobile/src/app/maquinas.tsx`)
- Machine actions → Mobile fleet service: records actions (evidence: `agro-mobile/src/app/maquina/[id]/index.tsx`)
- QR scanning → Machine actions: opens machine
- Damage report → Mobile order service: opens corrective order
- Damage report → Camera capture: captures photos
- Camera capture → Damage photos: supplies images
- Damage photos → Mobile order service: uploads photos
- Fleet client service → Web API transport: sends requests (evidence: `agro-frontend/src/app/core/services/maquina.service.ts`)
- Inventory client service → Web API transport: sends requests (evidence: `agro-frontend/src/app/core/services/peca.service.ts`)
- Service-order client → Web API transport: sends requests (evidence: `agro-frontend/src/app/core/services/ordem-servico.service.ts`)
- Mobile fleet service → Mobile API transport: uses transport
- Mobile order service → Mobile API transport: uses transport
- Web API transport → HTTP API server: calls API (evidence: `README.md`)
- Mobile API transport → HTTP API server: calls API (evidence: `README.md`)
- HTTP API server → Fleet API: routes fleet (evidence: `agro-backend/server.ts`)
- HTTP API server → Inventory API: routes inventory (evidence: `agro-backend/server.ts`)
- HTTP API server → Maintenance API: routes maintenance (evidence: `agro-backend/server.ts`)
- Fleet API → In-memory state: reads and writes (evidence: `agro-backend/server.ts`)
- Inventory API → In-memory state: reads and writes (evidence: `agro-backend/server.ts`)
- Maintenance API → In-memory state: reads and writes (evidence: `agro-backend/server.ts`)
- Fleet client service → Fleet API: requests fleet routes
- Inventory client service → Inventory API: requests inventory routes
- Service-order client → Maintenance API: requests order routes
