Data Storage
Understanding where your data lives at each point in VecLabs’ architecture helps you reason about durability, latency, and privacy guarantees.The three-layer storage architecture
VecLabs stores your data across three distinct layers, each optimized for a different purpose:Layer 1: In-memory HNSW index
When you call.upsert(), vectors are immediately inserted into the in-memory HNSW index. This is where all queries run - not against Shadow Drive, not against Solana.
Properties:
- Sub-5ms query latency - memory is fast
- Rebuilt from Shadow Drive on cold start (when persistence ships)
- During alpha: currently in-memory only, resets on server restart
Layer 2: Shadow Drive
Shadow Drive is Solana’s decentralized storage protocol. It stores arbitrary files across a network of storage nodes, similar to how IPFS works but with Solana-based payments and economic incentives. Properties:- Decentralized - data stored across multiple nodes, no single point of failure
- Content-addressed - files are addressed by their SHA-256 hash
- Permanent - uploaded data persists as long as storage is paid for
- Cheap - approximately $0.05/GB/year
- Your data: encrypted with AES-256-GCM before upload - nodes see only ciphertext
| Vectors | Dimensions | Approximate monthly cost |
|---|---|---|
| 100K | 1536 | ~$0.30 |
| 1M | 1536 | ~$3.00 |
| 10M | 1536 | ~$30.00 |
Shadow Drive persistence shipped in Phase 5. Vectors are encrypted
client-side and uploaded automatically after every write. Use
restoreFromShadowDrive() to rebuild the index on cold start.
Layer 3: Solana
After every.upsert() operation, VecLabs posts a 32-byte Merkle root to the Solana Anchor program. This is the trust layer.
Properties:
- One transaction per upsert batch - not per individual vector
- Cost: $0.00025 per transaction (fixed by Solana’s fee model)
- Finality: ~400ms
- Permanent and immutable - Solana state cannot be altered after finalization
- Public - anyone can view the on-chain state at the program address
- The SHA-256 Merkle root of all vector IDs in the collection
- Timestamp of the write
- Your wallet public key (the collection owner)
- Vector values
- Metadata
- Encryption keys
Write flow: what happens when you call upsert()
Read flow: what happens when you call query()
Cold start behavior
When the VecLabs server restarts (during alpha: on every restart), it needs to rebuild the HNSW index from Shadow Drive. Cold start sequence:- Server starts
- Index is empty
- VecLabs fetches encrypted vector files from Shadow Drive
- Vectors are decrypted in-memory using the wallet key
- HNSW index is rebuilt
- Server ready to serve queries