Skip to content
portfolio/anvil
DATABASE ENGINE

Anvil DB

A graph database written in Rust - Cypher, GraphQL, and a plugin system.

Anvil is a full graph database built from the storage engine up: a page-based store with write-ahead logging and MVCC, a complete Cypher query pipeline, an auto-generated GraphQL API, graph algorithms, clustering, and row-level security - all in Rust. Managed from the browser with its companion UI, Hammer.

3,270tests
13crates
4drivers
53apoc fns

Cypher Engine

Full lexer → parser → semantic analyzer → cost-based planner → Volcano executor with 25+ operators, multi-hop BFS, quantified paths, and MERGE.

GraphQL API

Schema auto-generated from graph structure, Relay-spec connections, filtering, and live subscriptions over graphql-transport-ws.

ACID Transactions

MVCC with version chains, three snapshot-isolation levels, record-level locking, deadlock detection, and ARIES-style recovery.

Storage Engine

Page-based store with LRU cache, CRC32 WAL, B+ tree indexes (unique / composite / full-text / spatial), LZ4/Zstd compression, tiered I/O.

Graph Algorithms

PageRank, Dijkstra / A*, BFS/DFS, Louvain and label propagation, connected components, centrality measures, MST, and node similarity.

Clustering

Leader-follower WAL streaming, Raft consensus, read replicas with causal consistency, hash / label sharding, and rolling upgrades.

Plugin System

Hybrid native Rust plus scripting (Lua, Python, WASM, JS/TS, Starlark) with sandboxing, hot-reload, and namespace isolation.

Security & Auth

PostgreSQL-inspired row-level security, graph-native users/roles, JWT (RS256) with JWKS, Argon2id hashing, and refresh tokens.

Client Drivers

First-party drivers for Rust, TypeScript, Python, and Go, all speaking the anvil:// (and anvil+tls://) URI scheme.

Document Store

A built-in NoSQL store with schema-namespaced collections, composite keys, TTL, secondary indexes (GSI/LSI), and graph-document sync.

WORKSPACE CRATES
anvil-coregraph data model
anvil-storagepages, WAL, B+ tree, MVCC
anvil-cypherlexer → planner → executor
anvil-graphqlauto-schema, subscriptions
anvil-serverHTTP, auth, metrics, tracing
anvil-algorithmscentrality, community, paths
anvil-clusterreplication, Raft, sharding
anvil-plugin-sdknative + scripting runtimes