Open-source project
cayleygraph/cayley avatar
cayleygraph/cayley

Cayley: An Open-Source Graph Database for Linked Data in Go

An open-source graph database

15,070 stars1,235 forksGoApache-2.0

At a glance

What is it?
Cayley is a Go-based graph database for Linked Data, inspired by Google's Knowledge Graph backend. It supports multiple query languages including Gizmo, GraphQL-inspired syntax, and MQL, and can be backed by LevelDB, PostgreSQL, MySQL, SQLite, or MongoDB.
Who is it for?
Cayley is a reasonable choice for projects that need a self-contained graph database with Linked Data semantics and want to query it with a Gremlin-inspired language or GraphQL syntax.
Can I use it commercially?
Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 34 days ago.
What is it written in?
Mainly Go, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 30, 2026, and from our analysis. They are not legal advice.

Editorial analysis

What Cayley is and the problem it solves

Cayley is a graph database designed for Linked Data, the W3C standard for representing and connecting information across the web using subject-predicate-object triples (quads, in Cayley's model). It was inspired by the graph database that powered Google's Knowledge Graph, formerly known as Freebase.

Graph databases are the right tool when relationships between entities are as important as the entities themselves. A relational database models relationships as foreign keys and joins; a graph database models them as first-class edges between nodes. Cayley stores quads (four-part tuples with an added context or graph label) and allows multi-hop traversal queries that would require many joins in SQL.

The README states that on 2014-era consumer hardware with an average disk, Cayley handled 134 million quads in LevelDB with a multi-hop intersection query ("films starring X and Y") taking roughly 150 milliseconds.

Query languages: Gizmo, GraphQL, and MQL

Cayley supports three query languages, each serving a different audience. Gizmo is the primary query language, drawing its API design from Apache TinkerPop's Gremlin. It is a JavaScript-based graph traversal language where queries are chained method calls on graph objects. The README links to the docs/gizmoapi.md file for the full API reference.

The GraphQL-inspired query language (documented in docs/graphql.md) provides a declarative query syntax familiar to anyone who has used GraphQL, adapted for graph traversal rather than hierarchical data fetching.

MQL (documented in docs/mql.md) is a simplified query format for people familiar with Freebase's original query language. It is a historical compatibility layer rather than a recommended starting point for new projects.

All three languages are accessible through the built-in web-based query editor and REPL. Cayley ships with a browser-based visualizer as well, which renders query results as a graph diagram without any additional tooling.

Running Cayley with Docker

The repository includes a Dockerfile and a pre-built Docker image. The Dockerfile uses a multi-stage build: a Go 1.22 builder stage compiles the cayley binary with static linking, and the final image is a scratch container (no OS) holding only the binary, a bolt index file, and CA certificates.

The Dockerfile exposes port 64210 and starts Cayley in HTTP server mode:

bash
docker run cayleygraph/cayley --init -i /data/my_data.nq

The ENTRYPOINT is set to `cayley http --host=:64210`, so any arguments passed to `docker run` after the image name are appended to that command. The Dockerfile defines a volume at /data for persisting the database and configuration.

For building from source, the go.mod file targets Go 1.22 with a 1.22.5 toolchain. The Makefile equivalent for the project is a set of goreleaser configurations.

Backend storage options and the modular design

Cayley's architecture separates the query engine from the storage backend. The go.mod file lists backends including BoltDB (local embedded key-value store), LevelDB via goleveldb, PostgreSQL via pgx v5, MySQL via the go-sql-driver, and SQLite via mattn/go-sqlite3.

The modular design means the same Gizmo or GraphQL query runs against a local embedded store for development and against PostgreSQL in production without changing the query code. The cayley_example.yml file in the repository root shows the configuration format for specifying which backend to use.

The README describes the database as production-ready and lists usage by companies for production workloads, though specific company names are not given. The example files under examples/ cover hello_bolt (embedded), hello_schema, hello_world, and transaction patterns.

Limitations: release cadence and community activity

The most significant practical concern about Cayley is the release timeline. The latest tagged release is v0.7.7 from October 2019. The main branch receives commits (the last push was 2026-08-27), but the absence of formal releases since 2019 means there is no changelog for changes made in the past several years and no SemVer guarantee for users tracking the main branch.

For production deployments, this gap matters. Users who need a stable, versioned release should verify which features and backends are actually tested before adopting the main branch.

Cayley also lacks some features common in commercial graph databases. There is no built-in role-based access control, no native cluster or replication support documented in the README, and no query planner cost model described. For knowledge graph workloads that require SPARQL (the W3C standard query language for RDF data), Cayley's Gizmo language is not a drop-in substitute.

Cayley versus Neo4j

Neo4j is the most widely used alternative graph database. It uses the Cypher query language and stores a property graph rather than RDF quads. The distinction matters: Neo4j's property graph attaches arbitrary key-value properties to nodes and edges, while Cayley models everything as quads (subject, predicate, object, label), which maps naturally to RDF and Linked Data standards.

Neo4j offers enterprise clustering, full-text search integration, and a hosted cloud service. Cayley is entirely self-hosted, runs from a single binary, and has no commercial offering. For teams that need Linked Data compatibility or want a lightweight embedded graph store without a managed service, Cayley's single-binary model is simpler to deploy. For teams that need enterprise features or active vendor support, Neo4j is the more appropriate choice.

The Apache-2.0 licence on Cayley permits use in commercial products without copyleft requirements.

Editorial conclusion

Cayley is a reasonable choice for projects that need a self-contained graph database with Linked Data semantics and want to query it with a Gremlin-inspired language or GraphQL syntax. The last GitHub release was v0.7.7 in October 2019, which is a significant gap; the main branch receives commits, with the last push on 2026-08-27, but teams should verify that the specific backend they plan to use (LevelDB, PostgreSQL, or MongoDB) is stable for their workload before committing to it in production.

Frequently asked questions

What is the Cayley graph database used for?

Cayley is used for storing and querying Linked Data in a quad-based graph model. The README lists knowledge graph applications and multi-hop relationship queries as primary use cases, noting a benchmark of 134 million quads in LevelDB with intersection queries completing in roughly 150 milliseconds on 2014-era hardware.

Which query languages does Cayley support?

Cayley supports three query languages: Gizmo (inspired by Apache TinkerPop's Gremlin, documented in docs/gizmoapi.md), a GraphQL-inspired syntax (docs/graphql.md), and MQL, a simplified format for Freebase users (docs/mql.md). All three are accessible through the built-in web REPL.

What storage backends does Cayley support?

According to the go.mod file, Cayley supports BoltDB (embedded), LevelDB, PostgreSQL (via pgx v5), MySQL, and SQLite. The modular architecture allows switching backends via configuration without changing query code.

Official sources

  1. cayleygraph/cayley on GitHub
  2. License: Apache-2.0
  3. Project website
  4. README
  5. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/cayleygraph-cayley.svg)](https://hysenlabs.com/projects/cayleygraph-cayley)