We are seeking a skilled developer to build a robust Weather Data Aggregator service. This service will periodically fetch weather data from multiple public APIs, aggregate the information, and expose the results through a Fiber-based rest api.
Core Features:
- Fetch weather data from at least two public APIs (e.g., OpenWeatherMap,
WeatherAPI.com, Open-Meteo).
- Implement a scheduled fetch mechanism to run every 15 minutes.
- Aggregate and store both current and forecast weather data.
- Provide REST endpoints for querying the aggregated results.
Technical Requirements:
API Server (Fiber):
- Utilize Fiber v2 with logger, recover, and CORS middleware.
- Apply route groups (e.g., /Api/v1).
- Implement request validation and consistent error handling.
- Use Fiber's JSON serialization and graceful shutdown.
API Integration:
- Make concurrent calls to multiple weather APIs.
- Implement retry logic with exponential backoff for API calls.
- Normalize different response formats from various weather APIs.
- Handle failures gracefully, with optional circuit breaker implementation.
Data Processing:
- Aggregate values such as average temperatures and combined forecasts.
- Cache processed results for improved performance.
- Validate incoming data and store historical records (in-memory or persistent).
Scheduling:
- Use cron/ticker or a suitable scheduling library.
- Ensure prevention of overlapping executions for scheduled tasks.
- Log execution duration and any errors encountered during fetches.
REST Endpoints:
- GET /api/v1/weather/current?city={name} – for aggregated current weather.
- GET /api/v1/weather/forecast?city={name}&days={1-7} – for aggregated forecast.
- GET /api/v1/health – for service status and last successful fetch time.
Configuration:
- The service should be configurable via environment variables or a config file, including parameters like FIBER_PORT, WEATHER_API_KEY, FETCH_INTERVAL, and DEFAULT_CITIES (e.g., Prague, London, NewYork).
Deliverables:
- A Git repository containing all source code.
- A comprehensive readme file with setup instructions, architecture notes, and curl examples for api usage.
- An example .env file for configuration.
-
Go.mod and
go.sum files.
Notes:
- Emphasis should be placed on code quality, clear comments, production readiness, and leveraging Fiber's performance capabilities.
Delivery term: Not specified