All Projects ā†’ APIs-guru ā†’ Graphql Voyager

APIs-guru / Graphql Voyager

Licence: mit
šŸ›°ļø Represent any GraphQL API as an interactive graph

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language
CSS
56736 projects
HTML
75241 projects

Projects that are alternatives of or similar to Graphql Voyager

Graphqlviz
GraphQL Server schema visualizer
Stars: āœ­ 591 (-90.88%)
Mutual labels:  graphql, graphviz
Rest Layer
REST Layer, Go (golang) REST API framework
Stars: āœ­ 1,068 (-83.52%)
Mutual labels:  graphql, api-documentation
Graphql Css
A blazing fast CSS-in-GQLā„¢ library.
Stars: āœ­ 672 (-89.63%)
Mutual labels:  graphql
Graphql Framework Experiment
Code-First Type-Safe GraphQL Framework
Stars: āœ­ 698 (-89.23%)
Mutual labels:  graphql
Gql
A GraphQL client in Python
Stars: āœ­ 681 (-89.49%)
Mutual labels:  graphql
Jira clone
A Jira clone built with Vuejs & Nodejs/Graphql
Stars: āœ­ 666 (-89.72%)
Mutual labels:  graphql
Js Graphql Intellij Plugin
GraphQL language support for WebStorm, IntelliJ IDEA and other IDEs based on the IntelliJ Platform.
Stars: āœ­ 686 (-89.42%)
Mutual labels:  graphql
Urql
The highly customizable and versatile GraphQL client with which you add on features like normalized caching as you grow.
Stars: āœ­ 6,604 (+1.9%)
Mutual labels:  graphql
Dataloader
Implementation of Facebook's DataLoader in Golang
Stars: āœ­ 703 (-89.15%)
Mutual labels:  graphql
Graphql
Simple low-level GraphQL HTTP client for Go
Stars: āœ­ 682 (-89.48%)
Mutual labels:  graphql
Devdocs
API Documentation Browser
Stars: āœ­ 27,208 (+319.81%)
Mutual labels:  api-documentation
Agoo
A High Performance HTTP Server for Ruby
Stars: āœ­ 679 (-89.52%)
Mutual labels:  graphql
Next Right Now
Flexible production-grade boilerplate with Next.js 10, Vercel and TypeScript. Includes multiple opt-in presets using Storybook, Airtable, GraphQL, Analytics, CSS-in-JS, Monitoring, End-to-end testing, Internationalization, CI/CD and SaaS B2B multi single-tenancy (monorepo) support
Stars: āœ­ 671 (-89.65%)
Mutual labels:  graphql
Conference App In A Box
Full stack & cross platform app customizable & themeable for any event or conference.
Stars: āœ­ 693 (-89.31%)
Mutual labels:  graphql
Elm Graphql
Autogenerate type-safe GraphQL queries in Elm.
Stars: āœ­ 672 (-89.63%)
Mutual labels:  graphql
Graphql
GraphQL (TypeScript) module for Nest framework (node.js) šŸ·
Stars: āœ­ 697 (-89.25%)
Mutual labels:  graphql
Graphql Java Tools
A schema-first tool for graphql-java inspired by graphql-tools for JS
Stars: āœ­ 667 (-89.71%)
Mutual labels:  graphql
Gqlgen
go generate based graphql server library
Stars: āœ­ 6,880 (+6.16%)
Mutual labels:  graphql
Testing Nestjs
A repository to show off to the community methods of testing NestJS including Unit Tests, Integration Tests, E2E Tests, pipes, filters, interceptors, GraphQL, Mongo, TypeORM, and more!
Stars: āœ­ 685 (-89.43%)
Mutual labels:  graphql
Mercurius
Implement GraphQL servers and gateways with Fastify
Stars: āœ­ 704 (-89.14%)
Mutual labels:  graphql

GraphQL Voyager

jsDelivr David David License: MIT

graphql-voyager logo

Represent any GraphQL API as an interactive graph. It's time to finally see the graph behind GraphQL. You can also explore number of public GraphQL APIs from our list.

With graphql-voyager you can visually explore your GraphQL API as an interactive graph. This is a great tool when designing or discussing your data model. It includes multiple example GraphQL schemas and also allows you to connect it to your own GraphQL endpoint. What are you waiting for, explore your API!

GraphQL Weekly #42

Live Demo

voyager demo

Features

  • Quick navigation on graph
  • Left panel which provides more detailed information about every type
  • "Skip Relay" option that simplifies graph by removing Relay wrapper classes
  • Ability to choose any type to be a root of the graph

Usage

GraphQL Voyager exports Voyager React component and helper init function. If used without module system it is exported as GraphQLVoyager global variable.

Properties

