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

tbdb

v0.0.15

Published

<p align="center"> <img src="docs-src/logo/tbdb-logo.png" alt="TableDB Logo" height="128" /> </p>

Readme

TableDB

A very simple NoSQL database abstraction layer that provides MongoDB-like CRUD APIs, supporting multiple backends including SQLite, MongoDB and IndexedDB.


这个世界上复杂的数据库和 ORM 已经够多了,而我们只想简单地存个东西。

一个非常简单却实用的 NoSQL 数据库抽象层,提供类似 MongoDB 的增删改查 API,支持多种存储后端(SQLite, MongoDB, IndexedDB)。

  • 完全兼容 JavaScript 数据类型
    直接存入 Date, Map, RegExp, ArrayBuffer,Unint8Array, Blob, File 等 JavaScript 类型,取出后数据类型不变,不用额外考虑数据库类型问题。

  • 类似 MongoDB 的 NoSQL API
    增删改查的接口遵照 MongoDB 设计,例如 findOne(), updateMany(),易于上手,可以平滑的从 MongoDB 迁移。

  • 切换不同数据库后端
    提供 SQLite, MongoDB 等多种数据库适配器,可以方便的切换不同的数据库存储后端。 并且可以在不同数据库间迁移数据,让你可以从 SQLite 开始,当规模变大时迁移到 MongoDB。

  • 集成实用方法
    内置 “分页”、“游标分页”、“批量遍历”等实用功能。

  • 可选功能

    • autoMetadata 自动元数据(创建时间,修改时间)
    • markDelete 标记删除
    • tree 目录树存储

安装

$ npm add -D tbdb fzz

fzz 是 TableDB 使用的数据类型定义库 dto 的依赖,可选安装,如果你不需要通过定义 Schema 获得更好的 TypeScript 类型提示,可以不安装。

快速开始

import { defineTable, SQLiteAdapter } from "tbdb"

// 1. 定义 Table,并得到 useTable 函数
let useMemberTable = defineTable({
    name: "Member",
    adapter: SQLiteAdapter({ filename: "./member.sqlite" }),
})

// 2.使用 useTable 创建 Table 实例
let memberTable = await useMemberTable()

// 3.使用 Table 实例进行数据操作
await memberTable.insertMany([
    {
        id: "member1",
        name: "Alice",
        age: 30,
    },
])

let members = await memberTable.findMany({ age: { $gt: 20 } })

项目目录结构

  • 接口定义:./core/types.ts, ./adapter/adapter.ts
  • 核心实现:./core/Table.ts
  • 适配器实现:./adapter/