npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

veddb-client

v0.2.1

Published

Official JavaScript/TypeScript client for VedDB v0.2.0 - MongoDB-like API with verified wire protocol

Readme

vedDB Client v0.2.0

Modern JavaScript/TypeScript client for VedDB v0.2.0 with Mongoose-like API

npm version License: MIT Node.js Version

🚀 Features

  • Mongoose-like API - Familiar Schema and Model pattern
  • TypeScript Support - Full type definitions included
  • Query Builder - Fluent, chainable queries
  • Connection Pooling - Automatic connection management
  • Validation - Schema-based validation
  • Hooks - Pre/post middleware support
  • Modern ES Modules - Clean import/export syntax

📦 Installation

npm install veddb
# or
yarn add veddb
# or
pnpm add veddb

🏃 Quick Start

Basic Usage

import veddb, { Schema, model } from 'veddb';

// Connect to VedDB server
await veddb.connect('localhost', 50051);

// Define a schema
const userSchema = new Schema({
  name: { type: String, required: true },
  email: { type: String, required: true, unique: true },
  age: { type: Number, min: 0, max: 120 },
  createdAt: { type: Date, default: Date.now }
});

// Create a model
const User = model('User', userSchema);

// Create a document
const user = await User.create({
  name: 'Alice',
  email: '[email protected]',
  age: 30
});

// Find documents
const users = await User.find({ age: { $gt: 25 } });

// Update
await User.updateOne({ name: 'Alice' }, { age: 31 });

// Delete
await User.deleteOne({ name: 'Alice' });

TypeScript Usage

import veddb, { Schema, model, Document } from 'veddb';

interface IUser extends Document {
  name: string;
  email: string;
  age: number;
  createdAt: Date;
}

const userSchema = new Schema<IUser>({
  name: { type: String, required: true },
  email: { type: String, required: true },
  age: { type: Number },
  createdAt: { type: Date, default: Date.now }
});

const User = model<IUser>('User', userSchema);

const user: IUser = await User.findOne({ email: '[email protected]' });

🔧 API Reference

Connection

// Connect with options
await veddb.connect('localhost', 50051, {
  poolSize: 10,
  auth: {
    username: 'admin',
    password: 'password'
  },
  tls: {
    enabled: true
  }
});

// Connection events
veddb.connection.on('connected', () => console.log('Connected!'));
veddb.connection.on('error', (err) => console.error(err));

// Disconnect
await veddb.disconnect();

Schema Definition

const schema = new Schema({
  // Basic types
  name: String,
  age: Number,
  active: Boolean,
  birthday: Date,
  
  // With options
  email: {
    type: String,
    required: true,
    unique: true,
    lowercase: true,
    trim: true
  },
  
  // Nested objects
  address: {
    street: String,
    city: String,
    zip: String
  },
  
  // Arrays
  tags: [String],
  friends: [{ type: Schema.Types.ObjectId, ref: 'User' }],
  
  // Default values
  createdAt: { type: Date, default: Date.now },
  
  // Custom validators
  password: {
    type: String,
    validate: {
      validator: (v) => v.length >= 8,
      message: 'Password must be at least 8 characters'
    }
  }
});

// Add methods
schema.method('getFullName', function() {
  return `${this.firstName} ${this.lastName}`;
});

// Add statics
schema.static('findByEmail', function(email) {
  return this.findOne({ email });
});

// Add hooks
schema.pre('save', function(next) {
  this.updatedAt = new Date();
  next();
});

schema.post('save', function(doc) {
  console.log('Document saved:', doc._id);
});

Model Operations

// Create
const user = new User({ name: 'Bob', age: 25 });
await user.save();

// OR
await User.create({ name: 'Charlie', age: 35 });
await User.insertMany([{ name: 'Dave' }, { name: 'Eve' }]);

// Read
const all = await User.find();
const filtered = await User.find({ age: { $gte: 30 } });
const one = await User.findOne({ name: 'Alice' });
const byId = await User.findById('507f1f77bcf86cd799439011');

// Update
await User.updateOne({ name: 'Bob' }, { age: 26 });
await User.updateMany({ age: { $lt: 30 } }, { status: 'young' });
await User.findByIdAndUpdate(id, { age: 27 }, { new: true });

// Delete
await User.deleteOne({ name: 'Bob' });
await User.deleteMany({ age: { $lt: 18 } });
await User.findByIdAndDelete(id);

// Count
const count = await User.countDocuments({ age: { $gt: 30 } });
const exists = await User.exists({ name: 'Alice' });

Query Builder

// Chainable queries
const users = await User
  .find({ status: 'active' })
  .where('age').gt(25).lt(50)
  .where('city').equals('NYC')
  .sort({ age: -1, name: 1 })
  .limit(10)
  .skip(5)
  .select('name email age')
  .exec();

// Query operators
query.where('age').gt(25);        // Greater than
query.where('age').gte(25);       // Greater than or equal
query.where('age').lt(50);        // Less than
query.where('age').lte(50);       // Less than or equal
query.where('name').equals('Alice');
query.where('status').in(['active', 'pending']);
query.where('city').ne('NYC');    // Not equal
query.where('tags').all(['javascript', 'nodejs']);
query.where('name').regex(/^A/);

// Sorting
query.sort({ age: -1 });          // Descending
query.sort('name');                // Ascending
query.sort('-age name');           // Multiple fields

// Pagination
query.limit(20);
query.skip(40);

// Field selection
query.select('name email');        // Include
query.select('-password -secret'); // Exclude

Aggregation

const results = await User.aggregate([
  { $match: { age: { $gt: 25 } } },
  { $group: {
    _id: '$city',
    avgAge: { $avg: '$age' },
    count: { $sum: 1 }
  }},
  { $sort: { count: -1 } },
  { $limit: 10 }
]);

🐳 Docker Support

VedDB Server is available as a Docker image:

docker pull mihirrabariii/veddb:latest
docker run -d -p 50051:50051 mihirrabariii/veddb:latest

Then connect from your app:

await veddb.connect('localhost', 50051);

📖 Examples

See the examples directory for more:

🔗 Related

  • VedDB Server: https://github.com/Mihir-Rabari/ved-db-server
  • Docker Hub: https://hub.docker.com/r/mihirrabariii/veddb
  • Rust Client: https://github.com/Mihir-Rabari/ved-db-rust-client

📄 License

MIT © Mihir Rabari

🤝 Contributing

Contributions are welcome! Please open an issue or PR.

📧 Contact