# thiagops5/agro-nezer architecture

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

- Interactive diagram: https://gitdiagram.com/thiagops5/agro-nezer
- Repository: https://github.com/thiagops5/agro-nezer

## Overview

Nezer Agro is a mobile-first agricultural partnership and traceability product, with an Express/Sequelize API and a Next.js web app. Its principal domain workflow spans managing users, crops and plots; recording inputs, applications and harvests; and producing financial settlements and reports. The README also documents sanitary alerts and offline capture, but the supplied tree and excerpts do not expose their implementation. Relationships are limited to calls, database setup and authorization wiring shown in the supplied source; the API excerpt does not show route mounting.

Main entry points: [`nezer-api/talhao/talhao.service.js`](https://github.com/thiagops5/agro-nezer/blob/main/nezer-api/talhao/talhao.service.js) (Plots), [`nezer-app/app/page.tsx`](https://github.com/thiagops5/agro-nezer/blob/main/nezer-app/app/page.tsx) (Home page), [`nezer-api/config/db.js`](https://github.com/thiagops5/agro-nezer/blob/main/nezer-api/config/db.js) (SQLite database), [`nezer-api/index.js`](https://github.com/thiagops5/agro-nezer/blob/main/nezer-api/index.js) (API startup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and access"]
  node_farmer["User management"]
  node_auth["Authentication<br/>[auth.service.js]"]
  node_authguard["Access middleware<br/>[auth.middleware.js]"]
  node_api_start["API startup<br/>[index.js]"]
  node_db[("SQLite database<br/>[db.js]")]
end

subgraph group_farm["Farm records"]
  node_plot["Plots<br/>[talhao.service.js]"]
  node_culture["Crops<br/>[cultura.service.js]"]
  node_input["Agricultural inputs<br/>[insumo.service.js]"]
end

subgraph group_outcomes["Operations and outcomes"]
  node_application["Input applications"]
  node_harvest["Harvest records"]
  node_settlement["Financial settlement<br/>[acerto.service.js]"]
  node_reports["Reports"]
end

subgraph group_web["Web app"]
  node_web_layout["Web layout<br/>[layout.tsx]"]
  node_web_home["Home page<br/>[page.tsx]"]
end

node_operator(("Farm user"))

node_operator -.->|"uses"| node_web_home
node_web_home -->|"renders within"| node_web_layout
node_api_start -->|"syncs"| node_db
node_plot -.->|"uses models"| node_db
node_plot -->|"includes"| node_culture
node_plot -->|"includes"| node_farmer
node_plot -->|"checks records"| node_application
node_plot -->|"checks records"| node_harvest
node_plot -->|"checks records"| node_settlement

click node_farmer "https://github.com/thiagops5/agro-nezer/blob/main/nezer-api/usuario/usuario.controller.js"
click node_auth "https://github.com/thiagops5/agro-nezer/blob/main/nezer-api/auth/auth.service.js"
click node_authguard "https://github.com/thiagops5/agro-nezer/blob/main/nezer-api/auth/auth.middleware.js"
click node_api_start "https://github.com/thiagops5/agro-nezer/blob/main/nezer-api/index.js"
click node_db "https://github.com/thiagops5/agro-nezer/blob/main/nezer-api/config/db.js"
click node_plot "https://github.com/thiagops5/agro-nezer/blob/main/nezer-api/talhao/talhao.service.js"
click node_culture "https://github.com/thiagops5/agro-nezer/blob/main/nezer-api/cultura/cultura.service.js"
click node_input "https://github.com/thiagops5/agro-nezer/blob/main/nezer-api/insumo/insumo.service.js"
click node_application "https://github.com/thiagops5/agro-nezer/blob/main/nezer-api/aplicacao/aplicacao.service.js"
click node_harvest "https://github.com/thiagops5/agro-nezer/blob/main/nezer-api/colheita/colheita.service.js"
click node_settlement "https://github.com/thiagops5/agro-nezer/blob/main/nezer-api/acerto/acerto.service.js"
click node_reports "https://github.com/thiagops5/agro-nezer/blob/main/nezer-api/relatorio/relatorio.service.js"
click node_web_layout "https://github.com/thiagops5/agro-nezer/blob/main/nezer-app/app/layout.tsx"
click node_web_home "https://github.com/thiagops5/agro-nezer/blob/main/nezer-app/app/page.tsx"

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_farmer,node_auth,node_authguard,node_api_start,node_db,node_operator toneBlue
class node_plot,node_culture,node_input toneAmber
class node_application,node_harvest,node_settlement,node_reports toneMint
class node_web_layout,node_web_home toneRose
```

## Components

### API and access

- [User management](https://github.com/thiagops5/agro-nezer/blob/main/nezer-api/usuario/usuario.controller.js): `nezer-api/usuario/usuario.controller.js`
- [Authentication](https://github.com/thiagops5/agro-nezer/blob/main/nezer-api/auth/auth.service.js): `nezer-api/auth/auth.service.js`
- [Access middleware](https://github.com/thiagops5/agro-nezer/blob/main/nezer-api/auth/auth.middleware.js): `nezer-api/auth/auth.middleware.js`
- [API startup](https://github.com/thiagops5/agro-nezer/blob/main/nezer-api/index.js): `nezer-api/index.js`
- [SQLite database](https://github.com/thiagops5/agro-nezer/blob/main/nezer-api/config/db.js): `nezer-api/config/db.js`

### Farm records

- [Plots](https://github.com/thiagops5/agro-nezer/blob/main/nezer-api/talhao/talhao.service.js): `nezer-api/talhao/talhao.service.js`
- [Crops](https://github.com/thiagops5/agro-nezer/blob/main/nezer-api/cultura/cultura.service.js): `nezer-api/cultura/cultura.service.js`
- [Agricultural inputs](https://github.com/thiagops5/agro-nezer/blob/main/nezer-api/insumo/insumo.service.js): `nezer-api/insumo/insumo.service.js`

### Operations and outcomes

- [Input applications](https://github.com/thiagops5/agro-nezer/blob/main/nezer-api/aplicacao/aplicacao.service.js): `nezer-api/aplicacao/aplicacao.service.js`
- [Harvest records](https://github.com/thiagops5/agro-nezer/blob/main/nezer-api/colheita/colheita.service.js): `nezer-api/colheita/colheita.service.js`
- [Financial settlement](https://github.com/thiagops5/agro-nezer/blob/main/nezer-api/acerto/acerto.service.js): `nezer-api/acerto/acerto.service.js`
- [Reports](https://github.com/thiagops5/agro-nezer/blob/main/nezer-api/relatorio/relatorio.service.js): `nezer-api/relatorio/relatorio.service.js`

### Web app

- [Web layout](https://github.com/thiagops5/agro-nezer/blob/main/nezer-app/app/layout.tsx): `nezer-app/app/layout.tsx`
- [Home page](https://github.com/thiagops5/agro-nezer/blob/main/nezer-app/app/page.tsx): `nezer-app/app/page.tsx`

### Other components

- **Farm user**

## Connections

- Farm user → Home page: uses (evidence: `README.md`)
- Home page → Web layout: renders within (evidence: `nezer-app/app/layout.tsx`)
- API startup → SQLite database: syncs (evidence: `nezer-api/index.js`)
- Plots → SQLite database: uses models
- Plots → Crops: includes (evidence: `nezer-api/talhao/talhao.service.js`)
- Plots → User management: includes (evidence: `nezer-api/talhao/talhao.service.js`)
- Plots → Input applications: checks records (evidence: `nezer-api/talhao/talhao.service.js`)
- Plots → Harvest records: checks records (evidence: `nezer-api/talhao/talhao.service.js`)
- Plots → Financial settlement: checks records (evidence: `nezer-api/talhao/talhao.service.js`)
