{"id":26067358,"url":"https://github.com/roshbhatia/go-service-template","last_synced_at":"2026-05-01T06:31:58.885Z","repository":{"id":64306324,"uuid":"326928044","full_name":"roshbhatia/go-service-template","owner":"roshbhatia","description":"Template project for golang microservices","archived":false,"fork":false,"pushed_at":"2021-08-26T02:28:14.000Z","size":20,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-04T01:46:45.587Z","etag":null,"topics":["docker","go","microservice","rest-api","template"],"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/roshbhatia.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}},"created_at":"2021-01-05T08:00:43.000Z","updated_at":"2023-05-11T05:39:26.000Z","dependencies_parsed_at":"2023-01-15T10:45:13.909Z","dependency_job_id":null,"html_url":"https://github.com/roshbhatia/go-service-template","commit_stats":null,"previous_names":[],"tags_count":1,"template":true,"template_full_name":null,"purl":"pkg:github/roshbhatia/go-service-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roshbhatia%2Fgo-service-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roshbhatia%2Fgo-service-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roshbhatia%2Fgo-service-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roshbhatia%2Fgo-service-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/roshbhatia","download_url":"https://codeload.github.com/roshbhatia/go-service-template/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roshbhatia%2Fgo-service-template/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32487301,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"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","go","microservice","rest-api","template"],"created_at":"2025-03-08T21:44:16.725Z","updated_at":"2026-05-01T06:31:58.879Z","avatar_url":"https://github.com/roshbhatia.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-service-template\n\nThis is a template for Go-based microservices -- referred to as `echo-service` throughout the documentation. As the name suggests, the service echoes text sent via a REST endpoint.\n\nUpdated to Go 1.26.1 using idiomatic practices including `log/slog` and enhanced `net/http` routing.\n\n## REST API Contract\n\necho-service provides the following endpoints\n\n`GET /health`\n- Description: Returns a JSON object comprised of a timestamp of when the request was processed, the health status, and the http status returned by the endpoint\n\nResponse body schema:\n```json\n{\n    \"timestamp\" : \"string (RFC3339)\",\n    \"health_status\" : \"string\",\n    \"http_status\": \"string\" \n}\n```\n\n`POST /echo`\n- Description: Returns a JSON object comprised of a timestamp of when the request was processed, and the string POSTed to the endpoint\n  \nRequest body schema:\n```json\n{\n    \"echo_str\" : \"string\"\n}\n```\n \nResponse body schema:\n```json\n{\n    \"timestamp\" : \"string (RFC3339)\",\n    \"echo_str\" : \"string\"\n}\n```\n\n## Development Environment\n\nThis project includes a `shell.nix` for use with the Nix package manager. To enter the development environment with the correct Go version and tools:\n\n```bash\nnix-shell\n```\n\n## Config\n\necho-service fetches its config through the environment. The following environment variables are expected (or supported):\n- `SERVICE_PORT`\n  - optional: true (default: 8080)\n  - description: The port the REST API runs on.\n- `SSL_CERT_PATH`\n  - optional: true\n  - description: The full path of the SSL cert, must be set alongside `SSL_KEY_PATH` to enable HTTPS.\n- `SSL_KEY_PATH`\n  - optional: true\n  - description: The full path of the SSL key, must be set alongside `SSL_CERT_PATH` to enable HTTPS.\n\n## Makefile Usage\n\n`make clean`\n- Deletes `./bin` folder and associated artifacts.\n\n`make test`\n- Runs `go test` on all packages.\n\n`make run`\n- Runs the echo-service locally.\n\n`make build`\n- Compiles the echo-service binary, storing it in `./bin/echo-service`.\n\n`make docker-build`\n- Builds the docker container for echo-service.\n\n`make docker-run`\n- Runs the docker container.\n\n## Local Testing\n\nTest it with curl!\n```bash\n# For HTTP, locally\n$\u003e SERVICE_PORT=8080 make run \n$\u003e curl http://localhost:8080/health \n$\u003e curl -d '{\"echo_str\":\"hello world\"}' -H 'Content-Type: application/json' http://localhost:8080/echo\n```\n\n## Features\n- Structured logging with `log/slog`.\n- Graceful shutdown using `signal.NotifyContext`.\n- Modern `net/http` routing (Go 1.22+).\n- Nix development shell.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froshbhatia%2Fgo-service-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froshbhatia%2Fgo-service-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froshbhatia%2Fgo-service-template/lists"}