How fruit-vale/backend works
FruitVale API serves a multi-company fruit-farming platform. Authenticated clients manage companies, properties, plots and crop seasons; IoT sensors publish measurements that are ingested, stored and used for alerts and dashboard views. Other documented product areas include forecasts, market information and export contracts. The graph emphasizes relationships visible in excerpts, the SOURCE INDEX, or the README; unsampled subsystems are included where documented, but their internal connections are not inferred.
Main entry points: prisma.service.ts PostgreSQL · ingestao.service.ts Reading ingestion · sensores.service.ts Sensor management · dynsec.service.ts MQTT Dynamic Security
Components 23
Access & tenants
- Authentication
src/auth/auth.service.ts - Data scope
src/auth/escopo.ts - User management
src/usuarios/usuarios.service.ts - Company management
src/empresas/empresas.service.ts
Farm operations
- Properties
src/propriedades/propriedades.service.ts - Plots & geometry
src/lotes/lotes.service.ts - Crop seasons
src/lotes/safras.service.ts - Cultures
src/culturas/culturas.service.ts
IoT & monitoring
- Sensor management
src/sensores/sensores.service.ts - Broker administration
src/mqtt/dispositivos.service.ts - MQTT Dynamic Security
src/mqtt/dynsec.service.ts - Reading ingestion
src/leituras/ingestao.service.ts - Measurement alerts
src/alertas/alertas.service.ts
Decision support
- Dashboard & readings
src/painel/painel.service.ts - Harvest forecast
src/previsao/previsao.service.ts - Market information
src/mercado/mercado.service.ts - Market import
src/mercado/mercado-importacao.service.ts - Export contracts
src/contrato/contrato.service.ts
Platform services
- Email delivery
src/email/email.service.ts - PostgreSQL
src/prisma/prisma.service.ts - Redis cache
src/redis/redis.service.ts
Other components
- Frontend client
- Mosquitto broker
Connections 35
- Frontend client → Authentication: logs in
- Frontend client → User management: manages users
- Frontend client → Company management: manages companies
- Authentication → PostgreSQL: reads users
src/auth/auth.service.ts - User management → PostgreSQL: reads and writes
src/usuarios/usuarios.service.ts - Company management → PostgreSQL: reads and writes
src/empresas/empresas.service.ts - Frontend client → Properties: manages properties
- Frontend client → Plots & geometry: manages plots
- Plots & geometry → Crop seasons: routes season actions
src/lotes/lotes.controller.ts - Crop seasons → Plots & geometry: uses plot service
src/lotes/safras.service.ts - Frontend client → Cultures: manages cultures
- Frontend client → Sensor management: manages sensors
- Frontend client → Broker administration: administers devices
- Broker administration → MQTT Dynamic Security: delegates broker access
src/mqtt/mqtt.controller.ts - MQTT Dynamic Security → Mosquitto broker: publishes commands
src/mqtt/dynsec.service.ts - Mosquitto broker → Reading ingestion: delivers readings
src/leituras/ingestao.service.ts - Reading ingestion → MQTT Dynamic Security: subscribes to topics
src/leituras/ingestao.service.ts - Reading ingestion → PostgreSQL: stores readings
src/leituras/ingestao.service.ts - Reading ingestion → Redis cache: caches sensor lookup
src/leituras/ingestao.service.ts - Frontend client → Measurement alerts: views alerts
- Frontend client → Dashboard & readings: views readings
- Frontend client → Harvest forecast: requests forecasts
- Frontend client → Market information: views market data
- Market information → Market import: uses import service
src/mercado/mercado.service.ts - Frontend client → Export contracts: manages contracts
- Export contracts → PostgreSQL: reads and writes
src/contrato/contrato.service.ts - Export contracts → Email delivery: sends contract email
src/contrato/contrato.service.ts - Properties → PostgreSQL: reads and writes
src/propriedades/propriedades.service.ts - Cultures → PostgreSQL: reads and writes
src/culturas/culturas.service.ts - Sensor management → PostgreSQL: reads and writes
src/sensores/sensores.service.ts - Sensor management → Reading ingestion: uses ingestion service
src/sensores/sensores.service.ts - Sensor management → MQTT Dynamic Security: uses broker security
src/sensores/sensores.service.ts - Market information → PostgreSQL: reads market data
src/mercado/mercado.service.ts - Harvest forecast → PostgreSQL: reads farm data
src/previsao/previsao.service.ts - Dashboard & readings → PostgreSQL: reads dashboard data
src/painel/painel.service.ts