
apollo-subgraph-template
Template to create a new Apollo subgraph service using Entgo, Gqlgen, and some CI
Prerequisites
Common Docs / Links
Initial Setup
Take a look at these files and do any necessary changes to paths, names, or config details.
- go.mod
- Dockerfile
- docker-compose.psql.yml
- docker-compose.yml
- gqlgen.yml
- cue.mod/module.cue
- sonar-project.properties
Run the init.sh script to enter in a new module name and make the replacement in all files.
./init.sh
# enter the name of the module:
github.com/organization/repo-name
This project template already has two objects: Account and Tenant. Feel free to remove and delete those files from the ent/schema/ route.
This template also includes a custom ID type of UUID located in the same schema directory.
Common Commands
These are common commands to generate code, build the project, run pre-commit hooks, start up docker, and so on.
Generate all code for Entgo & Gqlgen
go generate ./...
Build project binary to bin/
make build
Dagger CI commands
# Init dagger once installed
dagger project init
# Install all dagger files to /pkg dir
dagger project update
Docker commands
# Start only postgres database
make dp
# Build all docker images
make db
# Start both docker images
make du
# Run both db & du commands
make da
Pre-commit commands
# Install all pre-commit hooks
pre-commit install
# Force run all pre-commit hooks
pre-commit run --all-files