GithubHelp home page GithubHelp logo

the-guild-org / conductor Goto Github PK

View Code? Open in Web Editor NEW
83.0 11.0 2.0 4.32 MB

Conductor is a cutting-edge, open-source GraphQL Gateway, fully compliant with the GraphQL specification and designed to supercharge any API with powerful features and proxy flows.

Home Page: https://the-guild.dev/graphql/gateway

License: MIT License

Rust 79.78% JavaScript 2.09% Dockerfile 0.19% HCL 0.26% TypeScript 16.06% MDX 1.52% Shell 0.10%
federation fusion gateway graphql proxy rust

conductor's Introduction

 
Conductor
 

Important

Conductor gateway is still under development, and currently available as alpha.

Please use it with caution. Feedback and Contributions are always welcome!

Conductor: MIT open-source GraphQL Gateway

GitHub Actions Workflow Status unsafe forbidden GitHub License

GraphQL Rust Cloudflare Docker

Conductor is a cutting-edge, open-source GraphQL Gateway, fully compliant with the GraphQL specification and designed to supercharge any GraphQL API with a number of powerful features and proxy flows. Crafted entirely in Rust, it offers unparalleled performance and a great developer experience, making it an ideal choice for projects requiring advanced GraphQL capabilities.

 
Conductor
 

Key Features

  • Built with Rust: Focused on performance and reliability, leveraging Rust's safety and concurrency capabilities.
  • Real open-source: Conductor is open-source (MIT) and free - and will always be.
  • GraphQL Spec Compliance: Fully adheres to the GraphQL specification, ensuring reliable and standard-compliant behavior.
  • Advanced Gateway Capabilities: Serves as a dynamic proxy between GraphQL consumers and servers, enhancing GraphQL runtime with robust plugins for caching, authentication, rate limiting, CORS, persisted queries (trusted documents), and OpenTelemetry.
  • Distributed Schemas: Seamlessly integrates with Apollo Federation, managing all aspects from query planning to response merging.
  • Extensible Endpoint Configuration: Allows exposure of multiple GraphQL endpoints from a single instance with configurable plugins per endpoint.
  • VRL (Vector Routing Language) Support: Offers limitless possibilities for custom logic, plugins, and response transformers.
  • Comprehensive Security & Monitoring: Built-in support for various authentication methods, authorization, rate limiting, and OpenTelemetry for monitoring.
  • Flexible runtime: Conductor runs either as a binary (and dockerized), and can also run on the Edge (CloudFlare Worker).

Configuration Overview

Conductor's configuration can be defined in both YAML and JSON formats. The config file contains several key sections:

  • Server: Configure the HTTP server settings, including port and host.
  • Logger: Set up logging levels for Conductor's operations.
  • Sources: Define the GraphQL sources/endpoints that Conductor will interact with. We support both monolith GraphQL and Federation sources.
  • Endpoints: Specify the GraphQL endpoints Conductor will expose, including path, source, and plugins.
  • Plugins: List global plugins that apply to all endpoints, including CORS, authentication, and more.

Configuration File Example (YAML)

server:
  port: 9000

logger:
  filter: error

sources:
  - type: graphql
    id: my-source
    config:
      endpoint: https://my-source.com/graphql

endpoints:
  - path: /graphql
    from: my-source
    plugins:
      - type: cors
        config:
          allowed_origin: "*"
      - type: graphiql

Configuration File Example (JSON)

{
  "server": {
    "port": 9000
  },
  "logger": {
    "filter": "error"
  },
  "sources": [
    {
      "type": "graphql",
      "id": "my-source",
      "config": {
        "endpoint": "https://my-source.com/graphql"
      }
    }
  ],
  "endpoints": [
    {
      "path": "/graphql",
      "from": "my-source",
      "plugins": [
        {
          "type": "cors",
          "config": {
            "allowed_origin": "*"
          }
        },
        {
          "type": "graphiql"
        }
      ]
    }
  ]
}

Running Conductor

Conductor can be ran via the docker image, and it can even be ran via npx for quick and convenient usage. It also fully supports running as a WASM on Cloudflare Workers, providing flexibility in deployment options.

npx @graphql-conductor/bin ./conductor.config.yaml

Or, locally:

cargo run --bin conductor ./conductor.config.json

