Skip to content

DRoqueProgrammer/agriweather

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🌾 AgriWeather Dashboard

A monitoring dashboard for agricultural plots (talhões) that consumes public weather data, computes stress alerts, and exports CSV — built as a portfolio capstone aligned with AgTech/AgriSAAS products (inspired by Solinftec, Syngenta, Climate Fieldview).

Backend CI Frontend CI License: MIT Stack Stack Stack Stack

🇧🇷 Versão em português · 🇺🇸 English version


🇺🇸 English version

What it does

AgriWeather is a full-stack reference app that:

  1. Lets you register agricultural plots (talhão) with name, crop type, area (ha), and lat/long coordinates.
  2. Fetches the next 7 days of weather for each plot from the public, free, no-auth Open-Meteo API.
  3. Generates a water-stress alert when forecasted rainfall < 30% probability AND max temperature > 32°C — a simple agronomic heuristic documented in the code.
  4. Exports a CSV of the plot's forecast for further analysis (Excel, R, Pandas).
  5. Visualises everything in a Vue 3 SPA: dashboard with KPIs, a Leaflet map with plot pins, line charts of temperature/rainfall, and a "Create plot" form.

It is intentionally a small but production-shaped app: REST design, migrations, layered architecture, automated tests, containerised, CI on every push.

Architecture

+-----------------------+         +-----------------------+         +----------------------+
|  Vue 3 SPA            |  HTTP   |  Spring Boot 3 API    |  HTTP   |  Open-Meteo (public) |
|  (Vite + Tailwind)    | ------> |  (Java 21, JPA,       | ------> |  No auth required    |
|  Leaflet map          |  JSON   |   Flyway, Springdoc)  |  JSON   |                      |
+-----------------------+         +-----------+-----------+         +----------------------+
                                                |
                                                | JDBC
                                                v
                                    +-----------+-----------+
                                    |  Postgres 16          |
                                    |  (Timescale-ready)    |
                                    +-----------------------+

Why I built it

