{"id":50403074,"url":"https://github.com/rsachdeva/weather-service","last_synced_at":"2026-05-31T00:04:37.675Z","repository":{"id":355649015,"uuid":"1219188768","full_name":"rsachdeva/weather-service","owner":"rsachdeva","description":"HTTP weather service in Go — NWS API, structured logging, per-IP rate limiting, testify mocks. Built with Go 1.26 toolchain.","archived":false,"fork":false,"pushed_at":"2026-05-04T16:03:27.000Z","size":54,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-04T17:35:52.399Z","etag":null,"topics":["cloud-native","go","go126","golang","microservice","rate-limiter","rest-api","slog"],"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/rsachdeva.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-23T16:09:20.000Z","updated_at":"2026-04-23T17:07:57.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/rsachdeva/weather-service","commit_stats":null,"previous_names":["rsachdeva/weather-service"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/rsachdeva/weather-service","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rsachdeva%2Fweather-service","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rsachdeva%2Fweather-service/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rsachdeva%2Fweather-service/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rsachdeva%2Fweather-service/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rsachdeva","download_url":"https://codeload.github.com/rsachdeva/weather-service/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rsachdeva%2Fweather-service/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33714036,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-30T02:00:06.278Z","response_time":92,"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":["cloud-native","go","go126","golang","microservice","rate-limiter","rest-api","slog"],"created_at":"2026-05-31T00:04:34.636Z","updated_at":"2026-05-31T00:04:37.664Z","avatar_url":"https://github.com/rsachdeva.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Weather Service\n\nHTTP server that returns the current forecast and temperature classification for a given location using the [National Weather Service API](https://www.weather.gov/documentation/services-web-api).\n\n## Requirements\n\n- Go 1.26+ — install from https://go.dev/dl/\n\n## Build check\n\n```sh\nmake build-check\n```\n\n## Test\n\n```sh\nmake test\n```\n\n## Run\n\n```sh\nmake run\n```\n\nServer starts on port 8080 by default. Override with:\n\n```sh\nmake run PORT=9090\n```\n\n## Debug logging\n\nLogs full NWS raw response bodies at DEBUG level:\n\n```sh\nmake run-debug        # raw JSON output\nmake run-debug-jq     # pretty-printed via jq (requires jq installed)\n```\n\n\n## Test the endpoint\n\n**Plano, TX:**\n\n```sh\ncurl \"http://localhost:8080/weather?lat=33.019844\u0026lon=-96.698883\"\n```\n\n**El Segundo, CA** (2 hours behind Plano, TX — good edge case):\n\n```sh\ncurl \"http://localhost:8080/weather?lat=33.9192\u0026lon=-118.4165\"\n```\n\n**Fairbanks, AK** (extreme cold edge case):\n\n```sh\ncurl \"http://localhost:8080/weather?lat=64.8401\u0026lon=-147.7164\"\n```\n\nResponse:\n\n```json\n{\n  \"forecast\": \"Mostly Cloudy\",\n  \"temperature_classification\": \"moderate\"\n}\n```\n\n- `forecast` — short forecast string from NWS (`periods[0].shortForecast`)\n- `temperature_classification` — `very hot` (\u003e=100°F), `hot` (\u003e=85°F), `cold` (\u003c=55°F), `very cold` (\u003c=30°F), or `moderate`\n- `periods[0]` is always the active NWS period for the location's local time — pre-dawn returns \"Overnight\", not \"Today\"\n\n## Rate limiting\n\nPer-IP rate limiter: 5 req/sec, burst of 10. Start the server first (`make run`), then fire 20 concurrent requests against `/health` (instant response, no NWS latency) to observe the burst limit:\n\n```sh\nfor i in $(seq 1 20); do curl -s -o /dev/null -w \"%{http_code}\\n\" \"http://localhost:8080/health\" \u0026 done; wait\n```\n\nFirst 10 return `200`, remainder return `429 Too Many Requests`.\n\nAlso, observable with the actual weather endpoint (NWS latency spreads responses but 429s still appear):\n\n```sh\nfor i in $(seq 1 20); do curl -s -o /dev/null -w \"%{http_code}\\n\" \"http://localhost:8080/weather?lat=33.019844\u0026lon=-96.698883\" \u0026 done; wait\n```\n\n## Health check\n\n```sh\ncurl http://localhost:8080/health\n```\n\n\n## Development\n\nEnable pre-commit hooks (Go version check, fmt, fix-diff, lint):\n\n```sh\ngit config core.hooksPath .githooks\n```\n\nRun checks manually:\n\n```sh\nmake fmt-diff   # show formatting diff\nmake fix-diff   # show go fix changes\nmake lint       # golangci-lint\n```\n\n## Status\n\nVersion 0.1 — work in progress.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frsachdeva%2Fweather-service","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frsachdeva%2Fweather-service","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frsachdeva%2Fweather-service/lists"}