How yonazakkart/agroalerta-sv works
AgroAlerta Morazán is an agricultural risk-prevention web platform for Morazán. An authenticated farmer registers a planting; the backend stores it and emits an event, while climate and CENTA-based crop viability inform yield, cost, risk, and recommendation reports that can be persisted and reviewed in history. The README documents the broader capabilities; source-index references and excerpts support the backend call edges shown. Frontend page-to-service wiring and some event-driven links are not excerpted, so those links are marked unverified rather than asserted as direct calls.
Main entry points: index.ts API server · reporte.service.ts Report service · siembra.routes.ts Planting routes · auth.middleware.ts Auth middleware
Components 24
Farmer interface
- Web routes
frontend/src/app/app.routes.ts - Farm workflows
frontend/src/app/pages - API clients
frontend/src/app/core
API and identity
- API server
backend/src/index.ts - Identity routes
backend/src/auth - Auth middleware
backend/src/auth/auth.middleware.ts
Crop and viability
- Viability routes
backend/src/viabilidad/viabilidad.routes.ts - CENTA viability
backend/src/viabilidad/service.ts - District catalog
backend/src/viabilidad/distritos.routes.ts - Planting routes
backend/src/siembra/siembra.routes.ts - Planting validation
backend/src/siembra/siembra.validacion.ts - Planting service
backend/src/siembra/siembra.service.ts
Climate service
- Climate routes
backend/src/clima/clima.routes.ts - Climate orchestration
backend/src/clima/orquestador.ts - Open-Meteo client
backend/src/clima/open-meteo.client.ts - Climate condition store
backend/src/clima/condicion.repo.ts
Estimation and events
- Domain event bus
backend/src/events/bus.ts - Estimate history routes
backend/src/estimacion/estimaciones.routes.ts - Report service
backend/src/estimacion/reporte.service.ts - Yield projection
backend/src/estimacion/proyeccion.ts - Risk recommendations
backend/src/estimacion/recomendacion.ts
Other components
- Farmer
- Neon Postgres
- Open-Meteo
Connections 31
- Farmer → Web routes: uses
- Web routes → Farm workflows: loads pages
frontend/src/app/app.routes.ts - Farm workflows → API clients: requests data
- API clients → API server: calls API
- API server → Identity routes: mounts routes
backend/src/index.ts - API server → Viability routes: mounts routes
backend/src/index.ts - API server → District catalog: mounts routes
backend/src/index.ts - API server → Climate routes: mounts routes
backend/src/index.ts - API server → Planting routes: mounts routes
backend/src/index.ts - API server → Estimate history routes: mounts routes
backend/src/index.ts - Viability routes → Auth middleware: guards requests
backend/src/viabilidad/viabilidad.routes.ts - Viability routes → CENTA viability: calls
backend/src/viabilidad/viabilidad.routes.ts - CENTA viability → Neon Postgres: reads
backend/src/viabilidad/service.ts - District catalog → Neon Postgres: reads
backend/src/viabilidad/distritos.routes.ts - Planting routes → Auth middleware: guards requests
backend/src/siembra/siembra.routes.ts - Planting routes → Planting validation: validates with
backend/src/siembra/siembra.routes.ts - Planting routes → Planting service: calls
backend/src/siembra/siembra.routes.ts - Planting service → Neon Postgres: reads and writes
backend/src/siembra/siembra.service.ts - Planting service → Domain event bus: emits planting event
backend/src/siembra/siembra.service.ts - Climate routes → Auth middleware: guards requests
backend/src/clima/clima.routes.ts - Climate routes → Climate orchestration: requests update
backend/src/clima/clima.routes.ts - Climate orchestration → Open-Meteo client: fetches weather
backend/src/clima/orquestador.ts - Open-Meteo client → Open-Meteo: requests forecasts
- Climate orchestration → Climate condition store: stores conditions
backend/src/clima/orquestador.ts - Climate condition store → Neon Postgres: reads and writes
- Estimate history routes → Auth middleware: guards requests
backend/src/estimacion/estimaciones.routes.ts - Estimate history routes → Report service: lists reports
backend/src/estimacion/estimaciones.routes.ts - Report service → Yield projection: uses projection
backend/src/estimacion/reporte.service.ts - Report service → Risk recommendations: uses recommendations
backend/src/estimacion/reporte.service.ts - Report service → Neon Postgres: reads and persists reports
backend/src/estimacion/reporte.service.ts - Domain event bus → Report service: triggers recalculation