# Self-hosted GraphQL schema documentation

GraphQL schemas describe themselves, but a raw schema file is not documentation your colleagues will read. SelfDocHub
turns the schema of each GraphQL service into searchable pages, keeps the history of every change and puts it in the same
portal as your REST and JSON-RPC services.

## Publish SDL or introspection

A GraphQL service accepts its schema in either of two shapes. Use whichever fits your pipeline.

**SDL text**: the `.graphql` or `.gql` file that already lives next to your service source.

```bash
curl -X POST https://docs.example.com/api/v1/services/billing-api/spec \
  -H "Authorization: Bearer $DOCS_UPLOAD_TOKEN" \
  --data-binary @schema.graphql
```

**Introspection result**: if your pipeline queries a live endpoint, pipe the introspection JSON straight into the portal.
Both the full `{"data": {"__schema": ...}}` envelope and an unwrapped `{"__schema": ...}` work.

The service name is taken from the description above the `schema { ... }` block or, failing that, from the description of
the `Query` type, so write a one-line description there and it becomes the title of the service in the portal.

## Browse and try

The documentation lists queries, mutations and the types they use, with descriptions from your schema. From the endpoint
page you can send a real request with **Try-It**, save it, share it by link and copy it as code in curl, Go, Python,
JavaScript, PHP or C#. Environments (a base URL, headers and timeouts) are defined once and shared with the team, so
nobody pastes tokens into chat messages.

## Know what changed

Each published version is compared with the previous one. The change log lists added, removed and modified fields, and
marks a change as **breaking** when it would hurt a client, for example when the type a field returns changes. Descriptions
and deprecations are never flagged. You can search the change log of a service by endpoint (field) name, see the history of one
field on its page and get a notification for breaking changes only.

## One portal for every API style

GraphQL services sit next to OpenAPI, OpenRPC and AsyncAPI ones, share the same search, teams, roles and exports, and are
included in the MCP server so AI assistants can read the schema of a field instead of guessing. A service uses exactly one
format, locked from its first publish.

## Self-hosted

SelfDocHub runs as a single binary or Docker container on your infrastructure, with no separate database server. Your
schemas, which often describe internal data models, stay inside your network.

---
Source: https://selfdochub.com/features/graphql-documentation
