Skip to content

AndriyKalashnykov/gqlgen-graphql-subscriptions

Repository files navigation

CI Hits License: MIT Renovate enabled

gqlgen-graphql-subscriptions

GraphQL Subscriptions with Go and gqlgen

Requirements

  • gvm Go 1.23
    gvm install go1.23 --prefer-binary --with-build-tools --with-protobuf
    gvm use go1.23 --default
  • gqlgen
  • docker
  • docker-compose
  • nvm
    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
    nvm install v22.1.0
    nvm use nvm v22.1.0
    cd ./frontend && pnpm install -g yarn
  • curl
  • jq

Help

$ make
Usage: make COMMAND
Commands :
help             - List available tasks
clean            - Cleanup
generate         - Generate GraphQL go source code
test             - Run tests
build            - Build GraphQL API
run              - Run GraphQL API
image            - Build Docker image
build-frontend   - Build JS client frontend
run-frontend     - Run JS client frontend
image-frontend   - Build JS client Docker image
get              - Download and install packages
deps             - Download and install dependencies
release          - Create and push a new tag. Modify `Version` field in `server.go` as it's used as an actual tag name
update           - Update dependencies to latest versions
version          - Print current version(tag)
redis-up         - Start Redis
redis-down       - Stop Redis

Run

Terminal 1

Start Redis

make redis-up

Terminal 2

Run GraphQL API

make run

Terminal 3

Run JS client frontend. Command below should open a browser at http://localhost:3000. Open another window at http://localhost:3000 post a message and see it appear in the other window.

make run-frontend

References