# aoiflux/graphene architecture

> Architecture diagram of the GitHub repository aoiflux/graphene, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aoiflux/graphene
- Repository: https://github.com/aoiflux/graphene

## Overview

GrapheneDB is an embeddable Go graph engine: clients create or open a graph, mutate and query it, then may export data or inspect it visually. It offers in-memory and durable CSR/WAL backends, indexed queries, traversal and pattern matching, and a CLI. The graph includes documented capabilities whose implementation was not sampled; those links cite the README, and unsampled internals are represented at their exact enclosing directories.

Main entry points: [`graphene.go`](https://github.com/aoiflux/graphene/blob/main/graphene.go) (Graph facade), [`disk/store.go`](https://github.com/aoiflux/graphene/blob/main/disk/store.go) (Disk backend), [`bulk/bulk.go`](https://github.com/aoiflux/graphene/blob/main/bulk/bulk.go) (Bulk transfer), [`memory/store.go`](https://github.com/aoiflux/graphene/blob/main/memory/store.go) (Memory backend)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Graph API"]
  node_graph["Graph facade<br/>[graphene.go]"]
  node_transactions["Transactions<br/>[transaction.go]"]
end

subgraph group_query["Queries and analysis"]
  node_traversal["Graph traversal"]
  node_pattern["Pattern matching<br/>[subgraph.go]"]
end

subgraph group_storage["Storage and indexing"]
  node_memory[("Memory backend<br/>[store.go]")]
  node_disk[("Disk backend<br/>[store.go]")]
  node_wal["WAL replay<br/>[wal.go]"]
  node_compact["CSR compaction<br/>[compact.go]"]
  node_indexes["Property indexes<br/>[property_index.go]"]
  node_composite["Composite indexes<br/>[composite_index.go]"]
end

subgraph group_transfer["Import and export"]
  node_bulk["Bulk transfer<br/>[bulk.go]"]
  node_formats["CSV and JSONL"]
  node_backup["Native dump"]
end

subgraph group_interface["CLI and visualization"]
  node_cli["Graphene CLI<br/>[main.go]"]
  node_cliquery["Query commands<br/>[cmd_query.go]"]
  node_clitransfer["Transfer commands<br/>[cmd_transfer.go]"]
  node_visualization["Graph visualization<br/>[exporter.go]"]
end

node_client(("Application"))
node_external[("Local filesystem")]

node_client -->|"opens or creates"| node_graph
node_graph -->|"uses"| node_memory
node_graph -->|"opens"| node_disk
node_graph -->|"runs traversals"| node_traversal
node_graph -.->|"mutates through"| node_transactions
node_memory -->|"maintains"| node_indexes
node_disk -->|"uses"| node_indexes
node_disk -->|"replays"| node_wal
node_disk -->|"compacts"| node_compact
node_compact -->|"persists index"| node_indexes
node_indexes -.->|"supports composites"| node_composite
node_traversal -.->|"includes matching"| node_pattern
node_pattern -->|"reads graph"| node_memory
node_bulk -->|"exports and imports"| node_formats
node_bulk -->|"supports dump"| node_backup
node_bulk -.->|"transfers records"| node_memory
node_bulk -.->|"transfers records"| node_disk
node_cli -.->|"dispatches"| node_cliquery
node_cli -.->|"dispatches"| node_clitransfer
node_cliquery -->|"queries"| node_graph
node_clitransfer -->|"transfers data"| node_bulk
node_clitransfer -->|"opens store"| node_disk
node_graph -.->|"exports view"| node_visualization
node_disk -.->|"persists files"| node_external

click node_graph "https://github.com/aoiflux/graphene/blob/main/graphene.go"
click node_memory "https://github.com/aoiflux/graphene/blob/main/memory/store.go"
click node_disk "https://github.com/aoiflux/graphene/blob/main/disk/store.go"
click node_wal "https://github.com/aoiflux/graphene/blob/main/disk/wal.go"
click node_compact "https://github.com/aoiflux/graphene/blob/main/disk/compact.go"
click node_indexes "https://github.com/aoiflux/graphene/blob/main/index/property_index.go"
click node_composite "https://github.com/aoiflux/graphene/blob/main/index/composite_index.go"
click node_traversal "https://github.com/aoiflux/graphene/tree/main/traversal"
click node_pattern "https://github.com/aoiflux/graphene/blob/main/traversal/subgraph.go"
click node_transactions "https://github.com/aoiflux/graphene/blob/main/transaction.go"
click node_bulk "https://github.com/aoiflux/graphene/blob/main/bulk/bulk.go"
click node_formats "https://github.com/aoiflux/graphene/tree/main/bulk"
click node_backup "https://github.com/aoiflux/graphene/tree/main/bulk"
click node_cli "https://github.com/aoiflux/graphene/blob/main/cmd/graphene/main.go"
click node_cliquery "https://github.com/aoiflux/graphene/blob/main/cmd/graphene/cmd_query.go"
click node_clitransfer "https://github.com/aoiflux/graphene/blob/main/cmd/graphene/cmd_transfer.go"
click node_visualization "https://github.com/aoiflux/graphene/blob/main/viz/exporter.go"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_graph,node_transactions toneBlue
class node_traversal,node_pattern,node_external toneAmber
class node_memory,node_disk,node_wal,node_compact,node_indexes,node_composite toneMint
class node_bulk,node_formats,node_backup toneRose
class node_cli,node_cliquery,node_clitransfer,node_visualization,node_client toneIndigo
```

## Components

### Graph API

- [Graph facade](https://github.com/aoiflux/graphene/blob/main/graphene.go): `graphene.go`
- [Transactions](https://github.com/aoiflux/graphene/blob/main/transaction.go): `transaction.go`

### Queries and analysis

- [Graph traversal](https://github.com/aoiflux/graphene/tree/main/traversal): `traversal`
- [Pattern matching](https://github.com/aoiflux/graphene/blob/main/traversal/subgraph.go): `traversal/subgraph.go`

### Storage and indexing

- [Memory backend](https://github.com/aoiflux/graphene/blob/main/memory/store.go): `memory/store.go`
- [Disk backend](https://github.com/aoiflux/graphene/blob/main/disk/store.go): `disk/store.go`
- [WAL replay](https://github.com/aoiflux/graphene/blob/main/disk/wal.go): `disk/wal.go`
- [CSR compaction](https://github.com/aoiflux/graphene/blob/main/disk/compact.go): `disk/compact.go`
- [Property indexes](https://github.com/aoiflux/graphene/blob/main/index/property_index.go): `index/property_index.go`
- [Composite indexes](https://github.com/aoiflux/graphene/blob/main/index/composite_index.go): `index/composite_index.go`

### Import and export

- [Bulk transfer](https://github.com/aoiflux/graphene/blob/main/bulk/bulk.go): `bulk/bulk.go`
- [CSV and JSONL](https://github.com/aoiflux/graphene/tree/main/bulk): `bulk`
- [Native dump](https://github.com/aoiflux/graphene/tree/main/bulk): `bulk`

### CLI and visualization

- [Graphene CLI](https://github.com/aoiflux/graphene/blob/main/cmd/graphene/main.go): `cmd/graphene/main.go`
- [Query commands](https://github.com/aoiflux/graphene/blob/main/cmd/graphene/cmd_query.go): `cmd/graphene/cmd_query.go`
- [Transfer commands](https://github.com/aoiflux/graphene/blob/main/cmd/graphene/cmd_transfer.go): `cmd/graphene/cmd_transfer.go`
- [Graph visualization](https://github.com/aoiflux/graphene/blob/main/viz/exporter.go): `viz/exporter.go`

### Other components

- **Application**
- **Local filesystem**

## Connections

- Application → Graph facade: opens or creates (evidence: `graphene.go`)
- Graph facade → Memory backend: uses (evidence: `graphene.go`)
- Graph facade → Disk backend: opens (evidence: `graphene.go`)
- Graph facade → Graph traversal: runs traversals (evidence: `graphene.go`)
- Graph facade → Transactions: mutates through
- Memory backend → Property indexes: maintains (evidence: `memory/store.go`)
- Disk backend → Property indexes: uses (evidence: `disk/store.go`)
- Disk backend → WAL replay: replays (evidence: `disk/store.go`)
- Disk backend → CSR compaction: compacts (evidence: `disk/store.go`)
- CSR compaction → Property indexes: persists index (evidence: `disk/compact.go`)
- Property indexes → Composite indexes: supports composites
- Graph traversal → Pattern matching: includes matching
- Pattern matching → Memory backend: reads graph (evidence: `traversal/subgraph.go`)
- Bulk transfer → CSV and JSONL: exports and imports (evidence: `bulk/bulk.go`)
- Bulk transfer → Native dump: supports dump (evidence: `bulk/bulk.go`)
- Bulk transfer → Memory backend: transfers records
- Bulk transfer → Disk backend: transfers records
- Graphene CLI → Query commands: dispatches
- Graphene CLI → Transfer commands: dispatches
- Query commands → Graph facade: queries (evidence: `cmd/graphene/cmd_query.go`)
- Transfer commands → Bulk transfer: transfers data (evidence: `cmd/graphene/cmd_transfer.go`)
- Transfer commands → Disk backend: opens store (evidence: `cmd/graphene/cmd_transfer.go`)
- Graph facade → Graph visualization: exports view
- Disk backend → Local filesystem: persists files
