Create a configuration file
First, Conductor needs to know about your GraphQL server(s). You can do this by adding a new
Source
to Conductor.
Source
can either be a simple GraphQL server or a
federated setup of multiple GraphQL servers.
sources:
- id: my-graphql-server # defines the ID of the source
type: graphql # defines the type of the Source
config:
endpoint: https://my-server.com/graphql # points to the actual GraphQL endpoint
Then, you expose your Source
by using an Endpoint
object. Each endpoint is registered with it’s
own URL and can be configured to use a different Source
and a different set of plugins:
sources:
- id: my-graphql-server # defines the ID of the source
type: graphql # defines the type of the Source
config:
endpoint: https://my-server.com/graphql # points to the actual GraphQL endpoint
endpoints:
- path: /my-amazing-graphql-server # defines the base path for this endpoint
from: my-graphql-server # link this endpoint to a Source
Now, to enrich your GraphQL API with additional functionality, you can add plugins to your
Endpoint
. For example, you can add a graphiql
plugin to enable the GraphiQL IDE for your GraphQL
API, and http_get
to allow executing GraphQL operations overt HTTP GET
method:
sources:
- id: my-graphql-server # defines the ID of the source
type: graphql # defines the type of the Source
config:
endpoint: https://my-server.com/graphql # points to the actual GraphQL endpoint
endpoints:
- path: /my-amazing-graphql-server # defines the base path for this endpoint
from: my-graphql-server # link this endpoint to a Source
plugins:
- type: graphiql
- type: http_get
config:
mutations: false
Pick your runtime
Conductor can run as a standalon service through a binary/Docker image, or as a WASM on CloudFlare Worker.
Pick your preferred runtime and follow the instructions on how to load the configuration, deploy, and run Conductor.
For quick usage on your machine, you can run:
npx @graphql-conductor/bin ./conductor.config.yaml
The above packages and ships Conductor as a rust binary to npm, for quick and convinient usage.
You can also setup a package and install it as a dependency to have version control.
yarn init --yes
Then, run the binary using the alias conductor
:
yarn conductor ./conductor.config.yaml