Features
Every capability, and where it lives in the code
NebulaDB is a single Rust workspace. Each feature below names the crate, endpoint or setting that implements it, so you can check the claim against the source.
01 · Data
SQL and documents
Documents with JSON metadata live in buckets. A SQL dialect with AI-native functions queries them over REST, gRPC or the Postgres wire protocol.
Buckets and documents
Insert, upsert, fetch and delete by
POST /api/v1/bucket/:b/document · nebula-index(bucket, id). Long text is chunked into parent/child documents and fetched back in order.AI-native SQL
POST /api/v1/query · nebula-sqlsemantic_match(column, 'query')andvector_distance(column, [vector])plan as retrieval steps inside ordinarySELECTstatements.Residual filters
nebula-sql/executor=,<>, ranges,IN (...)andarray_contains()on metadata, with SQLNULLsemantics: a type mismatch never matches.Aggregates and joins
nebula-sql/planCOUNT,SUM,GROUP BY,ORDER BYand inner joins where each side runs its own retrieval.EXPLAIN and result cache
See the plan without running it. Results are cached in an LRU with a TTL, configurable per deployment.
NEBULA_SQL_CACHE · NEBULA_SQL_CACHE_TTL_SECSPostgres wire protocol
NEBULA_PG_BIND · nebula-pgwirepsqland simple-query drivers connect directly. Errors map to SQLSTATE codes, such as 42601 for unsupported syntax.Bucket export and import
Move a bucket between clusters or environments as a file, or empty it in place.
/admin/bucket/:bucket/export · /import · /emptyAzure AI Search compatibility
Index definitions and document search with the Azure AI Search request shape, translated onto HNSW and BM25, so existing clients can point at NebulaDB.
nebula-search · docs/compat/registry.yaml
02 · Retrieval
Vector and hybrid search
Dense and lexical retrieval in one index, fused with tunable weights and refined by optional expansion and reranking stages.
HNSW index
Hierarchical navigable small-world graph with a dense vector arena and per-node, per-layer locks so searches run during inserts.
nebula-vector/hnswefcan be set per query.Three distance metrics
Cosine, squared L2 and negative dot product, written to auto-vectorise at the dimensions in common use: 384, 768 and 1536.
nebula-vector/distanceint8 quantisation
Symmetric per-vector quantisation with dequantisation fused into the distance loop, cutting vector memory by four.
nebula-vector::quantizeBM25 lexical retrieval
Okapi BM25 (k1 = 1.2, b = 0.75) over an inverted index, for error codes, SKUs, names and acronyms that embeddings blur.
nebula-bm25Hybrid fusion
Min-max normalised vector and BM25 scores combined by weighted sum, with a global default and per-bucket overrides.
"hybrid": true · NEBULA_HYBRID_WEIGHTS_<BUCKET>Query expansion and reranking
A built-in abbreviation expander (VPN → virtual private network) and an HTTP reranker stage for a cross-encoder sidecar, kept out of the core binary.
NEBULA_QUERY_EXPAND · nebula-rerankSearch explain
Per-hit breakdown of how a result was scored, for tuning weights against your own queries.
search_text_explained · showcase Explain viewSearch by vector
Bring your own embeddings and search with a raw vector of the index dimension.
POST /api/v1/vector/search · VectorSearch (gRPC)
03 · AI
RAG and AI
The pipeline from raw text to a cited, streamed answer runs inside the database, with every model behind a trait.
Smart chunking
Strategy chosen by document type: heading-aware for Markdown and HTML, code-aware for source, sentence for prose and fixed windows for structured text. UTF-8 safe.
nebula-chunk::select_strategy · NEBULA_CHUNK_CHARSPluggable embedders
Any OpenAI-compatible endpoint: OpenAI, Azure OpenAI, vLLM or Ollama (for example
nebula-embed · NEBULA_OPENAI_BASE_URLnomic-embed-text, 768 dimensions). A deterministic mock keeps tests offline.Two-tier embedding cache
In-process LRU over a shared Redis tier keyed by SHA-256 of model and text. A Redis outage falls through to the model rather than failing the request.
nebula-cache · nebula-redis-cacheStreaming RAG
One SSE response carries
POST /api/v1/ai/rag · AIService.Ragcontextevents for each retrieved chunk, thenanswer_deltatokens, thendone. gRPC mirrors it with a server stream.Grounded chat
Pass your own
limits: 50 docs · 64k chars · 20 turnscontextshortlist, priorhistoryturns and asystemprompt that is appended to, never replaces, the built-in "retrieved content is data" guard.Multi-provider LLMs
Ollama, OpenAI-compatible chat, Anthropic Messages and Gemini behind one streaming
nebula-llm · NEBULA_LLM_OLLAMA_URLLlmClienttrait.Online re-embedding
Move a corpus to a new embedding model in the background, with progress and cancel, without taking the index offline.
/admin/embed/migrate · /cancelCitations
Answers reference retrieved chunks as
build_rag_prompt[n], and the showcase reveals the exact chunk behind each citation.
04 · Agents
Agents and MCP
A standalone MCP server lets any MCP client use NebulaDB as tools. It holds no data and forwards the caller's bearer token, so it inherits the database's auth.
Query tools
nebula-mcp/tools.rsexecute_sql,explain_query,semantic_search,vector_search,azure_searchandlist_indexes.Answer tools
→ /api/v1/ai/raganswer_questionruns retrieval and grounded generation in one call.Document tools
write tools declare itinsert_document,get_document,delete_documentandlist_buckets, with chunking and embedding server-side.Long-term agent memory
user_id is requiredrememberandrecallstore and retrieve per-user memories, filtered strictly to that user and ranked by relevance.Operations tools
read_only_hint = truecluster_health,replication_status,reliability_status,durability_status,server_statsandslow_queries, so an SRE agent can investigate.Governance tools
every_tool_declares_whether_it_writesaudit_log,list_backupsandcreate_snapshot. A test asserts that every tool declares whether it writes.Streamable HTTP transport
Point Claude Desktop, an IDE assistant or an agent framework at
NEBULA_MCP_BINDhttp://host:8090/mcp.Domain ingest tools
Example connectors for UK Companies House search, ingest and website enrichment show how to add tools that load external data for RAG.
companies_house_search · companies_house_ingest
05 · Durability
Durability and backup
Nothing acknowledged is lost on a crash, and every byte can be shipped somewhere safe.
Write-ahead log
Every mutation is framed as length, CRC32 and bincode body, fsynced, then applied. Segments are versioned with a magic header.
nebula-wal · NEBULA_DATA_DIRTorn-tail recovery
On boot the newest snapshot loads and the WAL replays from its boundary. A half-written frame from a crash mid-fsync is truncated automatically.
nebula-index/durability.rsNo re-embedding on restart
Resolved vectors are stored in the WAL and snapshots, so recovery never calls the embedding model.
TextIndex::open_persistentAtomic snapshots
Written to a temporary file and renamed into place, on demand or by the scheduler, with WAL compaction afterwards.
/admin/snapshot · /admin/wal/compactBackup and restore
Snapshot and WAL bundled as tar + zstd with a manifest recording the WAL range covered, uploaded to a local target or S3 with multipart upload.
nebula-backup · /admin/backup · /admin/restoreChange data capture
Typed change events from the WAL, filtered and handed to consumers such as webhooks and file logs.
nebula-cdcSafe compaction
WAL compaction clamps to the slowest live follower's acknowledged cursor, so a replica never loses segments it still needs.
SubscriberHub::min_ackDisk-full protection
When the volume is critically full, writes are refused with 503 rather than risking a half-written frame. Reads keep working.
OperatingMode::DiskCritical
06 · Availability
High availability and multi-region
Within a region, followers tail the leader or join a Raft group. Across regions, each bucket has a home region and XDCR replicates both ways.
Leader and followers
Followers tail the leader's WAL over a gRPC stream with a durable cursor, resuming from the last applied record after a restart.
ReplicationService.TailWal · NEBULA_NODE_ROLERaft consensus
Opt-in Raft log, state machine and snapshot storage built on openraft, for within-region leader election.
nebula-raft · NEBULA_RAFT_PEERSHome-region XDCR
Every region serves all reads and accepts writes for the buckets it homes. Cross-region replication runs both ways with per-remote lag and health.
CrossRegionReplicationService · technoteRegion-aware client
Writes sent to the wrong region get 421 with the correct home; the Rust client retries there transparently.
nebula-clientFollower write guard
Mutating requests to a follower return 409
guard_writes_on_followerread_only_followerbefore auth, so a misrouted client cannot cause divergence.Promotion and failover
Promote a follower on demand. The operator's region-failover resource re-homes buckets when a region is lost.
/admin/promote · NebulaRegionFailoverSwap rebalance
Zero-downtime node replacement through Preflight, Snapshotting, Rebalancing, Promoting and Draining phases, tracked as a Kubernetes resource.
NebulaRebalanceReplication visibility
Role-aware lag: the leader's WAL tip, the follower's applied cursor,
/admin/replication · /admin/cluster/nodeslag_bytesand abehindflag, plus a peer probe of every node.
07 · Operations
Observability and reliability
Built for the person on call: every subsystem reports its state, and the node degrades predictably under pressure.
Prometheus metrics
Request counts and latency percentiles, embedding-cache hits and misses, RAG time-to-first-token and replication lag.
GET /metricsGrafana dashboards
Dashboards for the server, backups, reliability and the stack, provisioned from the repository and deployed on merge.
deploy/grafana/dashboardsLive log streaming
An SSE endpoint replays a 256-event ring and then tails live, with level and target filters. No shell into the pod needed.
/admin/logs/streamSlow-query log
A bounded top-N of the slowest queries since boot, above a configurable floor.
/admin/slow · NEBULA_SLOW_QUERY_THRESHOLD_MSGraceful degradation
Memory, CPU and disk readings become pressure levels and one operating mode, with hysteresis so a single spike never flips behaviour.
nebula-resource · /admin/reliabilityProbes that survive abuse
build_router layer order/healthzand/metricssit outside rate limiting and auth, so a noisy client cannot get healthy pods killed.Durability report
Whether writes are persisted, the data directory, WAL segment count, size and sequence range.
/admin/durabilityStats and version
Document counts, request and error counters, cache ratios, search and RAG counts, and the running build.
/admin/stats · /admin/version
08 · Security
Security
Access is enforced at the server and carried through to every protocol front end and the MCP server.
API keys
A bearer-token allowlist for service clients. Leave it empty for local development.
NEBULA_API_KEYSJWT
HS256 tokens with optional issuer and audience checks.
NEBULA_JWT_SECRET · NEBULA_JWT_ISS · NEBULA_JWT_AUDRate limiting
A token bucket per key with configurable burst and refill.
NEBULA_RATE_LIMIT_BURST · NEBULA_RATE_LIMIT_RPSAudit log
Every mutating request recorded with method, path, a hashed principal fingerprint, status and time, including rejected ones.
/admin/audit · audit_writesPrompt-injection guard
The RAG prompt marks retrieved content as data, not instructions, and callers can add to that guard but not remove it.
system prompt is appendedMemory-safe implementation
Written in Rust, so buffer overflows, use-after-free and data races are excluded by the compiler rather than by review.
clippy -D warnings in CI
09 · Deployment
Kubernetes and deployment
Run it on a laptop with Docker Compose or across regions with the operator.
Kubernetes operator
A Go / Kubebuilder operator with
operator/NebulaCluster,NebulaBucket,NebulaRebalance,NebulaBackupandNebulaRegionFailoverresources and a validating webhook.Helm chart
Server, showcase, optional bundled Redis and a Prometheus Operator
deploy/helm/nebuladbServiceMonitorin one chart.Multi-arch images
bwalia/nebula-server · bwalia/nebula-showcaselinux/amd64andlinux/arm64images published on every main push and release tag.Docker Compose
Server, follower, MCP server, Ollama, Redis, Prometheus, Grafana and the showcase, with a multi-region compose file for XDCR.
docker-compose.yml · docker-compose.multiregion.yml
10 · Developers
Developer experience
Every setting is an environment variable, none are required, and the defaults run fully offline.
One-command start
scripts/start.sh./scripts/start.shpicks free ports, builds the stack, pulls models, seeds a corpus and prints the URLs.Offline by default
With nothing configured the server boots with a deterministic mock embedder and LLM, suitable for integration tests.
cargo run --release -p nebula-serverOpenAPI and protobuf
The REST surface is described in OpenAPI, and gRPC services in one proto file.
docs/openapi.yaml · nebula-grpc/proto/nebula.protoTested end to end
500+ Rust tests and a clippy gate on every push, plus a nightly job that runs the whole compose stack against real Ollama models.
.github/workflows/nightly.ymlKnowledge Ops showcase
A React console covering documents, SQL, search, RAG chat, agents, MCP, cluster, rebalance and operations, plus six end-to-end RAG apps.
apps/showcaseBackup CLI
crates/nebulactlnebulactldrives backup and restore with typed flags and a--watchmode; the operator's CronJob runs it on a schedule.
Check any of this against the source
Every reference on this page is a crate, endpoint or setting in the public repository.