A beautiful GraphQL static documentation website - based on Next.js and Golang.
- Set up asdf on your computer.
- Run
asdf install
to install Go, Node.js, and Task.
- Run
task docs.generate
to generateapp/lib/graph.yaml
.
- Run
cd app
to enter the Next.js folder. - Run
npm run dev
to run the Next.js server.
- Open
app/app/page.tsx
which contains the documentation page. - Find
buildDocs/1
which selects the GraphQL types, queries and mutations to render on the page. - Add a section to
docs.sections
with theType
name, or theQuery
orMutation
field name.
{
id: uuid4(),
title: "Projects",
articles: [
{ type: "Project", definition: api.types.Project },
{ type: "Query", definition: api.types.Query.fields!["listProjects"] },
{ type: "Query", definition: api.types.Query.fields!["getProjectById"] },
{ type: "Mutation", definition: api.types.Mutation.fields!["createProject"] },
{ type: "Mutation", definition: api.types.Mutation.fields!["updateProject"] },
{ type: "Mutation", definition: api.types.Mutation.fields!["deleteProject"] },
].map((article) => ({ ...article, id: uuid4() })),
},