If config is not provided as the first argument, Conductor will try to read config.json from the root by default. For more details on setting up and running Conductor, refer to our documentation.

Contributions

Contributions, issues and feature requests are very welcome. If you are using this package and fixed a bug for yourself, please consider submitting a PR!

And if this is your first time contributing to this project, please do read our Contributor Workflow Guide before you get started off.

Code of Conduct

Help us keep Conductor open and inclusive. Please read and follow our Code of Conduct as adopted from Contributor Covenant

License

GitHub license

Conductor is open-source software licensed under MIT.

conductor's People

Contributors

dimamachina avatar dotansimha avatar gilgardosh avatar gklijs avatar kamilkisiela avatar renovate[bot] avatar trkohler avatar yassineldeeb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

gklijs trkohler

conductor's Issues

Dynamic interpolation of variables

Not sure where this needs to be implemented. As we might want to allow users to easily do mapping of headers, and other request parameters.

I was thinking of a plugin like this maybe?

plugins:
  - type: mapping_transform
     config:
        - from: {request.headers['X-Request-ID']}
          to: {upstreamRequest.headers['X-Request-ID']}

`graphql` source: introspect the server (or load remote/local introspection)

Ideally, we want a graphql source to be able to load introspection for the source.

These are the options we need:

Load from source (default)

(default)

sources:
  - id: countries
    type: graphql
    config:
      endpoint: https://countries.trevorblades.com/

or

sources:
  - id: countries
    type: graphql
    config:
      endpoint: https://countries.trevorblades.com/
      introspection:
        from: source

or, with custom headers:

sources:
  - id: countries
    type: graphql
    config:
      endpoint: https://countries.trevorblades.com/
      introspection:
        from: source
        headers:
           X-Admin-Key: 123

or, with polling:

sources:
  - id: countries
    type: graphql
    config:
      endpoint: https://countries.trevorblades.com/
      introspection:
        from: source
        polling_interval: 60

Load from a remote JSON file (local or remote)

remote:

sources:
  - id: countries
    type: graphql
    config:
      endpoint: https://countries.trevorblades.com/
      introspection:
        from: json
        location: https://countries.trevorblades.com/introspection.json

local:

sources:
  - id: countries
    type: graphql
    config:
      endpoint: https://countries.trevorblades.com/
      introspection:
        from: json
        location: /file-system/introspection.json

Tasks

Support for Supergraph (Apollo) / Fed

The goal is to create a new source that allows us to load Supergraph as a source.

This comes with a set of other requirements:

Tasks

GraphQL "fake" `@live`

End-user sends query { something @live { ... }}, we send to the upstream query { something { ... }} and start polling for that specific request.

smoke testing

We should add a test that gets an endpoint and runs some sanity checks against it.
This way we can find critical runtime issues (wasm might fail at runtime, actix-web might throw a slient error in case of invalid Data, etc..).

Tasks

Support for Federation v2

Tasks

feat: upstream endpoint match plugin

This plugin can be used to achieve regional load balancing, @dotansimha came up with how the usage might look like:

server:
  port: 9000

sources:
  - id: my-api
    type: graphql
    config:
      endpoint: https://us.myapi.com/ # this is the default

endpoints:
  - path: /graphql
    from: my-api
    plugins:
      - type: upstream-endpoint-match
        config:
          value: {{ headers["CF-Geo-Location"] }} 
          set:
            - match: US-America
              value: https://us.myapi.com/ 
            - match: EU
              value: https://eu.myapi.com/

Project Roadmap

Conductor roadmap

💡 This page's content and the list of tasks is synced automatically from The Guild's Notion. We are open sourcing our roadmap and tasks because we wish to build tools in the public, and allow developers to take part in the process of shaping the future of this library.
🚀 Feel free to share your thoughts, feedback and ideas with us.
👍 If you wish to show interest and help us prioritize tasks, use the 👍 on the issue.

v0.1

v0.2

Future

  • Spike on integrating uWS server for Conductor
  • #5
  • #131
  • #69

config file relative paths aren't relative to the config file's parent directory but rather the binary's pwd

When running cargo run ../../test_config/config.yaml while cd crates/conductor, and having my config.yaml as follows:

    plugins:
      - type: persisted_operations
        config:
          store:
            source: file
            path: ./test_config/persisted_operations_store.json

It breaks with the error:

