Introduction

One of the main advantages of GraphQL is its ability to document itself by exposing an expressive schema. This schema is specified in GraphQL SDL (schema definition language). If you are implementing on top of ROQ One, you can find the SDL in this directory:

backend/src/schema.gql
CODE

This file is generated when you start ROQ One Backend (see Local development setup). There are several ways in which you can build an internal or public documentation based on the SDL. You can also use the SDL for external tools as described here: GraphQL tooling.

ℹ️ The GraphQL schema is usually not exposed in production environments. See the Apollo documentation about 📖 Introspection.

GraphQL Playground

ROQ uses a library called ➚Apollo Server to realize GraphQL on the server-side. Apollo Server ships with a web IDE called “Playground” that supports auto-completion for queries and other useful features. To use Apollo Server, you will need to enable it and visit the /graphql URL of your backend application.

You can enable/disable the playground here:

backend/src/app.module.ts
CODE

Generated API documentation

If you prefer a more traditional approach to represent your endpoints, you can use 📖 spectaql. Spectaql is a library that generates static documentation for your GraphQL schema.

ROQ One Backend is already equipped with this library. You can find the docs by visiting the /docs URL of your backend application. You can enable/disable the static docs using the ENABLE_DOCS environment variable, via:

backend/src/config/application.config.ts
CODE