Voyager component accepts the following properties:

  • introspection [object or function: (query: string) => Promise] - the server introspection response. If function is provided GraphQL Voyager will pass introspection query as a first function parameter. Function should return Promise which resolves to introspection response object.
  • displayOptions (optional)
    • displayOptions.skipRelay [boolean, default true] - skip relay-related entities
    • displayOptions.skipDeprecated [boolean, default true] - skip deprecated fields and entities that contain only deprecated fields.
    • displayOptions.rootType [string] - name of the type to be used as a root
    • displayOptions.sortByAlphabet [boolean, default false] - sort fields on graph by alphabet
    • displayOptions.showLeafFields [boolean, default true] - show all scalars and enums
    • displayOptions.hideRoot [boolean, default false] - hide the root type
  • hideDocs [boolean, default false] - hide the docs sidebar
  • hideSettings [boolean, default false] - hide settings panel
  • workerURI [string] (optional) - absolute or relative path to Voyager web worker. By default it will try to load it from voyager.worker.js.
  • loadWorker [function: (path: string, relative: boolean) => Promise<Worker>] (optional) - If provided GraphQL Voyager will use this function to load the worker. By default it will use the internal callback in utils/index.ts

init function

The signature of the init function:

(hostElement: HTMLElement, options: object) => void
  • hostElement - parent element
  • options - is the JS object with properties of Voyager component

Using pre-bundled version

You can get GraphQL Voyager bundle from the following places:

Important: for the latest two options make sure to copy voyager.worker.js to the same folder as voyager.min.js.

The HTML with minimal setup (see the full example)

<!DOCTYPE html>
<html>
  <head>
    <script src="https://cdn.jsdelivr.net/npm/react@16/umd/react.production.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/react-dom@16/umd/react-dom.production.min.js"></script>

    <link
      rel="stylesheet"
      href="https://cdn.jsdelivr.net/npm/graphql-voyager/dist/voyager.css"
    />
    <script src="https://cdn.jsdelivr.net/npm/graphql-voyager/dist/voyager.min.js"></script>
  </head>
  <body>
    <div id="voyager">Loading...</div>
    <script>
      function introspectionProvider(introspectionQuery) {
        // ... do a call to server using introspectionQuery provided
        // or just return pre-fetched introspection
      }

      // Render <Voyager />
      GraphQLVoyager.init(document.getElementById('voyager'), {
        introspection: introspectionProvider,
      });
    </script>
  </body>
</html>

Using as a dependency

You can install lib using npm or yarn:

npm i --save graphql-voyager
yarn add graphql-voyager

And then use it:

import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { Voyager } from 'graphql-voyager';
import fetch from 'isomorphic-fetch';

function introspectionProvider(query) {
  return fetch(window.location.origin + '/graphql', {
    method: 'post',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ query: query }),
  }).then((response) => response.json());
}

ReactDOM.render(
  <Voyager introspection={introspectionProvider} />,
  document.getElementById('voyager'),
);

Build for the web with webpack (example) or browserify

Important: make sure to copy voyager.worker.js from node_modules/graphql-voyager/dist to the same folder as your main bundle or use workerURI property to specify other path.

NOTE if you use it with create-react-app, copy worker file to public folder and use workerURI property like this:

<Voyager
  // ...
  workerURI={process.env.PUBLIC_URL + '/voyager.worker.js'}
  // ...
/>

Middleware

Graphql Voyager has middleware for the next frameworks:

Properties

Middleware supports the following properties:

  • endpointUrl [string] - the GraphQL endpoint url.
  • displayOptions [object] - same as here
  • headersJS [string, default "{}"] - object of headers serialized in string to be used on endpoint url
    Note: You can also use any JS expression which results in an object with header names as keys and strings as values e.g. { Authorization: localStorage['Meteor.loginToken'] }

Express

import express from 'express';
import { express as voyagerMiddleware } from 'graphql-voyager/middleware';

const app = express();

app.use('/voyager', voyagerMiddleware({ endpointUrl: '/graphql' }));

app.listen(3001);

Hapi

Version 17+

import hapi from 'hapi';
import { hapi as voyagerMiddleware } from 'graphql-voyager/middleware';

const server = new Hapi.Server({
  port: 3001,
});

const init = async () => {
  await server.register({
    plugin: voyagerMiddleware,
    options: {
      path: '/voyager',
      endpointUrl: '/graphql',
    },
  });

  await server.start();
};

init();

Legacy Versions

import hapi from 'hapi';
import { hapiLegacy as voyagerMiddleware } from 'graphql-voyager/middleware';

const server = new Hapi.Server();

server.connection({
  port: 3001,
});

server.register(
  {
    register: voyagerMiddleware,
    options: {
      path: '/voyager',
      endpointUrl: '/graphql',
    },
  },
  () => server.start(),
);

Koa

import Koa from 'koa';
import KoaRouter from 'koa-router';
import { koa as voyagerMiddleware } from 'graphql-voyager/middleware';

const app = new Koa();
const router = new KoaRouter();

router.all(
  '/voyager',
  voyagerMiddleware({
    endpointUrl: '/graphql',
  }),
);

app.use(router.routes());
app.use(router.allowedMethods());
app.listen(3001);

Credits

This tool is inspired by graphql-visualizer project.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].