{"id":48897251,"url":"https://github.com/chicunic/go-grpc-rest-demo","last_synced_at":"2026-04-16T11:38:04.956Z","repository":{"id":332880996,"uuid":"1063857328","full_name":"chicunic/go-grpc-rest-demo","owner":"chicunic","description":null,"archived":false,"fork":false,"pushed_at":"2026-03-23T06:19:24.000Z","size":51,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-24T01:46:20.915Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chicunic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2025-09-25T08:00:21.000Z","updated_at":"2026-03-23T06:19:27.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/chicunic/go-grpc-rest-demo","commit_stats":null,"previous_names":["chicunic/go-grpc-rest-demo"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/chicunic/go-grpc-rest-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chicunic%2Fgo-grpc-rest-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chicunic%2Fgo-grpc-rest-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chicunic%2Fgo-grpc-rest-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chicunic%2Fgo-grpc-rest-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chicunic","download_url":"https://codeload.github.com/chicunic/go-grpc-rest-demo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chicunic%2Fgo-grpc-rest-demo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31884474,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T11:36:10.202Z","status":"ssl_error","status_checked_at":"2026-04-16T11:36:09.652Z","response_time":69,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2026-04-16T11:38:04.203Z","updated_at":"2026-04-16T11:38:04.947Z","avatar_url":"https://github.com/chicunic.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go gRPC REST Demo\n\nA Go backend template demonstrating User and Product services with CRUD APIs, accessible via:\n\n1. **REST API** - Gin framework with Swagger documentation\n2. **gRPC API** - Native gRPC with Protocol Buffers\n3. **CLI Client** - Cobra-based command line interface\n\n## Features\n\n- **UserService**: Create, Read, Update, Delete, List users with filtering and sorting\n- **ProductService**: Create, Read, Search products with multi-condition filtering\n- **Dual Protocol**: REST (HTTP/JSON) and gRPC support\n- **Swagger Documentation**: Auto-generated API docs\n- **Graceful Shutdown**: Proper signal handling\n- **Thread-Safe**: Concurrent-safe in-memory storage\n\n## Quick Start\n\n### Prerequisites\n\n- Go 1.25+\n- (Optional) `protoc` for regenerating protobuf code\n- (Optional) `jq` for formatted JSON output\n\n### Run the Server\n\n```bash\nmake run-server\n```\n\nServer endpoints:\n\n- REST API: \u003chttp://localhost:8080/api/v1/\u003e\n- gRPC: localhost:9090\n- Swagger UI: \u003chttp://localhost:8080/swagger/index.html\u003e\n\n## API Endpoints\n\n### REST API (`/api/v1`)\n\n| Method | Endpoint           | Description                                    |\n|--------|--------------------|------------------------------------------------|\n| GET    | `/health`          | Health check                                   |\n| POST   | `/users`           | Create user                                    |\n| GET    | `/users`           | List users (with pagination, filter, sort)     |\n| GET    | `/users/:id`       | Get user by ID                                 |\n| PUT    | `/users/:id`       | Update user                                    |\n| DELETE | `/users/:id`       | Delete user                                    |\n| POST   | `/products`        | Create product                                 |\n| GET    | `/products/:id`    | Get product by ID                              |\n| GET    | `/products/search` | Search products (query, category, price range) |\n\n### gRPC Services (port 9090)\n\n| Service        | Methods                                                |\n|----------------|--------------------------------------------------------|\n| UserService    | CreateUser, GetUser, UpdateUser, DeleteUser, ListUsers |\n| ProductService | CreateProduct, GetProduct, SearchProducts              |\n\n### CLI Commands\n\n```bash\ngo run cmd/client/main.go user create \u003cusername\u003e \u003cemail\u003e \u003cfull_name\u003e\ngo run cmd/client/main.go user get \u003cid\u003e\ngo run cmd/client/main.go user list [--filter] [--sort-by]\ngo run cmd/client/main.go product create \u003cname\u003e \u003cdesc\u003e \u003cprice\u003e \u003cqty\u003e \u003ccategory\u003e\ngo run cmd/client/main.go product get \u003cid\u003e\ngo run cmd/client/main.go product search [--query] [--category] [--min-price] [--max-price]\n```\n\n## Make Commands\n\n```bash\nmake help           # Show all available commands\nmake deps           # Install dependencies\nmake build          # Build server and client binaries\nmake run-server     # Run the server\nmake run-dev        # Run with hot reload (requires air)\nmake test-unit      # Run unit tests\nmake test-coverage  # Generate coverage report\nmake lint           # Run golangci-lint\nmake swagger        # Generate Swagger docs\nmake proto          # Generate protobuf code\nmake endpoints      # Show all API endpoints\n```\n\n## Project Structure\n\n```text\ngo-grpc-rest-demo/\n├── api/\n│   ├── grpc/server/    # gRPC service implementations\n│   └── rest/           # REST handlers and router\n├── cmd/\n│   ├── client/         # CLI client (Cobra)\n│   └── server/         # Server entry point\n├── internal/\n│   ├── client/         # Client implementations (gRPC/REST)\n│   ├── errors/         # Standardized error handling\n│   ├── model/          # Data models and DTOs\n│   ├── response/       # API response helpers\n│   └── service/        # Business logic layer\n├── proto/              # Protocol Buffer definitions\n├── docs/               # Swagger documentation\n├── Makefile            # Build commands\n└── go.mod              # Go module\n```\n\n## License\n\nThis project is for demonstration purposes.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchicunic%2Fgo-grpc-rest-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchicunic%2Fgo-grpc-rest-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchicunic%2Fgo-grpc-rest-demo/lists"}