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

@yydb/light-db

v0.0.0

Published

LightDB Storage Engine - A high-performance TypeScript database storage layer

Readme

LightDB Storage Engine 🚀

A high-performance TypeScript database storage layer with WAL (Write-Ahead Logging), indexes, and transaction support.

Features ✨

  • High Performance: Optimized for speed with batch writing and columnar storage
  • Transaction Support: ACID-compliant operations
  • Indexing: B+ tree indexes for fast querying
  • Write-Ahead Logging: Ensures data durability
  • Recovery: Automatic recovery from crashes
  • Memory-Mapped Files: Efficient I/O operations
  • TypeScript Ready: Full TypeScript support with type definitions

Installation 📦

pnpm add @yydb/light-db

Quick Start 🚀

import { LightDB } from '@yydb/light-db';

// Initialize the database
const db = await LightDB.open('./mydb');

// Create a collection
const users = db.collection('users');

// Insert a document
await users.insert({ id: 1, name: 'John Doe', email: '[email protected]' });

// Find a document
const user = await users.findOne({ id: 1 });
console.log(user); // { id: 1, name: 'John Doe', email: '[email protected]' }

// Update a document
await users.update({ id: 1 }, { $set: { name: 'John Smith' } });

// Delete a document
await users.delete({ id: 1 });

// Close the database
await db.close();

API Reference 📚

LightDB Class

open(path: string): Promise<LightDB>

Opens an existing database or creates a new one at the specified path.

collection(name: string): Collection

Returns a collection with the given name. Creates it if it doesn't exist.

transaction(): Promise<Transaction>

Starts a new transaction.

close(): Promise<void>

Closes the database connection.

Collection Class

insert(document: Document): Promise<void>

Inserts a new document into the collection.

find(query: Query): Promise<Document[]>

Finds all documents matching the query.

findOne(query: Query): Promise<Document | null>

Finds the first document matching the query.

update(query: Query, update: Update): Promise<number>

Updates documents matching the query and returns the number of updated documents.

delete(query: Query): Promise<number>

Deletes documents matching the query and returns the number of deleted documents.

createIndex(field: string): Promise<void>

Creates an index on the specified field for faster queries.

Transaction Class

commit(): Promise<void>

Commits the transaction.

rollback(): Promise<void>

Rolls back the transaction.

Performance Features ⚡

Batch Writing

LightDB uses batch writing to optimize disk I/O operations, significantly improving write performance for bulk operations.

Columnar Storage

For certain data types, LightDB uses columnar storage to reduce disk space and improve query performance.

Memory-Mapped Files

LightDB uses memory-mapped files for efficient I/O operations, reducing the overhead of traditional file I/O.

Architecture 🏗️

LightDB consists of several key components:

  1. Storage Engine: Manages the physical storage of data
  2. WAL (Write-Ahead Log): Ensures data durability and supports recovery
  3. Index Manager: Manages B+ tree indexes for fast querying
  4. Collection Layer: Provides a document-oriented API
  5. Transaction Manager: Handles ACID-compliant transactions

Recovery 🔄

LightDB automatically recovers from crashes using the WAL. When the database is opened after a crash, it replays the WAL to restore the database to a consistent state.

Contributing 🤝

Contributions are welcome! Please feel free to submit a Pull Request.

License 📄

LightDB is licensed under the MPL-2.0 License. See the LICENSE file for details.