graphql-docs

Automatic, beautiful documentation for your GraphQL APIs
View on RubyGems View on GitHub View Generated Docs

What is graphql-docs?

graphql-docs is a Ruby gem that automatically generates beautiful, static HTML documentation from your GraphQL schema. No manual documentation writing required!

It creates comprehensive, searchable documentation for all your types, queries, mutations, and fields - making it easy for developers to understand and use your GraphQL API.

🚀 Automatic Generation

Generate complete API documentation from your GraphQL schema with a single command

🎨 Beautiful Design

Clean, professional documentation with syntax highlighting and responsive layout

🔍 Searchable

Find types, fields, and operations quickly with built-in search functionality

📦 Static HTML

Deploy anywhere - GitHub Pages, S3, CDN, or serve from your app

⚙️ Customizable

Custom templates, landing pages, and styling options

🔗 Complete Coverage

Documents all types: objects, queries, mutations, scalars, enums, interfaces

Quick Start

  1. Add the gem to your Gemfile:
gem "graphql-docs", "~> 5.0"
  1. Create a Rake task (in your Rakefile):
desc "Generate GraphQL documentation"
task :docs do
  require "graphql-docs"

  GraphQLDocs.build(
    schema: YourSchema,
    output_dir: "./docs",
    delete_output: true,
    base_url: "/docs"
  )
end
  1. Generate documentation:
bundle exec rake docs

That's it! You now have comprehensive, searchable documentation for your entire GraphQL API.

This Demo Project

This is a complete working example showing how to integrate graphql-docs into a Ruby GraphQL application. It includes:

Ruby API CLI Support GitHub Actions Production Ready

Try the API

This demo provides a GraphQL API for classic books. Try out some queries below to see the API in action, then check out the generated documentation to see how graphql-docs documents it.

Response

Results will appear here...

Example Queries

Get All Books
query { books { title author slug readCount } }
Get Book by Slug
query { book(slug: "pride-and-prejudice") { title author publishedYear description genre pages readCount } }
Mark Book as Read (Mutation)
mutation { markAsRead(slug: "1984") { title author readCount } }