I am preparing for a Junior Web Developer role at an AgTech company (Solinftec's public stack on GitHub shows Vue + Kotlin/Java + YOLOv5 + MapLibre, so this project mirrors those choices at jr level). I wanted a complete, runnable, well-documented system that demonstrates:

  • I can design a clean REST API with Spring Boot 3.
  • I can build a usable, accessible Vue 3 UI.
  • I understand that agriculture is a data-and-time-series domain at scale.
  • I care about production hygiene: tests, migrations, containerisation, CI.

Stack

Layer Tech Why
Backend Java 21, Spring Boot 3.3, Spring Web, Spring Data JPA, Flyway, Springdoc OpenAPI, JUnit 5 Modern LTS, industry standard for backend roles in Brazil
Database PostgreSQL 16 Open source, supports PostGIS (future) and TimescaleDB (future) for the time-series direction
Frontend Vue 3 (Composition API) + Vite, Pinia, Vue Router, Tailwind CSS, Axios, Leaflet, Chart.js Vue 3 is explicitly listed in the job description; Leaflet is a free alternative to Mapbox/MapLibre
Migrations Flyway 10 Versioned SQL migrations, no surprises when onboarding
Container Docker + Docker Compose One command to start the whole stack
CI GitHub Actions Build, test, lint on every push — green badge at the top

How to run

Prerequisites: Docker Desktop, Node 20+ (only if you want to run the frontend outside Docker), Java 21 + Maven 3.9+ (only if you want to run the backend outside Docker).

# 1) Clone
git clone https://github.com/DRoqueProgrammer/agriweather.git
cd agriweather

# 2) Start everything (postgres, backend, frontend)
docker compose up --build

# 3) Open
#   Frontend (dev): http://localhost:5173
#   Backend API:    http://localhost:8080
#   OpenAPI docs:  http://localhost:8080/swagger-ui.html
#   Postgres:       localhost:5432  (user/pass: agriweather/agriweather)

To stop: docker compose down. To wipe the database: docker compose down -v.

Run only the backend (no Docker)

cd backend
# start postgres any way you like, then:
export DATABASE_URL=jdbc:postgresql://localhost:5432/agriweather
export DATABASE_USERNAME=agriweather
export DATABASE_PASSWORD=agriweather
./mvnw spring-boot:run

Run only the frontend (no Docker)

cd frontend
npm install
npm run dev
# opens http://localhost:5173, talks to the backend at http://localhost:8080

REST API quick reference

Method Path Description
GET /api/plots List all plots
POST /api/plots Create a plot
GET /api/plots/{id} Get one plot
PUT /api/plots/{id} Update a plot
DELETE /api/plots/{id} Delete a plot
GET /api/plots/{id}/forecast?days=7 Get 1–14 day forecast (calls Open-Meteo)
GET /api/plots/{id}/alerts Get active water-stress alerts
GET /api/plots/{id}/export.csv?days=7 Download forecast as CSV

Full schema: http://localhost:8080/swagger-ui.html (Springdoc).

Tests

cd backend && ./mvnw test           # 14 unit + slice tests
cd frontend && npm run test         # Vitest unit tests

What I learned building this

  • How to wire Flyway migrations with Spring Boot 3 and JPA, and the gotcha of @Column ↔ SQL NOT NULL divergence.
  • How to call an external REST API with RestClient (Spring 6.1) and how to add a simple in-memory cache to be polite to the public API.
  • How to draw a real Leaflet map with custom markers, popups, and a "fit bounds" to multiple plots.
  • How to set up GitHub Actions with services (Postgres) and parallel matrix jobs for backend + frontend.

Next steps (what I'd build if I had more time)

  • Add a Vuexy/Plotly heatmap of soil moisture interpolated from weather.
  • PostGIS column for the plot polygon (not just point) — would enable buffer/area analysis.
  • JWT auth with a users table — currently the API is open.
  • WebSocket push of alerts instead of polling.
  • Helm chart for Kubernetes.

License

MIT — see LICENSE.


🇧🇷 Versão em português

O que faz

O AgriWeather é uma aplicação full-stack de referência que:

  1. Permite cadastrar talhões agrícolas com nome, cultura, área (ha) e coordenadas lat/long.
  2. Busca a previsão dos próximos 7 dias para cada talhão na API pública Open-Meteo (grátis, sem chave).
  3. Gera um alerta de estresse hídrico quando a previsão tem < 30% de probabilidade de chuva E temperatura máxima > 32°C — uma heurística agronômica simples documentada no código.
  4. Exporta um CSV da previsão do talhão pra análise em Excel, R, Pandas.
  5. Visualiza tudo numa SPA Vue 3: dashboard com KPIs, mapa Leaflet com pins dos talhões, gráficos de temperatura/chuva, formulário de criação.

É intencionalmente um app pequeno mas com forma de produção: REST design, migrations, arquitetura em camadas, testes automatizados, containerizado, CI em todo push.

Por que eu fiz

Estou me preparando pra vaga de Analista Desenvolvimento Web Jr numa AgTech (a Solinftec, cujo stack público no GitHub mostra Vue + Kotlin/Java + YOLOv5 + MapLibre — este projeto espelha essas escolhas em nível jr). Eu queria um sistema completo, executável e bem documentado que demonstrasse:

  • Sei desenhar uma API REST limpa com Spring Boot 3.
  • Sei construir uma UI Vue 3 usável e acessível.
  • Entendo que agro é um domínio de dados e séries temporais em escala.
  • Me importo com higiene de produção: testes, migrations, containerização, CI.

Como rodar

Pré-requisitos: Docker Desktop, Node 20+ (só se quiser rodar o frontend fora do Docker), Java 21 + Maven 3.9+ (só se quiser rodar o backend fora do Docker).

git clone https://github.com/DRoqueProgrammer/agriweather.git
cd agriweather
docker compose up --build

Abra:

Endpoints REST (resumo)

Método Path Descrição
GET /api/plots Lista todos os talhões
POST /api/plots Cria um talhão
GET /api/plots/{id} Busca um talhão
PUT /api/plots/{id} Atualiza um talhão
DELETE /api/plots/{id} Remove um talhão
GET /api/plots/{id}/forecast?days=7 Previsão de 1–14 dias (chama Open-Meteo)
GET /api/plots/{id}/alerts Alertas de estresse hídrico ativos
GET /api/plots/{id}/export.csv?days=7 Baixa a previsão em CSV

Schema completo: http://localhost:8080/swagger-ui.html (Springdoc).

O que aprendi

  • Como ligar Flyway com Spring Boot 3 e JPA, e o gotcha da divergência entre @Column e SQL NOT NULL.
  • Como chamar API REST externa com RestClient (Spring 6.1) e como adicionar cache em memória pra ser educado com a API pública.
  • Como desenhar um mapa Leaflet real com markers customizados, popups e "fit bounds" pra múltiplos talhões.
  • Como configurar GitHub Actions com services (Postgres) e jobs em matriz paralela pra backend + frontend.

Próximos passos

  • Heatmap de umidade do solo interpolada a partir do clima (Plotly/Vuexy).
  • Coluna PostGIS pro polígono do talhão (não só ponto) — permitiria análise de buffer/área.
  • JWT auth com tabela users — hoje a API é aberta.
  • WebSocket pra push de alertas em vez de polling.
  • Helm chart pra Kubernetes.

Licença

MIT — veja LICENSE.


Contributing

Issues e PRs são bem-vindos! Por favor leia CONTRIBUTING.md antes.

Author

Davi Roque — daviroque.luiz03@gmail.com · LinkedIn · GitHub

Built as a portfolio capstone while preparing for a Junior Web Developer role at an AgTech company (Solinftec — public job posting 4425371310).

About

🌾 AgriWeather Dashboard — full-stack reference app for monitoring agricultural plots (Java 21 + Spring Boot 3 + Vue 3 + Postgres + Leaflet). Portfolio capstone aligned with AgTech products (Solinftec, Syngenta).

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors