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

yolodb

v1.2.0

Published

A lightweight, file-based JSON database powered by SuperJSON for Node.js (and compatible) runtimes. Perfect for prototyping, testing, and when you just need a simple persistent store without the overhead of a full database system.

Readme

YoloDB 🚀

A lightweight, file-based JSON database powered by SuperJSON for Node.js (and compatible) runtimes. Perfect for prototyping, testing, and when you just need a simple persistent store without the overhead of a full database system.

Because setting up databases for local development is complex and You Only Live Once!

Highlights ✨

  • 🔄 Real-time file synchronization - No stale data in multi-threaded/process environments (such as Next.js server)
  • 🎯 SuperJSON powered - Support for Dates, Maps, Sets, and more complex data types
  • 🛠️ Developer friendly API - Familiar CRUD operations with a simple, intuitive interface
  • 📦 Zero configuration - Just instantiate and start using
  • 🔍 Type-safe - Built with TypeScript for robust development
  • 🧪 Perfect for testing - Mock your production database with ease
  • 🔍 Debuggable - Easily debug your data by checking the table files

What's different compared to LowDB?

  • Uses superjson for serialization/deserialization, so it supports more data types like Dates, Maps, Sets, etc.
  • More intuitive interface, easier to use, closer to what would you expect from a real DB abstraction layer.
  • Read/write operations are done on-the-fly. Less performant, but you don't need to worry about stale data.
  • Comes with handy object-oriented abstractions such as YoloDbRepository

Quick Start

Install the package:

npm install -D yolodb

Example:

import { yolodb } from 'yolodb'

// Create a table with a primary key
const usersTable = yolodb<User>('full/path/to/users.json', 'id', [])

// Insert a record
usersTable.insert({
  id: '1',
  name: 'John Doe',
  createdAt: new Date(),
})

// Find by ID
const user = usersTable.findById('1')

// Search with custom filter
const activeUsers = usersTable.search((user) => user.status === 'active')

Why YoloDB? 🤔

Use Cases

  • 🧪 Testing and Development

    • Mock your production database (best way is via abstractions such as repository classes)
    • Quick prototyping without database setup
    • Isolated test environments
  • 🎮 Small Applications

    • Simple data persistence needs
    • Prototypes and MVPs
    • Local development tools
  • 📚 Learning Best Practices

    • A proof that you data model is well decoupled from the persistence layer, is that it can be mocked with ease
    • Having living proof that your data model is well designed and you can switch between different persistence engines with ease

Advantages

  • Quick data access: Compared to SQL-based engines, you can easily check the data by opening the JSON files.
  • Simple but Powerful: Basic CRUD operations with a simple and familiar API
  • No Configuration: Works out of the box
  • Type Safety: Full TypeScript support
  • Complex Data Types: Thanks to SuperJSON
  • Real-time File Access: Always fresh data
  • Repository Pattern Support: Clean architecture friendly

Limitations

  • Not for Production: Designed for development and testing
  • Performance costs: Reads table files on every operation, and writes to disk on every write operation
  • Concurrency: Basic file-based locking
  • Scale: Not suitable for large datasets, since data is loaded into memory
  • Sorting, Joins and more complex queries: Not implemented yet.
  • Data migrations: Not implemented, and not planned.

API Reference

Table Operations

const table = yolodb<Record>(filePath, primaryKeyField, initialData)

// Basic CRUD
table.all() // Get all records
table.findById(id) // Find by primary key
table.findBy(field, value) // Find by field value
table.search(filterFn) // Custom search
table.insert(record) // Insert single record
table.insertMany(records) // Bulk insert
table.update(record) // Update record
table.updateMany(records) // Bulk update
table.delete(id) // Delete by id
table.deleteMany(ids) // Bulk delete
table.truncate() // Clear all records

Repository Pattern

interface UserRepository {
  findByUsername(username: string): User | null
}

class MockedUserRepository extends YoloDbRepository<User> implements UserRepository {
  constructor() {
    super("users.json", "id");
  }

  // Implement interface methods here
}
// Your real repository would look like this:
class DrizzleUserRepository implements UserRepository { ... }

Best Practices 🌟

  1. Use Type Definitions

    interface User {
      id: string
      name: string
      createdAt: Date
    }
    
    const usersTable = yolodb<User>('users.json', 'id', [])
  2. Implement Repository Pattern

    • Encapsulate database logic
    • Add domain-specific methods
    • Maintain clean architecture
  3. Handle Errors

    try {
      table.insert(record)
    } catch (error) {
      // Handle file system errors
    }
  4. Clean Up Data

    // e.g. in your tests teardown
    table.truncate()

Made with ❤️ for developers who know that sometimes, you just need a simple solution.