API Reference@crux/core
Storage Interfaces
DataStore, VectorStore, BlobStore, storage(), and in-memory storage implementations.
import {
inMemoryBlobStore,
inMemoryDataStore,
inMemoryStorage,
inMemoryVectorStore,
storage,
} from '@crux/core/storage'
import type {
BlobStore,
DataStore,
Storage,
VectorStore,
} from '@crux/core/storage'Overview
Crux storage is split into explicit capabilities:
| Interface | Purpose |
|---|---|
DataStore | JSON records with get, set, delete, list, optional TTL, and optional subscriptions |
VectorStore | Dense, sparse, and hybrid vector search |
BlobStore | Binary and oversized payload storage |
Storage | A bundle: { data, vectors?, blobs? } |
Use the guide for the conceptual model: Storage.
storage(config)
Normalize a capability bundle:
const appStorage = storage({
data,
vectors,
blobs,
})Primitives can consume the whole bundle or the specific capability they need:
workspace({ id: 'files', namespace, storage: appStorage })
retriever({ id: 'docs', data, vectors, dense })DataStore
interface DataStore {
get(key: string): Promise<JsonObject | null>
set(key: string, value: JsonObject, options?: { ttl?: number }): Promise<void>
delete(key: string): Promise<void>
list(prefix: string, options?: ListOptions): Promise<ListResult>
subscribe?(callback: (event: StoreEvent) => void): () => void
supportsTtl?(): boolean
}VectorStore
interface VectorStore {
upsert(records: readonly VectorRecord[]): Promise<void>
delete(keys: readonly string[]): Promise<void>
search(query: VectorSearchQuery): Promise<readonly VectorHit[]>
capabilities?(): VectorStoreCapabilities
}BlobStore
interface BlobStore {
put(input: BlobPutInput): Promise<BlobRef>
get(uri: string): Promise<BlobReadResult>
delete?(uri: string): Promise<void>
}In-Memory Implementations
Use these for tests, demos, and examples:
const data = inMemoryDataStore()
const vectors = inMemoryVectorStore()
const blobs = inMemoryBlobStore()
const all = inMemoryStorage()In-memory stores are process-local and not durable.