thread 'main' panicked at 'Failed to read file:
Os{ code: 2, kind: NotFound, message: "No such file or directory" }', crates/config/src/serde_utils.rs:22:61

Because, it was unable to find the ./test_config/persisted_operations_store.json path since it started the relative path from the binary's pwd, instead of the config's parent directory, which should be the expected behavior.

Upstream source request configuration

We can add configuration for the source level, not just endpoint.

Some ideas:

  • Method (POST/GET/something else)
  • Headers (static)

And in the future:

  • Subscription protocol (SSE/WS/polling)

New config primitive for handling VRL / primitive values? 🤔

We can do something like that:

enum ConfigCondition<Context, Alternative> {
  Primitive(Alternative),
  Condition(Context)
}

struct SomeConfig {
   do_something: Option<ConfigCondition<ConditionContext, bool>>
}

In this way we can easily enable configurations like the following:

do_something: true
do_something: false # pass primitive value
do_something: "%request.headers.some-header" == "my-value"    # Context will represent the available data on %

Cache core

I wish to add a top-level cache configuration, so we can later use it for implementing plugins and other useful core things.

For example:

caches:
  - type: redis
     id: my-cache
     config:
        connection_string: "..."

And then the core of Conductor can use that, or plugins:

plugins:
  - type: response_cache 
     config:
        cache: my-cache

This way we can also assume that conductor cache is a Key->Value, and users can use a cache that matches their env (D1/KV for CF, Redis/something else for other servers).

Related:

Default headers passthrough

Some headers, like X-Request-Id, can be automatically passed through to the upstream.
We should explore what are other plugins that needs passthrough.

Implement the initial plugin system

Our goal is to allow implementing plugins at the endpoint level. This will allow us to implement caching, persisted operations and so on.

Detect Federation spec versions and print warnings on unsupported used features

Given a schema like this, federation has its own internal parts that they call “specs”

schema
  @link(url: "https://specs.apollo.dev/link/v1.0")
  @link(url: "https://specs.apollo.dev/join/v0.3", for: EXECUTION) {
  query: Query
}

we should detect these and inform users if we support it or not, specs can be referenced from http://specs.apollo.dev.

  • Fallback to previous supergraph when polling if unsupported features were detected

Persisted Operations

requires #8

The goal is to allow running persisted operations by using a hash, and then forward the original query to the upstream.

Tasks

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • chore(deps): update actions/checkout digest to a5ac7e5
  • chore(deps): update dependency @theguild/tailwind-config to v0.4.2
  • chore(deps): update minitrace to v0.6.6 (minitrace, minitrace-datadog, minitrace-jaeger)
  • chore(deps): update rust crate anyhow to v1.0.86
  • chore(deps): update rust crate schemars to v0.8.21
  • chore(deps): update rust crate serde to v1.0.203
  • chore(deps): update rust crate serde_json to v1.0.117
  • chore(deps): update rust crate thiserror to v1.0.61
  • fix(deps): update async-graphql to v7.0.5 (async-graphql, async-graphql-actix-web)
  • fix(deps): update rust crate hyper to v0.14.29
  • fix(deps): update rust crate ureq to v2.9.7
  • chore(deps): update dependency @types/node to v20.14.0
  • chore(deps): update dependency wrangler to v3.58.0
  • chore(deps): update jaegertracing/all-in-one docker tag to v1.57
  • chore(deps): update react monorepo (@types/react, react, react-dom)
  • chore(deps): update rust crate tokio to v1.38.0
  • chore(deps): update rust docker tag to v1.78.0
  • fix(deps): update dependency next to v14.2.3
  • fix(deps): update dependency prettier to v3.3.0
  • fix(deps): update dependency prettier-plugin-tailwindcss to v0.6.1
  • fix(deps): update dependency react-icons to v5.2.1
  • fix(deps): update opentelemetry-rust (opentelemetry, opentelemetry-http, opentelemetry-otlp, opentelemetry-zipkin, opentelemetry_sdk)
  • fix(deps): update rust crate actix-web to v4.6.0
  • fix(deps): update rust crate insta to v1.39.0
  • fix(deps): update rust crate rmp-serde to v1.3.0
  • fix(deps): update rust crate serial_test to v3.1.1
  • chore(deps): update pnpm to v9
  • 🔐 Create all rate-limited PRs at once 🔐

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

