# rokn/vecvec architecture

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

- Interactive diagram: https://gitdiagram.com/rokn/vecvec
- Repository: https://github.com/rokn/vecvec

## Overview

vecvec is an in-memory-primary vector database with durable writes and git-like collection versioning. The main workflow is a client or UI request through a transport adapter and shared service into the core, where vectors are indexed, searched, and persisted; version selectors enable snapshot queries and other history operations. The README documents major engine capabilities that the sampled excerpts do not fully expose. Those links are shown as documented rather than inferred from unsampled call sites.

Main entry points: [`crates/vecvec-core/src/collection.rs`](https://github.com/rokn/vecvec/blob/main/crates/vecvec-core/src/collection.rs) (Collection operations), [`crates/vecvec-server/src/service.rs`](https://github.com/rokn/vecvec/blob/main/crates/vecvec-server/src/service.rs) (Shared service facade), [`vvui/src/store.ts`](https://github.com/rokn/vecvec/blob/main/vvui/src/store.ts) (UI state and actions), [`crates/vecvec-server/src/grpc.rs`](https://github.com/rokn/vecvec/blob/main/crates/vecvec-server/src/grpc.rs) (gRPC API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["Clients and UI"]
  node_cli["Admin CLI<br/>[main.rs]"]
  node_rustclient["Rust client<br/>[lib.rs]"]
  node_goclient["Go client<br/>[client.go]"]
  node_ui["Browser console<br/>[App.tsx]"]
  node_uistore["UI state and actions<br/>[store.ts]"]
  node_uipanels["Browse and manage<br/>[Timeline.tsx]"]
  node_uisearch["Search interface<br/>[SearchPanel.tsx]"]
  node_uigraph["Vector graph view<br/>[GraphScope.tsx]"]
end

subgraph group_server["Server API"]
  node_api["REST API<br/>[rest.rs]"]
  node_grpc["gRPC API<br/>[grpc.rs]"]
  node_service["Shared service facade<br/>[service.rs]"]
  node_registry["Collection registry<br/>[registry.rs]"]
  node_blocking["Blocking work bridge<br/>[blocking.rs]"]
end

subgraph group_engine["Vector engine"]
  node_collection["Collection operations<br/>[collection.rs]"]
  node_index["HNSW and exact indexes<br/>[mod.rs]"]
  node_distance["SIMD distance kernels<br/>[dispatch.rs]"]
  node_quant["Quantized search<br/>[mod.rs]"]
  node_payload["Payload filtering<br/>[filter.rs]"]
end

subgraph group_storage["Segments and durability"]
  node_segments["Segment search and storage<br/>[search.rs]"]
  node_durable[("WAL and checkpoints<br/>[durable.rs]")]
end

subgraph group_history["Version history"]
  node_version[("Snapshots and branches<br/>[store.rs]")]
end

node_user(("Operator or app"))
node_actor(("External caller"))

node_user -->|"runs commands"| node_cli
node_user -.->|"uses client"| node_rustclient
node_user -.->|"uses client"| node_goclient
node_user -.->|"opens console"| node_ui
node_ui -->|"initializes"| node_uistore
node_uistore -->|"requests data"| node_api
node_uipanels -->|"reads actions"| node_uistore
node_uisearch -->|"reads actions"| node_uistore
node_uigraph -->|"reads state"| node_uistore
node_cli -.->|"calls gRPC"| node_grpc
node_rustclient -.->|"calls gRPC"| node_grpc
node_goclient -.->|"calls gRPC"| node_grpc
node_actor -->|"sends requests"| node_api
node_actor -->|"sends requests"| node_grpc
node_api -->|"dispatches REST"| node_service
node_grpc -->|"dispatches RPC"| node_service
node_service -->|"looks up collections"| node_registry
node_service -->|"offloads work"| node_blocking
node_service -.->|"runs operations"| node_collection
node_collection -.->|"searches vectors"| node_index
node_index -->|"scores candidates"| node_distance
node_index -->|"ranks and rescores"| node_quant
node_collection -.->|"filters queries"| node_payload
node_collection -.->|"reads and writes"| node_segments
node_collection -->|"persists changes"| node_durable
node_collection -->|"commits snapshots"| node_version
node_version -->|"shares segments"| node_segments

click node_cli "https://github.com/rokn/vecvec/blob/main/crates/vecvec-cli/src/main.rs"
click node_rustclient "https://github.com/rokn/vecvec/blob/main/crates/vecvec-client/src/lib.rs"
click node_goclient "https://github.com/rokn/vecvec/blob/main/sdk/go/client.go"
click node_ui "https://github.com/rokn/vecvec/blob/main/vvui/src/App.tsx"
click node_uistore "https://github.com/rokn/vecvec/blob/main/vvui/src/store.ts"
click node_uipanels "https://github.com/rokn/vecvec/blob/main/vvui/src/components/Timeline.tsx"
click node_uisearch "https://github.com/rokn/vecvec/blob/main/vvui/src/components/SearchPanel.tsx"
click node_uigraph "https://github.com/rokn/vecvec/blob/main/vvui/src/components/GraphScope.tsx"
click node_api "https://github.com/rokn/vecvec/blob/main/crates/vecvec-server/src/rest.rs"
click node_grpc "https://github.com/rokn/vecvec/blob/main/crates/vecvec-server/src/grpc.rs"
click node_service "https://github.com/rokn/vecvec/blob/main/crates/vecvec-server/src/service.rs"
click node_registry "https://github.com/rokn/vecvec/blob/main/crates/vecvec-server/src/registry.rs"
click node_blocking "https://github.com/rokn/vecvec/blob/main/crates/vecvec-server/src/blocking.rs"
click node_collection "https://github.com/rokn/vecvec/blob/main/crates/vecvec-core/src/collection.rs"
click node_index "https://github.com/rokn/vecvec/blob/main/crates/vecvec-core/src/index/hnsw/mod.rs"
click node_distance "https://github.com/rokn/vecvec/blob/main/crates/vecvec-core/src/distance/dispatch.rs"
click node_quant "https://github.com/rokn/vecvec/blob/main/crates/vecvec-core/src/quantization/mod.rs"
click node_payload "https://github.com/rokn/vecvec/blob/main/crates/vecvec-core/src/index/filter.rs"
click node_segments "https://github.com/rokn/vecvec/blob/main/crates/vecvec-core/src/segment/search.rs"
click node_durable "https://github.com/rokn/vecvec/blob/main/crates/vecvec-core/src/durable.rs"
click node_version "https://github.com/rokn/vecvec/blob/main/crates/vecvec-core/src/version/store.rs"

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_cli,node_rustclient,node_goclient,node_ui,node_uistore,node_uipanels,node_uisearch,node_uigraph toneBlue
class node_api,node_grpc,node_service,node_registry,node_blocking toneAmber
class node_collection,node_index,node_distance,node_quant,node_payload toneMint
class node_segments,node_durable toneRose
class node_version,node_user,node_actor toneIndigo
```

## Components

### Clients and UI

- [Admin CLI](https://github.com/rokn/vecvec/blob/main/crates/vecvec-cli/src/main.rs): `crates/vecvec-cli/src/main.rs`
- [Rust client](https://github.com/rokn/vecvec/blob/main/crates/vecvec-client/src/lib.rs): `crates/vecvec-client/src/lib.rs`
- [Go client](https://github.com/rokn/vecvec/blob/main/sdk/go/client.go): `sdk/go/client.go`
- [Browser console](https://github.com/rokn/vecvec/blob/main/vvui/src/App.tsx): `vvui/src/App.tsx`
- [UI state and actions](https://github.com/rokn/vecvec/blob/main/vvui/src/store.ts): `vvui/src/store.ts`
- [Browse and manage](https://github.com/rokn/vecvec/blob/main/vvui/src/components/Timeline.tsx): `vvui/src/components/Timeline.tsx`
- [Search interface](https://github.com/rokn/vecvec/blob/main/vvui/src/components/SearchPanel.tsx): `vvui/src/components/SearchPanel.tsx`
- [Vector graph view](https://github.com/rokn/vecvec/blob/main/vvui/src/components/GraphScope.tsx): `vvui/src/components/GraphScope.tsx`

### Server API

- [REST API](https://github.com/rokn/vecvec/blob/main/crates/vecvec-server/src/rest.rs): `crates/vecvec-server/src/rest.rs`
- [gRPC API](https://github.com/rokn/vecvec/blob/main/crates/vecvec-server/src/grpc.rs): `crates/vecvec-server/src/grpc.rs`
- [Shared service facade](https://github.com/rokn/vecvec/blob/main/crates/vecvec-server/src/service.rs): `crates/vecvec-server/src/service.rs`
- [Collection registry](https://github.com/rokn/vecvec/blob/main/crates/vecvec-server/src/registry.rs): `crates/vecvec-server/src/registry.rs`
- [Blocking work bridge](https://github.com/rokn/vecvec/blob/main/crates/vecvec-server/src/blocking.rs): `crates/vecvec-server/src/blocking.rs`

### Vector engine

- [Collection operations](https://github.com/rokn/vecvec/blob/main/crates/vecvec-core/src/collection.rs): `crates/vecvec-core/src/collection.rs`
- [HNSW and exact indexes](https://github.com/rokn/vecvec/blob/main/crates/vecvec-core/src/index/hnsw/mod.rs): `crates/vecvec-core/src/index/hnsw/mod.rs`
- [SIMD distance kernels](https://github.com/rokn/vecvec/blob/main/crates/vecvec-core/src/distance/dispatch.rs): `crates/vecvec-core/src/distance/dispatch.rs`
- [Quantized search](https://github.com/rokn/vecvec/blob/main/crates/vecvec-core/src/quantization/mod.rs): `crates/vecvec-core/src/quantization/mod.rs`
- [Payload filtering](https://github.com/rokn/vecvec/blob/main/crates/vecvec-core/src/index/filter.rs): `crates/vecvec-core/src/index/filter.rs`

### Segments and durability

- [Segment search and storage](https://github.com/rokn/vecvec/blob/main/crates/vecvec-core/src/segment/search.rs): `crates/vecvec-core/src/segment/search.rs`
- [WAL and checkpoints](https://github.com/rokn/vecvec/blob/main/crates/vecvec-core/src/durable.rs): `crates/vecvec-core/src/durable.rs`

### Version history

- [Snapshots and branches](https://github.com/rokn/vecvec/blob/main/crates/vecvec-core/src/version/store.rs): `crates/vecvec-core/src/version/store.rs`

### Other components

- **Operator or app**
- **External caller**

## Connections

- Operator or app → Admin CLI: runs commands
- Operator or app → Rust client: uses client
- Operator or app → Go client: uses client
- Operator or app → Browser console: opens console
- Browser console → UI state and actions: initializes (evidence: `vvui/src/App.tsx`)
- UI state and actions → REST API: requests data (evidence: `vvui/src/store.ts`)
- Browse and manage → UI state and actions: reads actions (evidence: `vvui/src/App.tsx`)
- Search interface → UI state and actions: reads actions (evidence: `vvui/src/components/SearchPanel.tsx`)
- Vector graph view → UI state and actions: reads state (evidence: `vvui/src/components/GraphScope.tsx`)
- Admin CLI → gRPC API: calls gRPC
- Rust client → gRPC API: calls gRPC
- Go client → gRPC API: calls gRPC
- External caller → REST API: sends requests
- External caller → gRPC API: sends requests
- REST API → Shared service facade: dispatches REST (evidence: `crates/vecvec-server/src/rest.rs`)
- gRPC API → Shared service facade: dispatches RPC (evidence: `crates/vecvec-server/src/grpc.rs`)
- Shared service facade → Collection registry: looks up collections (evidence: `crates/vecvec-server/src/service.rs`)
- Shared service facade → Blocking work bridge: offloads work (evidence: `crates/vecvec-server/src/service.rs`)
- Shared service facade → Collection operations: runs operations
- Collection operations → HNSW and exact indexes: searches vectors
- HNSW and exact indexes → SIMD distance kernels: scores candidates (evidence: `crates/vecvec-core/src/index/hnsw/mod.rs`)
- HNSW and exact indexes → Quantized search: ranks and rescores (evidence: `crates/vecvec-core/src/index/hnsw/mod.rs`)
- Collection operations → Payload filtering: filters queries
- Collection operations → Segment search and storage: reads and writes
- Collection operations → WAL and checkpoints: persists changes
- Collection operations → Snapshots and branches: commits snapshots
- Snapshots and branches → Segment search and storage: shares segments
