# rocko1825/agrocrew_frondend architecture

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

- Interactive diagram: https://gitdiagram.com/rocko1825/agrocrew_frondend
- Repository: https://github.com/rocko1825/agrocrew_frondend

## Overview

AgroCrew is an Angular frontend for producers, advisors, and administrators, backed by a Spring Boot REST API. Users sign in or recover access, then work through role-specific plot, evaluation, alert, map, dashboard, and administration screens; results and reports are presented in the browser. The route table confirms lazy-loaded screens and role guards, while the README documents additional feature areas whose source files are absent from this tree. Those unsampled features are represented at the subsystem level; edges cite only route declarations or README statements.

Main entry points: [`src/app/app.routes.ts`](https://github.com/rocko1825/agrocrew_frondend/blob/main/src/app/app.routes.ts) (Role-based routes), [`src/app/core/services/api.service.ts`](https://github.com/rocko1825/agrocrew_frondend/blob/main/src/app/core/services/api.service.ts) (HTTP API client), [`src/app/core/services/reporte.service.ts`](https://github.com/rocko1825/agrocrew_frondend/blob/main/src/app/core/services/reporte.service.ts) (Zone dashboard), [`src/app/shared/components/mapa.ts`](https://github.com/rocko1825/agrocrew_frondend/blob/main/src/app/shared/components/mapa.ts) (Reusable maps and charts)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_app["Application shell<br/>[app.ts]"]
  node_routes["Role-based routes<br/>[app.routes.ts]"]
  node_sharedui["Reusable maps and charts<br/>[mapa.ts]"]
  node_csv["CSV export<br/>[csv.ts]"]
end

subgraph group_domain["AgroCrew workflows"]
  node_auth["Access and profile"]
  node_plots["Plot management"]
  node_evaluation["Crop evaluation"]
  node_alerts["Risk alerts<br/>[alerta.service.ts]"]
  node_riskmap["Risk map"]
  node_dashboard["Zone dashboard<br/>[reporte.service.ts]"]
  node_administration["Catalog and economic data"]
end

subgraph group_platform["Shared platform"]
  node_api["HTTP API client<br/>[api.service.ts]"]
  node_interceptor["JWT and error handling"]
  node_session["Session and roles<br/>[auth.service.ts]"]
  node_models["API data contracts<br/>[api.models.ts]"]
  node_localization["Spanish / English<br/>[idioma.ts]"]
  node_theme["Theme preference<br/>[tema.service.ts]"]
end

subgraph group_integration["External services"]
  node_backend{{"AgroCrew REST API"}}
  node_leaflet{{"OpenStreetMap / Leaflet"}}
end

node_user(("Producer / advisor / admin"))

node_user -->|"uses"| node_app
node_app -->|"hosts"| node_routes
node_routes -->|"loads"| node_auth
node_routes -->|"loads"| node_plots
node_routes -->|"loads"| node_evaluation
node_routes -->|"loads"| node_alerts
node_routes -->|"loads"| node_riskmap
node_routes -->|"loads"| node_dashboard
node_routes -->|"loads"| node_administration
node_auth -->|"requests"| node_api
node_plots -.->|"requests"| node_api
node_evaluation -.->|"requests"| node_api
node_alerts -->|"requests"| node_api
node_dashboard -->|"requests"| node_api
node_administration -.->|"requests"| node_api
node_api -->|"sends HTTP"| node_backend
node_api -->|"passes requests"| node_interceptor
node_interceptor -->|"reads token"| node_session
node_interceptor -->|"translates errors"| node_localization
node_auth -->|"manages session"| node_session
node_sharedui -.->|"renders maps"| node_leaflet
node_dashboard -.->|"exports data"| node_csv
node_app -->|"sets toaster theme"| node_theme
node_user -->|"selects language"| node_localization
node_user -->|"selects theme"| node_theme
node_plots -.->|"uses map"| node_sharedui
node_riskmap -.->|"uses map"| node_sharedui
node_dashboard -.->|"uses charts"| node_sharedui

click node_app "https://github.com/rocko1825/agrocrew_frondend/blob/main/src/app/app.ts"
click node_routes "https://github.com/rocko1825/agrocrew_frondend/blob/main/src/app/app.routes.ts"
click node_alerts "https://github.com/rocko1825/agrocrew_frondend/blob/main/src/app/core/services/alerta.service.ts"
click node_dashboard "https://github.com/rocko1825/agrocrew_frondend/blob/main/src/app/core/services/reporte.service.ts"
click node_api "https://github.com/rocko1825/agrocrew_frondend/blob/main/src/app/core/services/api.service.ts"
click node_interceptor "https://github.com/rocko1825/agrocrew_frondend/blob/main/src/app/core/interceptors/auth.interceptor.ts"
click node_session "https://github.com/rocko1825/agrocrew_frondend/blob/main/src/app/core/services/auth.service.ts"
click node_models "https://github.com/rocko1825/agrocrew_frondend/blob/main/src/app/core/models/api.models.ts"
click node_localization "https://github.com/rocko1825/agrocrew_frondend/blob/main/src/app/core/i18n/idioma.ts"
click node_theme "https://github.com/rocko1825/agrocrew_frondend/blob/main/src/app/core/services/tema.service.ts"
click node_sharedui "https://github.com/rocko1825/agrocrew_frondend/blob/main/src/app/shared/components/mapa.ts"
click node_csv "https://github.com/rocko1825/agrocrew_frondend/blob/main/src/app/shared/utils/csv.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_app,node_routes,node_sharedui,node_csv toneBlue
class node_auth,node_plots,node_evaluation,node_alerts,node_riskmap,node_dashboard,node_administration toneAmber
class node_api,node_interceptor,node_session,node_models,node_localization,node_theme toneMint
class node_backend,node_leaflet toneRose
class node_user toneIndigo
```

## Components

### User experience

- [Application shell](https://github.com/rocko1825/agrocrew_frondend/blob/main/src/app/app.ts): `src/app/app.ts`
- [Role-based routes](https://github.com/rocko1825/agrocrew_frondend/blob/main/src/app/app.routes.ts): `src/app/app.routes.ts`
- [Reusable maps and charts](https://github.com/rocko1825/agrocrew_frondend/blob/main/src/app/shared/components/mapa.ts): `src/app/shared/components/mapa.ts`
- [CSV export](https://github.com/rocko1825/agrocrew_frondend/blob/main/src/app/shared/utils/csv.ts): `src/app/shared/utils/csv.ts`

### AgroCrew workflows

- **Access and profile**
- **Plot management**
- **Crop evaluation**
- [Risk alerts](https://github.com/rocko1825/agrocrew_frondend/blob/main/src/app/core/services/alerta.service.ts): `src/app/core/services/alerta.service.ts`
- **Risk map**
- [Zone dashboard](https://github.com/rocko1825/agrocrew_frondend/blob/main/src/app/core/services/reporte.service.ts): `src/app/core/services/reporte.service.ts`
- **Catalog and economic data**

### Shared platform

- [HTTP API client](https://github.com/rocko1825/agrocrew_frondend/blob/main/src/app/core/services/api.service.ts): `src/app/core/services/api.service.ts`
- [JWT and error handling](https://github.com/rocko1825/agrocrew_frondend/blob/main/src/app/core/interceptors/auth.interceptor.ts): `src/app/core/interceptors/auth.interceptor.ts`
- [Session and roles](https://github.com/rocko1825/agrocrew_frondend/blob/main/src/app/core/services/auth.service.ts): `src/app/core/services/auth.service.ts`
- [API data contracts](https://github.com/rocko1825/agrocrew_frondend/blob/main/src/app/core/models/api.models.ts): `src/app/core/models/api.models.ts`
- [Spanish / English](https://github.com/rocko1825/agrocrew_frondend/blob/main/src/app/core/i18n/idioma.ts): `src/app/core/i18n/idioma.ts`
- [Theme preference](https://github.com/rocko1825/agrocrew_frondend/blob/main/src/app/core/services/tema.service.ts): `src/app/core/services/tema.service.ts`

### External services

- **AgroCrew REST API**
- **OpenStreetMap / Leaflet**

### Other components

- **Producer / advisor / admin**

## Connections

- Producer / advisor / admin → Application shell: uses (evidence: `README.md`)
- Application shell → Role-based routes: hosts (evidence: `src/app/app.ts`)
- Role-based routes → Access and profile: loads (evidence: `src/app/app.routes.ts`)
- Role-based routes → Plot management: loads (evidence: `src/app/app.routes.ts`)
- Role-based routes → Crop evaluation: loads (evidence: `src/app/app.routes.ts`)
- Role-based routes → Risk alerts: loads (evidence: `src/app/app.routes.ts`)
- Role-based routes → Risk map: loads (evidence: `src/app/app.routes.ts`)
- Role-based routes → Zone dashboard: loads (evidence: `src/app/app.routes.ts`)
- Role-based routes → Catalog and economic data: loads (evidence: `src/app/app.routes.ts`)
- Access and profile → HTTP API client: requests
- Plot management → HTTP API client: requests
- Crop evaluation → HTTP API client: requests
- Risk alerts → HTTP API client: requests (evidence: `src/app/core/services/alerta.service.ts`)
- Zone dashboard → HTTP API client: requests (evidence: `src/app/core/services/reporte.service.ts`)
- Catalog and economic data → HTTP API client: requests
- HTTP API client → AgroCrew REST API: sends HTTP (evidence: `README.md`)
- HTTP API client → JWT and error handling: passes requests
- JWT and error handling → Session and roles: reads token (evidence: `src/app/core/interceptors/auth.interceptor.ts`)
- JWT and error handling → Spanish / English: translates errors (evidence: `src/app/core/interceptors/auth.interceptor.ts`)
- Access and profile → Session and roles: manages session (evidence: `src/app/core/services/auth.service.ts`)
- Reusable maps and charts → OpenStreetMap / Leaflet: renders maps
- Zone dashboard → CSV export: exports data
- Application shell → Theme preference: sets toaster theme (evidence: `src/app/app.ts`)
- Producer / advisor / admin → Spanish / English: selects language (evidence: `README.md`)
- Producer / advisor / admin → Theme preference: selects theme (evidence: `README.md`)
- Plot management → Reusable maps and charts: uses map
- Risk map → Reusable maps and charts: uses map
- Zone dashboard → Reusable maps and charts: uses charts