cargo
Cargo.toml
  • tokio 1.37.0
  • futures 0.3.30
  • serde 1.0.197
  • serde_json 1.0.115
  • tracing 0.1.40
  • http 0.2.12
  • http-body 0.4.6
  • bytes 1.6.0
  • async-trait 0.1.80
  • anyhow 1.0.82
  • reqwest 0.11.27
  • thiserror 1.0.58
  • reqwest-middleware 0.2.5
  • tracing-subscriber 0.3.18
  • base64 0.21.7
  • schemars 0.8.16
  • minitrace 0.6.4
bin/cloudflare_worker/Cargo.toml
  • tracing-web 0.1.3
  • time 0.3.36
  • console_error_panic_hook 0.1.7
bin/conductor/Cargo.toml
  • actix-web 4.5.1
  • futures-util 0.3.30
  • ulid 1.1.2
  • openssl 0.10
libs/benches/Cargo.toml
  • criterion 0.5.1
  • hyper 0.14.28
  • actix-web 4.5.1
  • url 2.5.0
libs/common/Cargo.toml
  • graphql-tools 0.2.5
  • mime 0.3.17
  • url 2.5.0
  • querystring 1.1.0
  • once_cell 1.19.0
  • lazy_static 1.4.0
libs/config/Cargo.toml
  • serde_yaml 0.9.33
  • regex 1.10.4
  • humantime-serde 1.1.1
  • http-serde 1.1.3
libs/e2e_tests/Cargo.toml
  • httpmock 0.7.0
  • lazy_static 1.4.0
libs/engine/Cargo.toml
  • ureq 2.9.6
  • humantime 2.1.0
libs/federation_query_planner/Cargo.toml
  • linked-hash-map 0.5.6
  • lazy_static 1.4.0
  • async-graphql 7.0.1
  • insta 1.38.0
  • criterion 0.5.1
libs/logger/Cargo.toml
  • atty 0.2.14
  • tracing-web 0.1.3
libs/minitrace_reqwest/Cargo.toml
  • task-local-extensions 0.1.4
libs/napi/Cargo.toml
  • napi 2.16.2
  • napi-derive 2.16.1
  • actix-web 4.5.1
  • napi-build 2.1.3
libs/smoke_tests/Cargo.toml
  • insta 1.38.0
  • lazy_static 1.4.0
  • serial_test 3.0.0
libs/tracing/Cargo.toml
  • opentelemetry 0.22.0
  • opentelemetry_sdk 0.22.1
  • task-local-extensions 0.1.4
  • rand 0.8.5
libs/wasm_polyfills/Cargo.toml
  • wasm-bindgen-futures 0.4.42
  • send_wrapper 0.6
plugins/cors/Cargo.toml
plugins/disable_introspection/Cargo.toml
plugins/graphiql/Cargo.toml
plugins/graphql_validation/Cargo.toml
plugins/http_get/Cargo.toml
  • urlencoding 2.1.3
plugins/jwt_auth/Cargo.toml
  • jsonwebtoken 9.3.0
  • humantime-serde 1.1.1
  • cookie 0.18.1
  • web-time 1.1.0
  • lazy_static 1.4.0
plugins/match_content_type/Cargo.toml
plugins/telemetry/Cargo.toml
  • humantime-serde 1.1.1
  • opentelemetry 0.22.0
  • opentelemetry_sdk 0.22.1
  • opentelemetry-http 0.11.1
  • rmp-serde 1.1.2
  • web-time 1.1.0
  • opentelemetry-otlp 0.15.0
  • opentelemetry-zipkin 0.20.0
  • opentelemetry-otlp 0.15.0
  • minitrace-datadog 0.6.4
  • opentelemetry-zipkin 0.20.0
  • minitrace-jaeger 0.6.4
  • opentelemetry-http 0.11.1
  • futures 0.3
plugins/trusted_documents/Cargo.toml
plugins/vrl/Cargo.toml
tests/test-server/Cargo.toml
  • async-graphql 7.0.1
  • async-graphql-actix-web 7.0.1
  • actix-web 4.5.1
docker-compose
libs/smoke_tests/docker-compose.yaml
  • quay.io/keycloak/keycloak 24.0.2
  • jaegertracing/all-in-one 1.56
dockerfile
bin/conductor/docker/Dockerfile
  • rust 1.77.2
  • debian 12.5
