To read the official Dgraph documentation that is published from this repository, please see https://docs.dgraph.io/.
This documentation site is built with Docusaurus, a modern static website generator optimized for documentation.
The documentation is organized into four main sections, each managed by its own Docusaurus content plugin:
- Docs (
/) - Core Dgraph database documentation including DQL, administration, installation, and design concepts - GraphQL (
/graphql) - GraphQL API documentation, schema, queries, mutations, and custom resolvers - Ratel UI (
/ratel) - Documentation for the Ratel web-based UI tool - Tutorials (
/learn) - Step-by-step tutorials and learning paths for different user types
Each section has its own sidebar navigation configured in:
sidebars.ts- Docs sidebarsidebars-graphql.ts- GraphQL sidebarsidebars-ratel.ts- Ratel sidebarsidebars-learn.ts- Tutorials sidebar
- Node.js version 20.0 or higher
- npm or yarn package manager
-
Navigate to the Docusaurus directory:
cd docusaurus-docs -
Install dependencies:
npm install
-
Start the development server:
npm start
-
Open http://localhost:3000 in your browser.
The site will automatically reload when you make changes to the documentation files.
To build a production-ready static site:
npm run buildThe built site will be in the build/ directory. You can serve it locally with:
npm run serveDocusaurus supports documentation versioning. Versioned documentation is stored in:
docs_versioned_docs/- Versioned docs contentdocs_versioned_sidebars/- Versioned sidebar configurationsdocs_versions.json- Version metadata
The version dropdown in the navbar automatically detects which documentation section you're viewing and shows the appropriate versions. Currently, versioning is configured for the main docs section.
To create a new version:
- Use the Docusaurus CLI:
npm run docusaurus docs:version <version> - This creates a new version snapshot of the current docs
The documentation site is automatically deployed to CloudFlare:
- Main branch (
main) → Deployed to production athttps://docs.dgraph.io - Preview branches (
preview/*) → Deployed as preview deployments for review
The deployment process is handled automatically via CloudFlare Pages integration with GitHub.
As a contributor to Dgraph documentation, we ask that you do the following:
-
Label your PR for easy management: Your PR title should be in the following format: Topic (area): details. The topic is either "Docs", "Nav" (aka, navigation), or "Chore" (for build fixes, cherry-picks, etc). The area is the feature (i.e. "GraphQL"), area of the docs (i.e., "Deployment"), or "Other" (for typo fixes and other bugfix PRs). So, example PR names include: Docs(GraphQL): Document the @deprecated annotation
-
Technical writing style: As much as possible, please follow technical writing style conventions (More on this below).
-
(Dgraph core team only): Include the ID of any issues/tickets related to your PR in the description (i.e., "Fixes DGRAPH-12345" or "Per DGRAPH-54321").
Please follow the Dgraph Documentation Style Guide for writing conventions, formatting, and best practices.
Note: Please don't let these style conventions stop you from creating a PR to share your contribution to Dgraph Docs! PR reviewers can help with style guide issues.
In Docusaurus, use standard Markdown links for internal references. For example, to reference a term in the glossary:
[UID](/dgraph-glossary#uid)docusaurus-docs/
├── docs/ # Main documentation content
├── docs-graphql/ # GraphQL documentation
├── docs-ratel/ # Ratel UI documentation
├── docs-learn/ # Tutorials and learning content
├── docs_versioned_docs/ # Versioned documentation snapshots
├── sidebars.ts # Main docs sidebar configuration
├── sidebars-graphql.ts # GraphQL sidebar configuration
├── sidebars-ratel.ts # Ratel sidebar configuration
├── sidebars-learn.ts # Tutorials sidebar configuration
├── docusaurus.config.ts # Main Docusaurus configuration
└── src/ # Custom components and styles
Some code examples in the documentation are interactive and runnable, allowing readers to execute queries directly in the browser. These are implemented using custom Docusaurus components.