# ArangoDB — Native Multi-Model Database (Documents, Graphs, Key-Value) > ArangoDB is a scalable multi-model database that handles documents, graphs, and key-value data with one engine and one query language (AQL). It replaces three databases with one — without giving up performance. ## Install Save as a script file and run: # ArangoDB — Native Multi-Model Database ## Quick Use ```bash # Docker docker run -d -e ARANGO_ROOT_PASSWORD=pw -p 8529:8529 arangodb:3.12 # Web UI at http://localhost:8529 ``` ```javascript // Using the JS driver import { Database } from "arangojs"; const db = new Database({ url: "http://localhost:8529", auth: { username: "root", password: "pw" } }); await db.useDatabase("_system"); const People = db.collection("people"); await People.save({ _key: "alice", name: "Alice", age: 30 }); ``` ```aql // AQL: join across document collections and graph edges in one query FOR person IN people FILTER person.age > 25 FOR post IN 1..2 OUTBOUND person follows, writes FILTER post.title =~ "distributed" RETURN { author: person.name, post: post.title } ``` ## Introduction ArangoDB lets you model documents, graphs, and key-value pairs in the same database — and query them all with AQL (ArangoDB Query Language), which reads like SQL for graphs. Instead of running MongoDB + Neo4j + Redis, one cluster handles all three workloads. With over 14,000 GitHub stars, ArangoDB is used by Oxford University Press, Cisco, FlightAware, and many others. It scales horizontally via automatic sharding (SmartGraphs, SmartJoins) and supports ACID transactions across documents and graph edges. ## What ArangoDB Does ArangoDB stores JSON documents in **collections** (like MongoDB). Edge collections link documents to form **graphs**. Every document also has a key, so it doubles as a key-value store. AQL queries combine document lookups, joins, and graph traversals in one pass. ## Architecture Overview ``` Clients (HTTP / Foxx / Drivers) | [ArangoDB Coordinator] AQL parser, planner, router | +------+------+------+ | | | | [DB Server] [DB Server] [DB Server] RocksDB engine Shards of docs + edges | [Agency (Raft-based config store)] cluster metadata + leader election Data models on one engine: documents -> JSON collections graphs -> edge collections, AQL traversals key-value -> document _key lookups search -> ArangoSearch views (inverted index) ``` ## Self-Hosting & Configuration ```aql // Graph traversal: find friends-of-friends under 35 FOR v, e, p IN 2..2 OUTBOUND "people/alice" knows FILTER v.age < 35 RETURN DISTINCT v.name // Geo + document + graph in one query FOR place IN GEO_POINT(places, [-73.99, 40.73], 0, 1000) FOR visitor, visit IN 1..1 INBOUND place visited FILTER visit.rating >= 4 RETURN { place: place.name, visitor: visitor.name } // ArangoSearch (full-text) across many collections FOR doc IN combined_view SEARCH ANALYZER( doc.title IN TOKENS("distributed database", "text_en") OR doc.description IN TOKENS("cluster", "text_en"), "text_en") SORT BM25(doc) DESC LIMIT 20 RETURN doc ``` ## Key Features - **Multi-model** — documents, graphs, key-value, search in one DB - **AQL** — unified query language for all data models - **ACID transactions** — cross-collection, cluster-wide - **SmartGraphs** — sharded graphs that preserve locality - **SmartJoins** — co-located joins across sharded collections - **ArangoSearch** — full-text, BM25 + tf-idf, multi-language analyzers - **Foxx** — server-side JavaScript microservices inside the DB - **Horizontal scale** — automatic sharding, replication, failover ## Comparison with Similar Tools | Feature | ArangoDB | MongoDB | Neo4j | Couchbase | Postgres | |---|---|---|---|---|---| | Documents | Yes | Yes (focus) | No | Yes | JSONB | | Graphs | Yes | Limited | Yes (focus) | No | Via extensions | | Key-Value | Yes | Via _id | No | Yes | Yes (kv tables) | | Full-text | ArangoSearch | Atlas Search | Lucene plugin | FTS | pg_trgm / tsvector | | Single query language | AQL | MQL + Aggregation | Cypher | N1QL | SQL + extensions | | ACID | Yes | Yes (4.0+) | Yes | Via 3rd party | Yes | | Best For | Multi-model needs | Document stores | Graph-heavy OLTP | Caching + docs | Relational + extensions | ## FAQ **Q: ArangoDB vs MongoDB + Neo4j?** A: If your app needs both documents and graphs, one database is simpler than two. ArangoDB handles both with similar performance to specialists for most workloads. **Q: Is ArangoDB open source?** A: Yes, Apache-2.0. There is an Enterprise Edition (paid) with SmartGraphs extras, hot backups, audit log, and more. **Q: Performance vs Neo4j for deep traversals?** A: Neo4j is optimized for pure graph OLTP and often faster for deep traversals on small datasets. ArangoDB is competitive and often wins on mixed document + graph workloads. **Q: What is Foxx?** A: Foxx is ArangoDB's embedded JavaScript microservice framework. Deploy REST APIs that run inside the DB process, eliminating round-trip latency for complex business logic. ## Sources - GitHub: https://github.com/arangodb/arangodb - Docs: https://docs.arangodb.com - Company: ArangoDB Inc. - License: Apache-2.0 --- Source: https://tokrepo.com/en/workflows/09258540-37d2-11f1-9bc6-00163e2b0d79 Author: Script Depot