How diego-alonso-05/greenherb-api works
GREENHERB is a Spring REST API for herb-growing plans, environmental measurements and alerts, with JWT login and refresh tokens. The principal flow is a client creating a plan, submitting a measurement, and retrieving or resolving generated alerts; measurement handling compares conditions with the active plan and may send notifications. Herb catalog CRUD/CSV import and audit logging are additional implemented capabilities. The README identifies herbs and audit as present, though its scope note is inconsistent; edges are limited to relationships supported by excerpts, the source index, or README.
Main entry points: MeasurementService.java Measurement processing · AuthService.java Login service · HerbService.java Herb catalog service · AuthController.java Authentication API
Components 25
Access and security
- Authentication API
src/main/java/com/greenherb/greenherb_api/controller/AuthController.java - Login service
src/main/java/com/greenherb/greenherb_api/service/AuthService.java - JWT service
src/main/java/com/greenherb/greenherb_api/security/JwtService.java - Refresh tokens
src/main/java/com/greenherb/greenherb_api/service/RefreshTokenService.java - JWT request filter
src/main/java/com/greenherb/greenherb_api/security/JwtAuthFilter.java - Security configuration
src/main/java/com/greenherb/greenherb_api/config/SecurityConfig.java - User repository
src/main/java/com/greenherb/greenherb_api/repository/UserRepository.java - Refresh token repository
src/main/java/com/greenherb/greenherb_api/repository/RefreshTokenRepository.java
Growing operations
- Plans API
src/main/java/com/greenherb/greenherb_api/controller/PlanController.java - Plan rules
src/main/java/com/greenherb/greenherb_api/service/PlanService.java - Plan repository
src/main/java/com/greenherb/greenherb_api/repository/PlanRepository.java
Measurements and alerts
- Measurements API
src/main/java/com/greenherb/greenherb_api/controller/MeasurementController.java - Measurement processing
src/main/java/com/greenherb/greenherb_api/service/MeasurementService.java - Measurement repository
src/main/java/com/greenherb/greenherb_api/repository/MeasurementRepository.java - Alerts API
src/main/java/com/greenherb/greenherb_api/controller/AlertController.java - Alert handling
src/main/java/com/greenherb/greenherb_api/service/AlertService.java - Alert repository
src/main/java/com/greenherb/greenherb_api/repository/AlertRepository.java - Temperature gateway
src/main/java/com/greenherb/greenherb_api/gateway/TemperatureGateway.java - Notification gateway
src/main/java/com/greenherb/greenherb_api/gateway/NotificationGateway.java
Herb catalog and audit
- Herbs API
src/main/java/com/greenherb/greenherb_api/controller/HerbController.java - Herb catalog service
src/main/java/com/greenherb/greenherb_api/service/HerbService.java - Herb repository
src/main/java/com/greenherb/greenherb_api/repository/HerbRepository.java - Audit API
src/main/java/com/greenherb/greenherb_api/controller/AuditController.java - Audit repository
src/main/java/com/greenherb/greenherb_api/repository/AuditLogRepository.java
Other components
- API client
Connections 27
- API client → Authentication API: logs in
- Authentication API → Login service: delegates login
src/main/java/com/greenherb/greenherb_api/controller/AuthController.java - Login service → User repository: looks up user
src/main/java/com/greenherb/greenherb_api/service/AuthService.java - Login service → JWT service: creates access token
src/main/java/com/greenherb/greenherb_api/service/AuthService.java - Login service → Refresh tokens: creates refresh token
src/main/java/com/greenherb/greenherb_api/service/AuthService.java - Refresh tokens → Refresh token repository: stores token
src/main/java/com/greenherb/greenherb_api/service/RefreshTokenService.java - JWT request filter → JWT service: validates token
src/main/java/com/greenherb/greenherb_api/security/JwtAuthFilter.java - Security configuration → JWT request filter: registers filter
- API client → Plans API: manages plans
- Plans API → Plan rules: delegates
src/main/java/com/greenherb/greenherb_api/controller/PlanController.java - Plan rules → Plan repository: validates and persists
src/main/java/com/greenherb/greenherb_api/service/PlanService.java - API client → Measurements API: submits measurement
- Measurements API → Measurement processing: delegates
src/main/java/com/greenherb/greenherb_api/controller/MeasurementController.java - Measurement processing → Measurement repository: saves reading
src/main/java/com/greenherb/greenherb_api/service/MeasurementService.java - Measurement processing → Plan repository: reads active plan
src/main/java/com/greenherb/greenherb_api/service/MeasurementService.java - Measurement processing → Alert repository: checks and saves alerts
src/main/java/com/greenherb/greenherb_api/service/MeasurementService.java - Measurement processing → Notification gateway: sends alert notice
src/main/java/com/greenherb/greenherb_api/service/MeasurementService.java - Measurement processing → Temperature gateway: optional integration
src/main/java/com/greenherb/greenherb_api/service/MeasurementService.java - API client → Alerts API: queries or resolves
- Alerts API → Alert handling: delegates
src/main/java/com/greenherb/greenherb_api/controller/AlertController.java - Alert handling → Alert repository: reads and updates
src/main/java/com/greenherb/greenherb_api/service/AlertService.java - API client → Herbs API: manages herb catalog
- Herbs API → Herb catalog service: delegates
src/main/java/com/greenherb/greenherb_api/controller/HerbController.java - Herb catalog service → Herb repository: imports and persists
src/main/java/com/greenherb/greenherb_api/service/HerbService.java - Herb catalog service → Audit repository: writes audit records
src/main/java/com/greenherb/greenherb_api/service/HerbService.java - API client → Audit API: requests audit
- Audit API → Audit repository: queries logs
src/main/java/com/greenherb/greenherb_api/controller/AuditController.java