{"id":30284250,"url":"https://github.com/camerodev/weatherforecast","last_synced_at":"2026-04-15T13:33:08.486Z","repository":{"id":306563164,"uuid":"994761969","full_name":"camerodev/WeatherForecast","owner":"camerodev","description":"Weather Forecast Service","archived":false,"fork":false,"pushed_at":"2025-06-02T12:59:02.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-26T13:59:14.982Z","etag":null,"topics":["docker","gin","golang","testing"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/camerodev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-02T12:49:10.000Z","updated_at":"2025-06-02T12:59:55.000Z","dependencies_parsed_at":"2025-07-26T13:59:21.188Z","dependency_job_id":"11c5e685-2bd7-4ba1-9b0b-dfd34c58bf64","html_url":"https://github.com/camerodev/WeatherForecast","commit_stats":null,"previous_names":["camerodev/weatherforecast"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/camerodev/WeatherForecast","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/camerodev%2FWeatherForecast","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/camerodev%2FWeatherForecast/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/camerodev%2FWeatherForecast/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/camerodev%2FWeatherForecast/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/camerodev","download_url":"https://codeload.github.com/camerodev/WeatherForecast/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/camerodev%2FWeatherForecast/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270756349,"owners_count":24639867,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-16T02:00:11.002Z","response_time":91,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","gin","golang","testing"],"created_at":"2025-08-16T19:01:14.230Z","updated_at":"2026-04-15T13:33:08.449Z","avatar_url":"https://github.com/camerodev.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Weather Forecast Service\n\nA modular and testable Golang HTTP service that retrieves weather data from the National Weather Service API, returning a short forecast and a temperature classification (\"hot\", \"moderate\", or \"cold\"). Built using the Gin framework with a focus on SOLID principles, Swagger documentation, and containerized deployment.\n\n---\n\n## Project Overview\n\nThis service exposes an HTTP GET endpoint that:\n- Accepts latitude and longitude as query parameters\n- Queries the NWS.gov forecast API\n- Returns the short forecast and a human-friendly temperature description\n- Is suitable for consumption by web clients, monitoring agents, or mobile apps\n\n---\n\n## Features\n\n- RESTful API using Gin\n- Integration with the National Weather Service gridpoints API\n- Temperature classification logic\n- Swagger (OpenAPI 3) documentation\n- Fully containerized using Docker and Docker Compose\n- Middleware for logging and request validation\n- Unit and integration test coverage\n- Clean architecture and dependency injection\n\n---\n\n## Project Structure\n\n```\nWeatherForecast/\n├── cmd/                    # Application entry point\n│   └── server/\n│       └── main.go\n├── internal/               # Application logic\n│   ├── client/             # Weather API client\n│   ├── config/             # Environment configuration loader\n│   ├── controller/         # HTTP handlers\n│   ├── middleware/         # Logging and validation middleware\n│   ├── model/              # Data models and response structs\n│   ├── router/             # Route definitions\n│   ├── service/            # Business logic\n│   └── utils/              # Utility functions (e.g., temperature classification)\n├── tests/                  # Unit and integration tests\n├── API_doc/                # Generated Swagger documentation\n├── Dockerfile              # Container build configuration\n├── docker-compose.yml      # Multi-container orchestration\n├── go.mod                  # Go module file\n└── README.md               # Project documentation\n```\n\n---\n\n## Prerequisites\n\n- Go 1.22 or higher\n- Docker and Docker Compose\n- Swag CLI (for generating Swagger docs)\n\nTo install Swag CLI:\n\n```bash\ngo install github.com/swaggo/swag/cmd/swag@latest\n```\n\n---\n\n## Installation \u0026 Running Locally\n\n1. Clone the repository:\n\n```bash\ngit clone https://github.com/camerodev/WeatherForecast.git\ncd WeatherForecast\n```\n\n2. Install dependencies:\n\n```bash\ngo mod tidy\n```\n\n3. Generate Swagger documentation:\n\n```bash\nswag init --generalInfo cmd/server/main.go --output ./API_doc\n```\n\n4. Start the server:\n\n```bash\ngo run cmd/server/main.go\n```\n\n5. Test the API:\n\n```bash\ncurl \"http://localhost:8080/api/weather?lat=40.71\u0026lon=-74.01\"\n```\n\n---\n\n## Usage\n\n### Endpoint\n\n```\nGET /api/weather?lat={latitude}\u0026lon={longitude}\n```\n\n### Example\n\n```\nGET /api/weather?lat=40.71\u0026lon=-74.01\n```\n\n### Sample Response\n\n```json\n{\n  \"shortForecast\": \"Partly Cloudy\",\n  \"temperature\": 72,\n  \"unit\": \"F\",\n  \"feeling\": \"moderate\"\n}\n```\n\n---\n\n## Testing\n\nRun all tests:\n\n```bash\ngo test ./...\n```\n\nRun only unit tests:\n\n```bash\ngo test ./tests -run TestWeatherService -v\n```\n\nRun integration test against NWS API:\n\n```bash\ngo test ./tests -run TestLiveNWSClient -v\n```\n\n---\n\n## Docker\n\n### Build and run with Docker Compose:\n\n```bash\ndocker compose up --build\n```\n\nThis will build and expose the service at:\n\n```\nhttp://localhost:8080/api/weather?lat=40.71\u0026lon=-74.01\n```\n\n### Build manually:\n\n```bash\ndocker build -t weather-forecast .\ndocker run -p 8080:8080 weather-forecast\n```\n\n---\n\n## Swagger\n\n### Generate Swagger documentation:\n\n```bash\nswag init --generalInfo cmd/server/main.go --output ./API_doc\n```\n\n### Access Swagger UI in browser:\n\n```\nhttp://localhost:8080/api/swagger/index.html\n```\n\n---\n\n## Things to Be Improved\n\nIf more time were available, the following improvements would be prioritized:\n\n- Add in-memory or Redis caching for repeated forecast lookups\n- Support more granular forecast ranges (hourly, 3-day, etc.)\n- Add health and metrics endpoints (Prometheus + Grafana support)\n- Add support for environment-specific logging levels\n- Extend CI to include static analysis and test coverage reporting\n- Deploy to Kubernetes with Helm and configure liveness/readiness probes\n- Add OpenTelemetry tracing support\n- Write Postman or Newman-based integration tests for CI pipelines\n\n---\n\n## Author\n\nCameron Shahraray  \nEmail: cameron.shahr@gmail.com  \nGitHub: https://github.com/camerodev  \nLinkedIn: https://www.linkedin.com/in/cameronmshah\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcamerodev%2Fweatherforecast","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcamerodev%2Fweatherforecast","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcamerodev%2Fweatherforecast/lists"}