Prerequisites
Ensure you have the following files generated from the Define Contracts step:- The directory containing your source
.graphqloperation files (e.g., ./services/). - The generated
service.protolocated inside that same directory.
1. Update Router Configuration
You need to modify your router’sconfig.yaml to enable the ConnectRPC server and tell it where to find your service definitions.
The router uses a storage provider to specify the root services directory. The router recursively walks this directory to discover all .proto files and their associated .graphql operations.
Add the following configuration blocks:
2. Run the router (docker example)
When running the router container, you must ensure:- The new ConnectRPC port (e.g., 5026) is exposed.
- The directory containing your service definitions is mounted into the container.
-p 3002:3002— Maps the standard GraphQL port.-p 5026:5026— Maps the ConnectRPC port configured inconfig.yaml.-v "$(pwd)/config.yaml:..."— Mounts your config file into the container.-v "$(pwd)/services:..."— Mounts your services directory containing proto and graphql files.
You will also need to pass any required environment variables (e.g.,
GRAPH_API_TOKEN) using -e flags.3. Verification
When the router starts, it will scan the mounted directories. Look at the logs to verify it has successfully discovered your services and operations. You should see output similar to this:-
discovered service: Confirms the service.proto file was found. -
loaded operations: Confirms the corresponding .graphql files were found and mapped. -
ConnectRPC server ready: Confirms the server is listening on the configured port.