
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
TypeScript/JavaScript client for d-vecDB - High-performance vector database with persistent metadata, WAL corruption protection and GPU acceleration
A high-performance TypeScript/JavaScript client for d-vecDB, a blazingly fast vector database written in Rust with WAL corruption protection and GPU acceleration.
Benchmarked on DigitalOcean 2 vCPU, 2GB RAM
| Batch Size | d-vecDB | Qdrant | Status |
|---|---|---|---|
| Single (1) | 315 vec/s | 275 vec/s | ✅ 15% FASTER |
| Small (10) | 1,293 vec/s | 1,628 vec/s | 1.26x slower |
| Medium (100) | 2,027 vec/s | 3,720 vec/s | 1.84x slower |
| Large (500) | 2,262 vec/s | 4,244 vec/s | 1.88x slower |
Key Achievement: d-vecDB beats Qdrant on single insert throughput! 🏆
✅ WAL Corruption Protection
✅ Hardware Acceleration
npm install d-vecdb
Or with yarn:
yarn add d-vecdb
import { VectorDBClient, DistanceMetric } from 'd-vecdb';
// Create client
const client = new VectorDBClient({
host: 'localhost',
port: 8080,
});
// Create a collection
await client.createCollectionSimple('my-collection', 128, DistanceMetric.COSINE);
// Insert vectors
await client.insertSimple('my-collection', 'vec-1', [0.1, 0.2, ...], { label: 'example' });
// Search for similar vectors
const results = await client.searchSimple('my-collection', [0.1, 0.2, ...], 10);
console.log(results);
// Clean up
client.close();
Before using this client, you need to have the d-vecDB server running:
# Install the server (if not already installed)
cargo install d-vecdb-server
# Start the server
d-vecdb-server --host 0.0.0.0 --port 8080
Or use Docker:
docker run -p 8080:8080 d-vecdb/server
import { VectorDBClient, DistanceMetric, VectorType } from 'd-vecdb';
const client = new VectorDBClient();
// Simple method
await client.createCollectionSimple('embeddings', 768, DistanceMetric.COSINE);
// Advanced method with custom configuration
await client.createCollection({
name: 'embeddings',
dimension: 768,
distanceMetric: DistanceMetric.COSINE,
vectorType: VectorType.FLOAT32,
indexConfig: {
maxConnections: 32,
efConstruction: 400,
efSearch: 100,
maxLayer: 16,
},
});
// Insert a single vector
await client.insertSimple('embeddings', 'doc-1', vector, { title: 'Document 1' });
// Batch insert
const vectorsData: Array<[string, number[], Record<string, string>]> = [
['doc-1', vector1, { title: 'Document 1' }],
['doc-2', vector2, { title: 'Document 2' }],
['doc-3', vector3, { title: 'Document 3' }],
];
await client.batchInsertSimple('embeddings', vectorsData, 100);
// Simple search
const results = await client.searchSimple('embeddings', queryVector, 10);
results.forEach(result => {
console.log(`ID: ${result.id}, Distance: ${result.distance}`);
console.log(`Metadata: ${JSON.stringify(result.metadata)}`);
});
// Advanced search with filtering and custom HNSW parameters
const results = await client.searchSimple(
'embeddings',
queryVector,
10,
200, // efSearch - higher = more accurate, slower
{ category: 'technology' } // metadata filter
);
// Get a vector
const vector = await client.getVector('embeddings', 'doc-1');
// Update a vector
await client.updateVector('embeddings', {
id: 'doc-1',
data: newVector,
metadata: { title: 'Updated Document' },
});
// Delete a vector
await client.deleteVector('embeddings', 'doc-1');
// List all collections
const collections = await client.listCollections();
console.log(collections.collections);
// Get collection info
const info = await client.getCollection('embeddings');
console.log(info.collection);
// Get collection statistics
const stats = await client.getCollectionStats('embeddings');
console.log(`Vectors: ${stats.vectorCount}, Memory: ${stats.memoryUsage} bytes`);
// Delete a collection
await client.deleteCollection('embeddings');
// Check server health
const isAlive = await client.ping();
console.log(`Server is ${isAlive ? 'reachable' : 'unreachable'}`);
// Get server statistics
const stats = await client.getServerStats();
console.log(`Total vectors: ${stats.totalVectors}`);
console.log(`Total collections: ${stats.totalCollections}`);
console.log(`Uptime: ${stats.uptimeSeconds} seconds`);
new VectorDBClient(config?: ClientConfig)
ClientConfig:
host?: string - Server host (default: 'localhost')port?: number - Server port (default: 8080)timeout?: number - Request timeout in ms (default: 30000)protocol?: 'rest' | 'grpc' - Protocol to use (default: 'rest')secure?: boolean - Use HTTPS (default: false)apiKey?: string - API key for authenticationcreateCollection(config: CollectionConfig): Promise<CollectionResponse>createCollectionSimple(name: string, dimension: number, distanceMetric?: DistanceMetric): Promise<CollectionResponse>listCollections(): Promise<ListCollectionsResponse>getCollection(name: string): Promise<CollectionResponse>getCollectionStats(name: string): Promise<CollectionStats>deleteCollection(name: string): Promise<CollectionResponse>insertVector(collectionName: string, vector: Vector): Promise<InsertResponse>insertSimple(collectionName: string, vectorId: string, vectorData: VectorData, metadata?: VectorMetadata): Promise<InsertResponse>insertVectors(collectionName: string, vectors: Vector[]): Promise<InsertResponse>batchInsertSimple(collectionName: string, vectorsData: Array<[string, VectorData, VectorMetadata?]>, batchSize?: number): Promise<InsertResponse[]>getVector(collectionName: string, vectorId: string): Promise<Vector>updateVector(collectionName: string, vector: Vector): Promise<InsertResponse>deleteVector(collectionName: string, vectorId: string): Promise<InsertResponse>search(request: SearchRequest): Promise<SearchResponse>searchSimple(collectionName: string, queryVector: VectorData, limit?: number, efSearch?: number, filter?: VectorMetadata): Promise<QueryResult[]>getServerStats(): Promise<ServerStats>healthCheck(): Promise<HealthResponse>ping(): Promise<boolean>getInfo(): Record<string, unknown>close(): voidenum DistanceMetric {
COSINE = 'Cosine',
EUCLIDEAN = 'Euclidean',
DOT_PRODUCT = 'DotProduct',
MANHATTAN = 'Manhattan',
}
enum VectorType {
FLOAT32 = 'Float32',
FLOAT16 = 'Float16',
INT8 = 'Int8',
}
The client provides comprehensive custom exceptions:
import {
VectorDBError,
ConnectionError,
TimeoutError,
CollectionNotFoundError,
VectorNotFoundError,
InvalidParameterError,
} from 'd-vecdb';
try {
await client.getCollection('non-existent');
} catch (error) {
if (error instanceof CollectionNotFoundError) {
console.error('Collection not found:', error.message);
} else if (error instanceof ConnectionError) {
console.error('Cannot connect to server:', error.message);
} else {
console.error('Unexpected error:', error);
}
}
Available exceptions:
VectorDBError - Base exceptionConnectionError - Connection issuesTimeoutError - Request timeoutAuthenticationError - Authentication failureAuthorizationError - Permission deniedCollectionNotFoundError - Collection doesn't existCollectionExistsError - Collection already existsVectorNotFoundError - Vector not foundInvalidParameterError - Invalid parametersValidationError - Validation failureServerError - Server-side errorRateLimitError - Rate limit exceededQuotaExceededError - Quota exceededProtocolError - Protocol error// Use Float32Array for better performance
const vector = new Float32Array(768);
for (let i = 0; i < 768; i++) {
vector[i] = Math.random();
}
await client.insertSimple('embeddings', 'vec-1', vector);
// Parallel searches
const queries = [vector1, vector2, vector3, vector4];
const results = await Promise.all(
queries.map(query => client.searchSimple('embeddings', query, 10))
);
// Parallel batch inserts
const batches = chunkArray(allVectors, 1000);
await Promise.all(
batches.map(batch => client.batchInsertSimple('embeddings', batch))
);
HNSW (Hierarchical Navigable Small World) parameters affect search performance:
await client.createCollection({
name: 'embeddings',
dimension: 768,
distanceMetric: DistanceMetric.COSINE,
indexConfig: {
maxConnections: 32, // Increase for better recall
efConstruction: 400, // Increase for better quality
efSearch: 100, // Override per search if needed
},
});
batchInsertSimple for bulk insertsCheck out the examples directory for more:
# Clone the repository
git clone https://github.com/yourusername/d-vecDB.git
cd d-vecDB/typescript-client
# Install dependencies
npm install
# Build
npm run build
# Run tests
npm test
# Run linter
npm run lint
Contributions are welcome! Please feel free to submit a Pull Request.
git checkout -b feature/amazing-feature)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)This project is licensed under the MIT License - see the LICENSE file for details.
If you encounter any issues or have questions:
FAQs
TypeScript/JavaScript client for d-vecDB - High-performance vector database with persistent metadata, WAL corruption protection and GPU acceleration
The npm package d-vecdb receives a total of 2 weekly downloads. As such, d-vecdb popularity was classified as not popular.
We found that d-vecdb demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.