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