1. Project Overview & Quickstart (dgraph-io/dgraph)
Dgraph is a horizontally scalable and distributed GraphQL database with a graph backend. It provides
ACID transactions, consistent replication, and linearizable reads. It's built from the ground up to
perform a rich set of queries. Being a native GraphQL database, it tightly controls how the data is
arranged on disk to optimize for query performance and throughput, reducing disk seeks and network
calls in a cluster.
Dgraph's goal is to provide Google production-level scale and throughput, with low enough latency to
serve real-time user queries over terabytes of structured data. Dgraph supports
GraphQL query syntax, and responds in JSON
and Protocol Buffers over
GRPC and HTTP. Dgraph is written using the Go Programming Language.
Status
Dgraph is at version v25 and is production-ready. Apart from the vast open source community,
it is being used in production at multiple Fortune 500 companies.
Supported Platforms
Dgraph officially supports the Linux/amd64 and Linux/arm64 architectures. In order to take advantage
of memory performance gains and other architecture-specific advancements in Linux, we dropped
official support for Mac and Windows in 2021, see
this blog post for more
information. You can still build and use Dgraph on other platforms (for live or bulk loading for
instance), but support for platforms other than Linux/amd64 and Linux/arm64 is not available.
Running Dgraph in a Docker environment is the recommended testing and deployment method.
Install with Docker
If you're using Docker, you can use the
official Dgraph image.
docker pull dgraph/dgraph:latestFor more information on a variety Docker deployment methods including Docker Compose and Kubernetes,
see the docs.
Run a Quick Standalone Cluster
docker run -it -p 8080:8080 -p 9080:9080 -v ~/dgraph:/dgraph dgraph/standalone:latestInstall from Source
If you want to install from source, install Go 1.27+ or later and the following dependencies:
Ubuntu
sudo apt-get update
sudo apt-get install build-essentialBuild and Install
Then clone the Dgraph repository and use make install to install the Dgraph binary in the
directory named by the GOBIN environment variable, which defaults to $GOPATH/bin or $HOME/go/bin if
the GOPATH environment variable is not set.
git clone https://github.com/dgraph-io/dgraph.git
cd dgraph
make setup
make installGet Started
To get started with Dgraph, follow:
- Installation to queries in 4 quick steps.
- Tutorial and presentation videos on
YouTube channel.
Is Dgraph the right choice for me?
- Do you have more than 10 SQL tables connected via foreign keys?
- Do you have sparse data, which doesn't elegantly fit into SQL tables?
- Do you want a simple and flexible schema, which is readable and maintainable over time?
- Do you care about speed and performance at scale?
If the answers to the above are YES, then Dgraph would be a great fit for your application. Dgraph
provides NoSQL like scalability while providing SQL like transactions and the ability to select,
filter, and aggregate data points. It combines that with distributed joins, traversals, and graph
operations, which makes it easy to build applications with it.
Dgraph compared to other graph DBs
| Features | Dgraph | Neo4j | Janus Graph |
|---|---|---|---|
| Architecture | Sharded and Distributed | Single server (+ replicas in enterprise) | Layer on top of other distributed DBs |
| Replication | Consistent | None in community edition (only available in enterprise) | Via underlying DB |
| Data movement for shard rebalancing | Automatic | Not applicable (all data lies on each server) | Via underlying DB |
| Language | GraphQL inspired | Cypher | Gremlin |
| Protocols | Grpc / HTTP + JSON / RDF | Bolt + Cypher | Websocket / HTTP |
| Transactions | Distributed ACID transactions | Single server ACID transactions | Not typically ACID |
| Full-Text Search | Native support | Native support | Via External Indexing System |
| Regular Expressions | Native support | Native support | Via External Indexing System |
| Geo Search | Native support | External support only | Via External Indexing System |
| License | Apache 2.0 | GPL v3 | Apache 2.0 |
Users
- Dgraph official documentation is present at docs.dgraph.io.
- For general information and questions, visit
Github discussions. - Please see releases tab to find the latest release
and corresponding release notes.
Developers
Please see Contributing to Dgraph
for guidelines on contributions.
Client Libraries
The Dgraph team maintains several
officially supported client libraries. There are also libraries
contributed by the community
unofficial client libraries.
Contact
- Please use Github discussions for questions,
feature requests and discussions. - Please use GitHub Issues for filing bugs or feature
requests.
2. Official Technical Reference & Guides (dgraph-io/dgraph-docs)
Dgraph Documentation
To read the official Dgraph documentation that is published from this repository,
please see https://docs.dgraph.io/.
Technology Stack
This documentation site is built with Docusaurus, a modern static website generator optimized for documentation.
Documentation Structure
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
Running Locally
Prerequisites
- Node.js version 20.0 or higher
- npm or yarn package manager
Setup and Run
Navigate to the Docusaurus directory:
bashcd docusaurus-docsInstall dependencies:
bashnpm installStart the development server:
bashnpm startOpen http://localhost:3000 in your browser.
The site will automatically reload when you make changes to the documentation files.
Build for Production
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 serveTesting the current version
When testing locally you can set
includeCurrentVersion: true,in the docs or graphql plugin in docusaurus.config.ts.
This will expose next in the version selector, so you can view the current (non versioned) documentation.
Versioning
Documentation is versioned for the docs and graphql sections. Versioned content lives in:
docs_versioned_docs/anddocs_versioned_sidebars/(anddocs_versions.json)graphql_versioned_docs/andgraphql_versioned_sidebars/(andgraphql_versions.json)
The folders docs/ and docs-graphql/ are the βnextβ (unreleased) content. They appear in the version dropdown as βnextβ only when running the site locally with includeCurrentVersion: true in docusaurus.config.ts. When deployed, the site serves only versioned documentation (e.g. v25.4, v25.3, v25.2); the βnextβ content is not shown on the live site.
Where to edit:
- For the next release: Edit the page in
docs/ordocs-graphql/. Those are the only places that represent the upcoming release. - For the current release (whatβs live): Apply the same change in the corresponding versioned folder (e.g.
docs_versioned_docs/version-v25.4/...orgraphql_versioned_docs/version-v25.4/...for the latest). If a fix or clarification should be in the current release, duplicate the change there.
Note for reviewers: The βEdit this pageβ link always points to the βnextβ page (docs/ or docs-graphql/). When reviewing PRs, check whether the change should also be ported back to the current versionβs versioned folder.
To create a new version:
- Use the Docusaurus CLI:
npm run docusaurus docs:version:docs <version>npm run docusaurus docs:version:graphql <version> - This creates a new version snapshot of the current docs
Deployment
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.
Contribution Guidelines
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 annotationTechnical 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").
Technical Writing Style
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.
References
In Docusaurus, use standard Markdown links for internal references. For example, to reference a term in the glossary:
[UID](/dgraph-glossary#uid)File Structure
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