# Cayley — Open-Source Graph Database Inspired by Google's Knowledge Graph > Cayley is an open-source graph database written in Go, inspired by the graph infrastructure behind Google's Knowledge Graph. It supports multiple storage backends and query languages for flexible graph traversal. ## Install Save as a script file and run: # Cayley — Open-Source Graph Database Inspired by Google's Knowledge Graph ## Quick Use ```bash go install github.com/cayleygraph/cayley/cmd/cayley@latest cayley http --dbpath=./data # Open http://localhost:64210 for the web UI ``` ## Introduction Cayley is a graph database written in Go, originally created at Google and open-sourced for community use. It provides a flexible query layer supporting Gizmo (JavaScript-based) and GraphQL, backed by pluggable storage engines ranging from in-memory to PostgreSQL and MongoDB. ## What Cayley Does - Stores and queries graph-structured data using subject-predicate-object triples (quads) - Supports multiple query languages: Gizmo (JS), GraphQL, and MQL - Pluggable backend storage: BoltDB, PostgreSQL, MongoDB, in-memory, and more - Provides a built-in web UI for visual graph exploration and query execution - Imports and exports standard RDF formats (N-Quads, JSON-LD, Turtle) ## Architecture Overview Cayley uses a quad store model where each fact is stored as a quad (subject, predicate, object, label). The query layer compiles traversal expressions into an iterator-based execution plan that operates against a pluggable backend. Storage engines implement a common interface, allowing swaps between BoltDB for embedded use, PostgreSQL for durability, or in-memory stores for testing. ## Self-Hosting & Configuration - Install via Go toolchain or download prebuilt binaries from GitHub releases - Configure storage backend with `--dbpath` flag or YAML config file - Default HTTP port is 64210; override with `--host` and `--port` flags - Load initial data with `cayley load --quads=` supporting N-Quads and JSON-LD - Deploy with Docker using the official `cayleygraph/cayley` image ## Key Features - Multiple query languages let teams pick what fits their mental model - Pluggable backends mean you can start embedded and scale to PostgreSQL later - Built-in web visualizer for interactive graph exploration - Native Go library for embedding directly into Go applications - RDF-compatible data model aligns with linked data standards ## Comparison with Similar Tools - **Neo4j** — More mature with Cypher, but requires JVM and commercial license for clustering - **Dgraph** — Distributed GraphQL-native DB with higher operational complexity - **ArangoDB** — Multi-model but heavier; Cayley is lighter for pure graph workloads - **Apache Jena** — Full semantic web stack in Java; Cayley is simpler and Go-native ## FAQ **Q: What query language should I start with?** A: Gizmo (JavaScript-based) is the most documented and flexible for traversals. GraphQL works well if you already know your schema. **Q: Can Cayley handle large datasets?** A: Yes, with PostgreSQL or MongoDB backends it handles millions of quads. For billions, consider a distributed graph DB instead. **Q: Is Cayley still maintained?** A: The project has slower release cadence but remains functional and accepts contributions. **Q: Can I use Cayley as an embedded library?** A: Yes, import the Go packages directly and use the graph API without running a server. ## Sources - https://github.com/cayleygraph/cayley - https://cayley.gitbook.io/cayley --- Source: https://tokrepo.com/en/workflows/cayley-open-source-graph-database-inspired-google-s-4c55125e Author: Script Depot