A Node.js API service that fetches weather data for Rwandan districts and generates actionable agricultural advice based on conditions like rainfall and humidity.
🌦️ SMART FARMER WEATHER API
This service provides weather data and farming advice specifically optimized for the Rwandan agricultural context.
FEATURES
Current Weather: Temperature, humidity, wind speed, and description.
Forecast: 3 to 5-day weather prediction.
Agri-Logic: Smart recommendations on spraying, planting, and harvesting based on weather conditions.
Location Support: Supports all major Rwandan districts.
INSTALLATION
1) Clone the repo
git clone
github.com smart-farmer-weather-api
2) Install Dependencies
npm install
3) ENVIRNOMENT VARIABLES
PORT=5000
WEATHER_API_KEY=your_openweathermap_api_key_here
WEATHER_BASE_URL=
api.openweathermap.org
4) Run Server
npm run dev
STRUCTURE
smart-farmer-weather-api/
├── src/
│ ├── config/
│ │ ├── database.ts # (Optional, if you save user profiles)
│ │ └── weather.config.ts # Stores the API Key base URL
│ ├── controllers/
│ │ └── weather.controller.ts # Handles fetch requests
│ ├── services/
│ │ ├── weather.service.ts # Calls External API (OpenWeatherMap)
│ │ └── location.service.ts # Maps Districts to Lat/Lon
│ ├── utils/
│ │ └── advice.utils.ts # Logic: "If rain, do X"
│ ├── types/
│ │ └── weather.types.ts # Interfaces for Weather Data
│ └── index.ts
├── .env.example
├── package.json
└── tsconfig.json