{"id":16260052,"url":"https://github.com/cludden/todo-grpc","last_synced_at":"2025-04-08T13:49:28.192Z","repository":{"id":72389663,"uuid":"144525202","full_name":"cludden/todo-grpc","owner":"cludden","description":"an example gRPC application that powers a GraphQL \u0026 RESTful JSON api written in go  ","archived":false,"fork":false,"pushed_at":"2018-08-21T14:28:11.000Z","size":155,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-14T10:17:59.143Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/cludden.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","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}},"created_at":"2018-08-13T03:31:02.000Z","updated_at":"2024-01-13T23:58:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"8a820415-2fbd-473d-8615-62d5f9961c2e","html_url":"https://github.com/cludden/todo-grpc","commit_stats":{"total_commits":6,"total_committers":1,"mean_commits":6.0,"dds":0.0,"last_synced_commit":"9b3d367ce480859ad9c53a4fe0b8aa1ba4f808cb"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cludden%2Ftodo-grpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cludden%2Ftodo-grpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cludden%2Ftodo-grpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cludden%2Ftodo-grpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cludden","download_url":"https://codeload.github.com/cludden/todo-grpc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247854532,"owners_count":21007354,"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","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":"2024-10-10T16:06:09.756Z","updated_at":"2025-04-08T13:49:28.167Z","avatar_url":"https://github.com/cludden.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# todo-grpc\na sample Todo [gRPC](https://grpc.io/) application that powers both a [GraphQL](https://graphql.org/) API (using [gqlgen](https://github.com/99designs/gqlgen)) as well as a more traditional RESTful JSON API (powered by [grpc-gateway](https://github.com/grpc-ecosystem/grpc-gateway)), all communicating via an [Envoy](https://www.envoyproxy.io/) service mesh\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"./architecture.png\" align=\"center\" alt=\"architecture diagram\" /\u003e\n\u003c/p\u003e\n\n## Installation\n*__Prerequisites__:*\n- [go@v1.10](https://golang.org/doc/install)\n- [dep@v0.4](https://github.com/golang/dep)\n- [retool@v0.82](https://github.com/twitchtv/retool)\n- [docker@v1.18](https://store.docker.com/search?type=edition\u0026offering=community)\n- [docker-compose@v1.22](https://docs.docker.com/compose/install/)\n- [a configured go workspace](https://golang.org/doc/code.html)\n\n```shell\n# clone this repository\n$ git clone https://github.com/cludden/todo-grpc $GOPATH/src/todo-grpc\n\n# install dependencies and sync vendored executables\n$ cd $GOPATH/src/todo-grpc \u0026\u0026 dep ensure -vendor-only \u0026\u0026 retool sync\n```\n\n## Documentation\n- View the source code documentation at [localhost:6060/pkg/todo-grpc/](http://localhost:6060/pkg/todo-grpc/) with `godoc`:\n    ```shell\n    $ godoc -http=:6060\n    ```\n\n- View the protobuf source at [proto/todo.proto](proto/todo.proto):\n\n\n- View the gRPC api documentation in your default browser:\n    ```shell\n    # on macos\n    $ open ./docs/index.html\n\n    # on linux\n    $ xdg-open ./docs/index.html\n    ```\n\n- View the RESTful JSON api documentation at [localhost:8080](http://localhost:8080) with `docker`:\n    ```shell\n    $ docker run -p 8080:8080 -e SWAGGER_JSON=/todo/todo.swagger.json -v $GOPATH/src/todo-grpc/docs:/todo -it swaggerapi/swagger-ui\n    ```\n\n## Getting Started\n1. [Build the application](#Building)\n   ```shell\n    $ retool do goreleaser --snapshot --rm-dist --skip-publish\n    ```\n2. Run the application with docker\n    ```shell\n    $ docker-compose up -d elasticsearch \u0026\u0026 \\\n        sleep 5s \u0026\u0026 \\\n        docker-compose up --scale todo-grpc=3\n    ```\n3. Explore the RESTful JSON api running at [localhost:8080](http://localhost:8080)\n   ```shell\n    # create a todo\n    $ curl -X POST \\\n        -H 'Content-Type: application/json' \\\n        -d '{\"title\":\"task one\",\"description\":\"the first task\"}' \\\n        localhost:8080/todos\n    \n    # list all todos\n    $ curl localhost:8080/todos\n\n    # mark todo as completed\n    $ curl -X POST localhost:8080/todos/{id}/completion\n   ```\n4. Explore the GraphQL api via the GraphQL Playground running at [localhost:8080](http://localhost:8080)\n\n## Code Generation\nThe following components are generated from [protobuf source](./protos/todo.proto) using `protoc`:\n- gRPC server stub\n- gRPC client sdk\n- gRPC documentation (both HTML and markdown)\n- gRPC Gateway server (RESTful JSON api server)\n- Swagger/OpenAPI documentation (for REST api)\n  \nThe following components are generated from the [GraphQL schema](./graphql/schema.graphql) using `gqlgen`:\n- GraphQL server stub\n- GraphQL domain types\n\n*__Prerequisites__:*\n- all prerequisites listed under [installation](#Installation)\n- [protoc@v3](https://github.com/google/protobuf)\n- [protoc-gen-grpc-gateway](https://github.com/grpc-ecosystem/grpc-gateway)\n   - `go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway`\n- [protoc-gen-swagger](https://github.com/grpc-ecosystem/grpc-gateway)\n   - `go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger`\n\n```shell\n# set protoc path pointing to the root protoc directory (containing bin, include)\n$ export PROTOC_PATH=/path/to/protoc\n\n# run protobuf code gen via protoc\n$ retool do protoc \\\n    -I $GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \\\n    -I $GOPATH/src \\\n    -I $PROTOC_PATH \\\n    -I $GOPATH/src/todo-grpc/proto \\\n    --go_out=plugins=grpc:$GOPATH/src/todo-grpc/proto \\\n    --grpc-gateway_out=logtostderr=true:$GOPATH/src/todo-grpc/proto \\\n    --swagger_out=logtostderr=true:$GOPATH/src/todo-grpc/docs \\\n    --doc_out=$GOPATH/src/todo-grpc/docs \\\n    --doc_opt=html,index.html \\\n    todo.proto\n\n# do post processing\n$ retool do protoc-go-inject-tag -input=./proto/todo.pb.go\n\n# run graphql code gen via gqlgen\n$ retool do gqlgen\n```\n\n## Building\n```shell\n$ retool do goreleaser --snapshot --rm-dist --skip-publish\n```\n\n## Todo\n- [ ] add tests\n- [x] add better error propagation\n- [x] add edge proxy\n- [ ] add tls\n- [ ] prometheus \u0026 grafana\n- [ ] add second service\n\n## License\nCopyright (c) 2018 Chris Ludden\n\nLicensed under the [MIT License](LICENSE.md)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcludden%2Ftodo-grpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcludden%2Ftodo-grpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcludden%2Ftodo-grpc/lists"}