graphinx
v0.12.1
Published
<p align="center"> <img src="./wordmark.svg" alt="Graphinx logo" height="100" /><br> <i>Beautiful, auto-generated API documentation for your GraphQL APIs.</i> <br> <br> <img src="./demo.gif" alt="Graphinx logo" width="80%" /><br> </p>
Downloads
271
Readme
Production example
Features
Less noise
| | |
| ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| | Relay integration Don't pollute your documentation with hundreds of ThingEdge
and ThingConnection
types. Graphinx will automatically detect them and display them as Connection<Thing>
. |
| | Result types Similarly, Graphinx will detect return types that are unions of a Success type and error types. |
Less indirection
| | | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------- | | Some types are only used in one place. Documenting them somewhere else is unecessary, and makes answering the important question complex: what data can I get on this object? Graphinx gives template the opportunity to embed types when they are only referenced by a single other type. | |
Ready for scale
| | | | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | | Big GraphQL APIs have a lot of types, queries and mutations. Don't let your users read a 10,000-pages-long dump of unrelated, alphabetically-sorted types. With Graphinx, you organize your schema items (types, queries, mutations and subscriptions) into modules. You can define modules manually, or define patterns to auto-categorize your items based on your source code. |
Extensible
| | |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- |
| As with the Sphinx documentation tool, Graphinx is template-based: if you want your documentation site to have a unique look, it's really easy to do so. Graphinx essentially processes your schema into data that's ready to use for documentation site generation. Here's an example of what the generated data made available to templates looks like Right now, Graphinx offers a gorgeous default template, and a markdown template, that exports an index markdown file as well as one file per module. | A template's package.json
|
Getting Started
Add Graphinx to your dev dependencies:
yarn add --dev graphinx
Initialize a config file
yarn graphinx init
Follow the instructions given by the CLI ;)
Configuration
Configuration is done through a .graphinx.yaml
config file. The path to the config file can be changed with --config
.
You can put schema items (types and root fields) into modules by using the @graphinx(module: "module-name")
.
You can define the directive in your schema like this:
directive @graphinx(module: String) on OBJECT | FIELD_DEFINITION | SCALAR | ENUM | UNION | INTERFACE | INPUT_OBJECT
Schema items can also be categorized via the configuration file, see the .graphinx.yaml config file documentation
A JSON schema is available at https://raw.githubusercontent.com/graphinx/graphinx/main/config.schema.json.