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

@ha-bits/bit-database-sql

v1.0.1

Published

SQL database storage bit using Drizzle ORM with SQLite support - replaces @ha-bits/bit-database with SQL persistence

Readme

@ha-bits/bit-database-sql

SQL database storage bit using Drizzle ORM with SQLite support.

This bit replaces @ha-bits/bit-database with SQL persistence, providing a type-safe and efficient way to store data using SQLite.

Features

  • SQLite storage - Persistent local database using better-sqlite3
  • Drizzle ORM - Type-safe SQL operations
  • Key-Value store - Simple store/get/delete operations
  • Document store - Insert/update/query documents with auto-generated IDs
  • TTL support - Automatic expiration of stored values
  • Raw SQL - Execute custom SQL queries when needed
  • Browser/Tauri ready - Stubs for window.__TAURI__.sql

Environment Support

| Environment | Backend | |------------|---------| | Node.js | better-sqlite3 | | Browser/Tauri | window.TAURI.sql (via stubs) |

Actions

Key-Value Operations

| Action | Description | |--------|-------------| | store | Store a value with a key | | get | Retrieve a value by key | | delete | Delete a value by key | | list | List all keys in a collection | | increment | Atomically increment a numeric value |

Document Operations

| Action | Description | |--------|-------------| | insert | Insert a document with auto-generated ID | | update | Update a document matching a filter | | query | Query documents with simple filters |

Raw SQL Operations

| Action | Description | |--------|-------------| | rawQuery | Execute a SELECT query | | rawExecute | Execute INSERT/UPDATE/DELETE statements |

Usage Example

# Insert a user document
- id: insert-user
  type: bits
  data:
    module: "@ha-bits/bit-database-sql"
    operation: insert
    params:
      collection: "users"
      document:
        name: "John Doe"
        email: "[email protected]"
        status: "pending"

# Update the user
- id: update-user
  type: bits
  data:
    module: "@ha-bits/bit-database-sql"
    operation: update
    params:
      collection: "users"
      filter:
        _id: "{{insert-user.id}}"
      update:
        status: "active"

# Query users
- id: find-users
  type: bits
  data:
    module: "@ha-bits/bit-database-sql"
    operation: query
    params:
      collection: "users"
      filter:
        status: "active"
      limit: 10

Database Location

  • Node.js: /tmp/habits-sql/{database}.db
  • Browser: In-memory (or Tauri SQL plugin)

Related Bits

  • @ha-bits/bit-database - In-memory storage (parent bit)
  • @ha-bits/bit-pouch - PouchDB/IndexedDB storage