Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
Gatsby starter for a GraphQL playground: write docs and queries in MDX, display them in an interactive GraphiQL window sourced from localhost or a remote URL.
Gatsby Starter GraphQL Playground is a free and open-source Gatsby starter (by LekoArts) that creates a documentation site with a built-in interactive GraphiQL window, letting you write queries and docs in MDX and display live GraphQL previews.
This starter is a ready-to-use Gatsby site that installs and configures the @lekoarts/gatsby-theme-graphql-playground theme. It takes MDX files containing GraphQL queries as input and outputs a static site where GraphQL code blocks marked with the meta field preview are automatically converted to live previews inside a GraphiQL iframe. The GraphQL source can be your localhost or a remote URL such as Codesandbox. It is authored by LekoArts and released under the 0BSD license.
src/@lekoarts/gatsby-theme-graphql-playground/data/navigation.mdx and your doc pages as .mdx files inside docs/. The navigation supports sections and sub-menus using standard markdown lists.preview (e.g. ```graphql preview) becomes an interactive GraphiQL iframe. The query must be the first item in the MDX file, directly after the frontmatter title.src/gatsby-plugin-theme-ui/.src/@lekoarts/gatsby-theme-graphql-playground/, following Gatsby theme shadowing conventions.npx gatsby new gatsby-starter-graphql-playground https://github.com/LekoArts/gatsby-starter-graphql-playground, then run npm run develop to serve at http://localhost:8000.graphql preview blocks that run live.After scaffolding the starter, you add a navigation definition in navigation.mdx, create an .mdx doc page whose filename matches a link in that navigation, and place a GraphQL query with the preview meta field as the first content item. The theme then renders that query in a GraphiQL iframe while the rest of the MDX renders as normal markdown.
Yes, it is open source and released under the permissive 0BSD license, so you can use, modify, and distribute it without restrictions. It is also listed among LekoArts' free and open-source Gatsby themes.
Add a new entry to your navigation.mdx file (for example a markdown list item with a link like [GraphQL Introduction](/graphql-introduction)), then create a file at docs/graphql-introduction.mdx with a frontmatter title and the GraphQL query as the first content block.
Yes. The playground can source from your localhost during development or a remote URL, such as a Codesandbox, for production or sharing. The theme handles pointing the GraphiQL window at the endpoint you configure.
You can shadow the Theme UI configuration by placing your own files in src/gatsby-plugin-theme-ui/. For overriding any other theme component, place files in src/@lekoarts/gatsby-theme-graphql-playground/. Read the Gatsby theme shadowing guide first.
