Expand description
§velesdb-server
HTTP/REST server that exposes a VelesDB database — vector, text, graph and VelesQL — to any language.
§Objective
velesdb-core is an embedded engine: it lives inside one Rust process. As soon
as a second process — a Python service, a Node worker, an agent running on
another machine — needs the same data, you need a network boundary.
velesdb-server is that boundary: a single self-contained binary that wraps the
engine in an Axum HTTP API, adds API keys, TLS, rate limiting, health probes and
Prometheus metrics, and persists everything to a data directory (WAL + mmap)
that survives restarts. No JVM, no sidecar, no external dependency.
The engine behind VelesDB — the explainable, local-first memory engine for AI agents. It fuses vector + graph + columnar under VelesQL; the
why()recall trail returns the evidence path behind every answer.
§Use cases
- A Python or TypeScript service needs vector search, and you do not want to embed a Rust library in every runtime you ship.
- Several agents on a LAN share one memory store, authenticated with Bearer API keys over TLS.
- A local RAG prototype needs a backend that survives a laptop reboot without setting up a database cluster.
- A Kubernetes deployment needs liveness/readiness probes,
/metrics, and a cleanSIGTERMthat flushes the write-ahead logs. - A knowledge graph is queried with Cypher-style
MATCHand vector similarity in the same request.
§Prerequisites
| Requirement | Minimum version | Note |
|---|---|---|
| Rust | 1.90 | Only to build or cargo install; the release archives ship a prebuilt binary. Workspace rust-version. |
| C toolchain | any | Needed when building from source: rustls uses the ring backend. |
| OS | Linux, macOS, Windows | Prebuilt binaries for Linux x86_64, macOS x86_64/aarch64, Windows x86_64. |
| HTTP client | any | curl is used in every example below. |
§Installation
cargo install velesdb-serverPrebuilt archives (.tar.gz, .deb, .zip), Docker, and platform-specific
notes: docs/guides/INSTALLATION.md.
Container and orchestrator setup:
docs/guides/SERVER_DEPLOYMENT.md.
Building from a clone of this repository:
cargo build --release -p velesdb-server§First success in 60 seconds
# 1. Start the server and wait until it reports readiness
velesdb-server --port 8080 --data-dir ./velesdb_data &
until curl -sf http://localhost:8080/v1/ready > /dev/null; do sleep 1; done
# 2. Create a 4-dimensional collection
curl -sS -X POST http://localhost:8080/v1/collections \
-H "Content-Type: application/json" \
-d '{"name": "quickstart", "dimension": 4, "metric": "cosine"}'
echo
# 3. Insert three points
curl -sS -X POST http://localhost:8080/v1/collections/quickstart/points \
-H "Content-Type: application/json" \
-d '{"points": [
{"id": 1, "vector": [1.0, 0.0, 0.0, 0.0], "payload": {"title": "first"}},
{"id": 2, "vector": [0.9, 0.4, 0.0, 0.0], "payload": {"title": "second"}},
{"id": 3, "vector": [0.1, 0.9, 0.0, 0.0], "payload": {"title": "third"}}
]}'
echo
# 4. Search for the nearest two vectors
curl -sS -X POST http://localhost:8080/v1/collections/quickstart/search \
-H "Content-Type: application/json" \
-d '{"vector": [1.0, 0.0, 0.0, 0.0], "top_k": 2}'
echoExpected output — three JSON lines, in this order:
{"message":"Collection created","name":"quickstart","type":"vector","warnings":["Collection dimension and metric are immutable after creation. If your embedding model changes, create a new collection and reindex data.","For first queries, start without strict filters/thresholds, then tighten progressively."]}
{"count":3,"message":"Points upserted"}
{"results":[{"id":"1","score":1.0,"payload":{"title":"first"}},{"id":"2","score":0.91381156,"payload":{"title":"second"}}]}The code field is optional and omitted when no structured code applies. Use it for
programmatic error handling (e.g., retry on VELES-006, display user hint on VELES-004).
See ERROR_CODES.md for the full list.
§Operations
Everything an operator configures — API keys and their rotation, TLS, the
graceful-shutdown sequence and its WAL flush guarantee, the /health and
/ready probes — lives in Server security,
which is the canonical reference and covers each of them in more depth than a
README should.
Docker, Kubernetes manifests, rate limiting, CORS and the startup update check are in Deployment.
The short version:
| Concern | Set | Default |
|---|---|---|
| API keys | VELESDB_API_KEYS, or api_keys in velesdb.toml | none — the server runs in local dev mode and accepts every request |
| TLS | VELESDB_TLS_CERT / VELESDB_TLS_KEY, or --tls-cert / --tls-key | off (plain HTTP) |
| Data directory | VELESDB_DATA_DIR | ./data |
| Bind address | VELESDB_HOST / VELESDB_PORT | 127.0.0.1:8080 |
| Config file | VELESDB_CONFIG or --config | ./velesdb.toml if present |
Configuration priority, highest first: CLI flags > environment variables >
velesdb.toml > built-in defaults. Every section of the file is optional;
declare only what you override.
Distance metrics accepted by the API (cosine, euclidean, dot — aliases
dotproduct, inner, ip —, hamming, jaccard) are listed with their use
cases in the REST tour; measured
latency figures live in the benchmarks, pinned to
promise-contract.json.
§Examples
- REST tour — every endpoint family with runnable
curlrecipes: collections, quantization, points, search modes, sparse and hybrid search, VelesQL, graph,MATCH, indexes, errors. - Deployment — Docker, Kubernetes probes, rate limiting, CORS, update check.
- Server security — API keys, key rotation, TLS, graceful shutdown, health endpoints.
- Getting started — the wider VelesDB tour, engine included.
§API / commands
| Surface | Where |
|---|---|
| HTTP endpoint specification | docs/reference/api-reference.md |
| Machine-readable schema | docs/openapi.yaml, docs/openapi.json |
| Swagger UI | http://localhost:8080/swagger-ui — requires a build with --features swagger-ui |
Rust items (routes::api_routes, config, auth, tls) | docs.rs/velesdb-server |
| CLI flags | velesdb-server --help |
| Error codes | docs/reference/ERROR_CODES.md |
Routes are served under two prefixes: /v1/… is canonical, and the
unversioned /… form is kept for backward compatibility — its responses carry
deprecation: true and x-api-deprecated: Use /v1/ prefix.
§Known limits
- One process per data directory. The engine takes an exclusive OS-level lock on
<data_dir>/velesdb.lock. There is no built-in clustering, replication, or sharding: scale vertically, or shard at the application level. See CONCURRENCY_LOCKING.md. - Authentication is a flat list of API keys. No users, no roles, no per-collection scoping. Keys are read at startup, so rotation requires a restart (both old and new key can be active during the transition).
- Rate limiting is per process and in memory. Replicas do not share a budget; put a shared limiter in front if you need a global one.
- CORS is permissive by default (
allowed_origins = ["*"]); the server warns about it at startup. Restrict[cors]before exposing a browser-facing deployment. - Swagger UI is opt-in at build time (
--features swagger-ui); the released default build does not serve/swagger-uior/api-docs/openapi.json. - The
/v1prefix is added by the binary. Embeddingvelesdb_server::routes::api_routes()in your own Axum application gives you the unversioned routes; nest them yourself if you want the versioned form. - Engine-level limits (query length caps, GROUP BY ceilings, scan caps) are listed in docs/reference/KNOWN_LIMITATIONS.md.
§Compatibility
| Environment | Status | Note |
|---|---|---|
| Linux x86_64 (glibc) | Supported | .tar.gz and .deb release artifacts |
| macOS aarch64 (Apple Silicon) | Supported | .tar.gz release artifact |
| macOS x86_64 (Intel) | Supported | .tar.gz release artifact |
| Windows x86_64 (MSVC) | Supported | Portable .zip; no signed MSI installer yet |
| Docker | Supported | Repository Dockerfile: rust:1.97-bookworm builder, debian:bookworm-slim runtime, non-root user, port 8080 |
| Rust toolchain | 1.90 or later | Workspace MSRV, for cargo install and source builds |
velesdb-core | 5.0.0 | Same workspace version; non-optional dependency with openapi + persistence enabled |
| HTTP clients | Any | Plain JSON over HTTP/1.1, described by an OpenAPI 3.0 document |
§Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
curl: (7) Failed to connect to localhost port 8080 | The server is not running, or it bound another address — the startup log prints Bind address: <host>:<port>. | Start it, or set --host / --port. 127.0.0.1 is the default and is not reachable from another machine. |
{"error":"[VELES-002] Collection 'x' not found","code":"VELES-002"} | Wrong collection name, or the server was started on a different --data-dir (a missing directory is created empty). | curl http://localhost:8080/v1/collections to list what this instance actually holds. |
{"error":"Vector dimension mismatch for collection 'demo': expected 4, got 2. …","code":"VELES-004"} | The query vector does not match the collection dimension; dimension and metric are immutable after creation. | Use the embedding model the collection was built with, or create a new collection and reindex. |
401 with {"error":"Unauthorized","message":"missing Authorization header"} | API keys are configured, so every route except the health/readiness probes requires a key. | Add -H "Authorization: Bearer <key>". /metrics needs it too. |
429 Too Many Requests | The per-IP limiter (100 req/s by default) is saturated; the response carries retry-after. | Back off, raise --rate-limit, or pass --rate-limit 0 to disable it. |
The process exits at startup with tls_cert is set but tls_key is missing | TLS needs both files; a half-configured pair is refused rather than silently downgraded to HTTP. | Provide --tls-cert and --tls-key together, and check both paths exist. |
§License
VelesDB Core License 1.0 — see LICENSE.
velesdb-server v5.0.0 · Last updated: 2026-08-10 · Applies to: velesdb-core 5.0.0 · Report a docs error
§Crate-level notes
VelesDB Server - REST API library for the VelesDB vector database.
This module provides the HTTP handlers and types for the VelesDB REST API.
§OpenAPI Documentation
The API is documented using OpenAPI 3.0. Access the interactive documentation at:
- Swagger UI:
GET /swagger-ui - OpenAPI JSON:
GET /api-docs/openapi.json
Re-exports§
pub use onboarding::OnboardingMetrics;
Modules§
- auth
- API key authentication middleware.
- config
- Server configuration module.
- explain
- EXPLAIN query handler and plan building logic.
- match_
query - MATCH query handler for REST API (EPIC-045 US-007).
- onboarding
- Lightweight counters for first-hour troubleshooting diagnostics.
- query
- VelesQL query execution handlers.
- rate_
limit - Global per-IP rate limiting middleware backed by
tower-governor. - routes
- Route definitions for the VelesDB REST API.
- search
- Search handlers for vector similarity, text, and hybrid search.
- serde_
id - Serde helpers for serializing
u64IDs as JSON strings. - tls
- TLS configuration and server support via rustls.
Structs§
- Actual
Stats Response - Actual execution statistics for EXPLAIN ANALYZE responses.
- Aggregation
Response - Response from
VelesQLaggregation query execution. - ApiDoc
- Public entry point for the full OpenAPI document. Merges in the
prometheus-gated/metricspath when that feature is enabled. - AppState
- Application state shared across handlers.
- Batch
Search Request - Request for batch vector search.
- Batch
Search Response - Response from batch search.
- Collection
Config Response - Response with detailed collection configuration.
- Collection
Diagnostics Response - Response with a collection’s health diagnostics.
- Collection
Response - Response with collection information.
- Collection
Stats Response - Response with collection statistics from ANALYZE.
- Column
Stats Response - Per-column statistics in a collection stats response.
- Create
Collection Request - Request to create a new collection.
- Create
Index Request - Request to create a property index.
- Degree
Response - Response for node degree query.
- Edge
Count Response - Response for edge count query.
- Enable
Streaming Request - Request body for the enable-streaming endpoint.
- Error
Response - Error response.
- Explain
Cost - Estimated cost metrics for the query.
- Explain
Features - Features detected in the query.
- Explain
Request - Request for query EXPLAIN.
- Explain
Response - Response from query EXPLAIN.
- Explain
Step - A step in the query execution plan.
- Fusion
Request - Fusion configuration for hybrid dense+sparse search.
- Graph
Search Request - Request for graph embedding search.
- Graph
Search Response - Response for graph embedding search.
- Guard
Rails Config Request - Request to configure query guard-rails.
- Guard
Rails Config Response - Response with current guard-rails configuration.
- Hybrid
Search Request - Request for hybrid search (vector + text).
- IdScore
Result - A single ID+score result from IDs-only search.
- Index
Response - Response with index information.
- Index
Stats Response - Per-index statistics in a collection stats response.
- List
Indexes Response - Response listing all indexes.
- Multi
Query Search Request - Request for multi-query vector search with fusion.
- Node
Edge Query Params - Query parameters for node-scoped edge queries.
- Node
List Response - Response containing all node IDs in the graph.
- Node
Payload Response - Response for a node payload retrieval.
- Node
Stats Response - Per-plan-node estimated execution statistics for EXPLAIN ANALYZE responses.
- Parallel
Traverse Request - Request for parallel multi-source BFS traversal.
- Point
Request - A point in an upsert request.
- Query
Error Detail VelesQLquery error detail.- Query
Error Response VelesQLquery error response.- Query
Request - Request for
VelesQLquery execution. - Query
Response - Response from
VelesQLquery execution. - Query
Response Meta - Metadata section for
VelesQLquery responses. - Scroll
Point - A single point in a scroll response.
- Scroll
Request - Request body for the scroll endpoint.
- Scroll
Response - Response from the scroll endpoint.
- Search
IdsResponse - Response from IDs-only search (no payload hydration).
- Search
Request - Request for vector search (dense, sparse, or hybrid).
- Search
Response - Response from vector search.
- Search
Result Response - A single search result.
- Stream
Done Event - SSE event: Traversal completed.
- Stream
Insert Request - Request body for the streaming insert endpoint (single point).
- Stream
Node Event - SSE event: A node reached during traversal.
- Stream
Stats Event - SSE event: Periodic statistics update.
- Stream
Traverse Params - Query parameters for streaming graph traversal.
- Text
Search Request - Request for BM25 text search.
- Traversal
Result Item - A single traversal result item.
- Traversal
Stats - Statistics from traversal operation.
- Traverse
Request - Request for graph traversal.
- Traverse
Response - Response from graph traversal.
- Unified
Query Response - Unified response from /query endpoint.
- Upsert
Node Payload Request - Request to upsert a node payload.
- Upsert
Points Request - Request to upsert points.
- Velesql
Error Detail - Standardized
VelesQLsemantic/runtime error detail. - Velesql
Error Response - Standardized
VelesQLsemantic/runtime error response.
Enums§
- Query
Type - Query type for unified /query endpoint.
- Sparse
Vector Input - Input format for sparse vectors, supporting two JSON representations:
Constants§
- MAX_
SPARSE_ NNZ - Maximum non-zero entries (NNZ) allowed in a single sparse vector.
- VELESQL_
CONTRACT_ VERSION - Canonical
VelesQLcontract version for REST responses.
Functions§
- add_
edge - Add an edge to a collection’s graph.
- add_
edges_ batch - Add multiple edges to a collection’s graph in one batched operation.
- aggregate
- Execute an aggregation-only VelesQL query.
- analyze_
collection - Analyze a collection, computing and persisting statistics.
- batch_
search - Batch search for multiple vectors.
- bulk_
delete_ points - Deletes multiple points by ID in a single request.
- collection_
diagnostics - Get health diagnostics for a collection (index readiness, point count).
- collection_
sanity - Run a quick sanity check for onboarding and troubleshooting.
- compact_
collection - Compacts the vector storage of a collection, rewriting active vectors into a contiguous layout and reclaiming disk space from deleted entries.
- create_
collection - Create a new collection.
- create_
index - Create a property index on a graph collection.
- default_
avg_ weight - Default average weight for weighted fusion.
- default_
collection_ type - Default collection type: vector.
- default_
dense_ weight - Default dense weight for relative score fusion.
- default_
fusion_ strategy - Default fusion strategy: RRF.
- default_
hit_ weight - Default hit weight for weighted fusion.
- default_
index_ type - Default index type: hash.
- default_
max_ weight - Default max weight for weighted fusion.
- default_
metric - Default distance metric: cosine.
- default_
rrf_ k - Default RRF k parameter.
- default_
sparse_ weight - Default sparse weight for relative score fusion.
- default_
storage_ mode - Default storage mode: full (no quantization).
- default_
top_ k - Default number of results to return.
- default_
vector_ weight - Default vector weight for hybrid search.
- delete_
collection - Delete a collection.
- delete_
index - Delete a property index.
- delete_
point - Delete a point by ID.
- enable_
streaming - Enable streaming ingestion on a collection.
- explain
- Explain a VelesQL query, optionally executing it with instrumentation.
- flush_
collection - Flush pending changes to disk.
- get_
collection - Get collection information.
- get_
collection_ config - Get detailed collection configuration (HNSW params, storage mode, schema, etc.).
- get_
collection_ stats - Get cached collection statistics (returns 404 if never analyzed).
- get_
edge_ count - Get the total number of edges in the graph.
- get_
edges - Get edges from a collection’s graph filtered by label.
- get_
guardrails - Get current guard-rails configuration.
- get_
node_ degree - Get the degree (in and out) of a specific node.
- get_
node_ edges - Get edges for a specific node with direction filtering.
- get_
node_ payload - Get the payload of a graph node.
- get_
point - Get a point by ID.
- get_
point_ relations - List outgoing relation edges for a point.
- graph_
search - Search graph nodes by embedding similarity.
- health_
check - Liveness probe — always returns 200 OK.
- health_
metrics - Simple health metrics for lightweight monitoring.
- hybrid_
search - Hybrid search combining vector similarity and BM25 text search.
- is_
empty - Check if a collection is empty.
- list_
collections - List all collections.
- list_
indexes - List all indexes on a collection.
- list_
nodes - List all node IDs in the graph.
- match_
query - Execute a MATCH query on a collection.
- mode_
to_ search_ quality - Convert search mode string to
crate::SearchQuality. - multi_
query_ search - Multi-query search with fusion strategies.
- multi_
query_ search_ ids - Multi-query fusion search returning only ids and scores (no payloads).
- prometheus_
metrics - Prometheus text format metrics response.
- query
- Execute a VelesQL query.
- readiness_
check - Readiness probe — returns 200 when the database is fully loaded, 503 otherwise.
- rebuild_
index - Rebuilds the HNSW index of a vector collection, reclaiming memory occupied by tombstoned entries and producing a fresh graph from the current vector storage.
- relate_
points - Create a relation edge between two points in a collection.
- remove_
edge - Remove an edge by ID.
- reorder_
for_ locality - Reorders the HNSW adjacency lists and vector storage for cache locality so nodes traversed together during search sit close in memory (issue #377). No-op for collections with fewer than 1 000 vectors. Recall is preserved — only the physical layout changes.
- scroll_
points - Scroll through collection points with cursor-based pagination.
- search
- Search for similar vectors.
- search_
ids - Lightweight search returning only IDs and scores (no payload hydration).
- set_
point_ ttl - Set (or refresh) the durable TTL of a point.
- stream_
insert - Stream-insert a single point via the bounded ingestion channel.
- stream_
traverse - Stream graph traversal results via SSE.
- stream_
upsert_ points - Stream upsert points using NDJSON.
- text_
search - Search using BM25 full-text search.
- traverse_
graph - Traverse the graph using BFS or DFS from a source node.
- traverse_
parallel - Parallel multi-source BFS traversal.
- unrelate_
points - Remove a relation edge by ID.
- update_
guardrails - Update guard-rails configuration (partial update).
- upsert_
node_ payload - Upsert a payload on a graph node.
- upsert_
points - Upsert points to a collection.
- upsert_
points_ raw - Bulk upsert points via the binary wire format.
- vacuum_
collection - Vacuums the HNSW index of a vector collection, removing tombstoned entries and rebuilding the graph from current vectors.