github-actions
.github/actions/setup/action.yml
  • Swatinem/rust-cache v2
.github/workflows/benchmark.yaml
  • actions/checkout v4@0ad4b8fadaa221de15dcec353f45205ec38ea70b
  • actions/checkout v4@0ad4b8fadaa221de15dcec353f45205ec38ea70b
  • actions/upload-artifact v4
  • actions/checkout v4@0ad4b8fadaa221de15dcec353f45205ec38ea70b
  • JarvusInnovations/background-action v1
  • JarvusInnovations/background-action v1
  • ubuntu 22.04
  • ubuntu 22.04
.github/workflows/ci.yaml
  • actions/checkout v4@0ad4b8fadaa221de15dcec353f45205ec38ea70b
  • actions/setup-node v4
  • actions/checkout v4@0ad4b8fadaa221de15dcec353f45205ec38ea70b
  • JarvusInnovations/background-action v1
  • JarvusInnovations/background-action v1
  • JarvusInnovations/background-action v1
  • actions/checkout v4@0ad4b8fadaa221de15dcec353f45205ec38ea70b
  • JarvusInnovations/background-action v1
  • JarvusInnovations/background-action v1
  • actions/checkout v4@0ad4b8fadaa221de15dcec353f45205ec38ea70b
  • actions/checkout v4@0ad4b8fadaa221de15dcec353f45205ec38ea70b
  • actions-rs/clippy-check v1
  • actions/checkout v4@0ad4b8fadaa221de15dcec353f45205ec38ea70b
  • thollander/actions-comment-pull-request v2
  • ubuntu 22.04
  • ubuntu 22.04
  • ubuntu 22.04
  • ubuntu 22.04
  • ubuntu 22.04
.github/workflows/release.yaml
  • actions/checkout v4
  • docker/setup-qemu-action v3
  • docker/setup-buildx-action v3
  • docker/login-action v3
  • docker/bake-action v4
  • marocchino/sticky-pull-request-comment v2
  • softprops/action-gh-release v2
  • actions/checkout v4
  • actions/upload-artifact v4
  • montudor/action-zip v1
  • svenstaro/upload-release-action v2
  • actions/checkout v4
  • actions/upload-artifact v4
  • svenstaro/upload-release-action v2
  • actions/checkout v4
  • houseabsolute/actions-rust-cross v0
  • actions/upload-artifact v4
  • svenstaro/upload-release-action v2
  • ubuntu 22.04
  • ubuntu 22.04
  • ubuntu 22.04
.github/workflows/website.yaml
  • actions/checkout v4
  • actions/checkout v4@0ad4b8fadaa221de15dcec353f45205ec38ea70b
  • actions/checkout v4@0ad4b8fadaa221de15dcec353f45205ec38ea70b
  • ubuntu 22.04
npm
bin/cloudflare_worker/package.json
  • wrangler 3.48.0
bin/npm/package.json
  • @graphql-conductor/lib 0.0.0-placeholder.0
libs/napi/npm/darwin-arm64/package.json
  • node >= 10
libs/napi/npm/darwin-x64/package.json
  • node >= 10
libs/napi/npm/linux-x64-gnu/package.json
  • node >= 10
libs/napi/package.json
  • @napi-rs/cli ^2.16.5
  • ava ^5.1.1
  • node >= 10
tests/graphql-over-http/package.json
  • graphql-http 1.22.1
  • node >=20
  • pnpm >=8
  • pnpm 8.15.8
website/package.json
  • @monaco-editor/react 4.6.0
  • @theguild/components 6.5.3
  • @theguild/prettier-config 2.0.6
  • clsx 2.1.1
  • graphql 16.8.1
  • json-to-pretty-yaml 1.2.2
  • next 14.1.4
  • next-sitemap 4.2.3
  • next-themes 0.3.0
  • nextra 3.0.0-alpha.22
  • prettier 3.2.5
  • prettier-plugin-tailwindcss 0.5.14
  • react 18.2.0
  • react-dom 18.2.0
  • react-icons 5.0.1
  • @theguild/tailwind-config 0.4.1
  • @types/json-schema 7.0.15
  • @types/json-to-pretty-yaml 1.2.1
  • @types/node 20.12.10
  • @types/react 18.2.79
  • typescript 5.4.5
  • node >=20
  • pnpm >=8
  • pnpm 8.15.8

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.