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

@hawiah/sqlite

v0.3.5

Published

SQLite driver for Hawiah - lightweight and fast data persistence with better-sqlite3

Downloads

22

Readme

@hawiah/sqlite NPM version

SQLite driver for Hawiah - lightweight and fast data persistence with better-sqlite3.

Now supports Hybrid Storage: Use it as a pure key-value NoSQL store OR define a Schema for high-performance SQL columns mixed with flexible JSON storage.

Installation

npm install @hawiah/sqlite

Usage

1. Default Mode (NoSQL / Schema-less)

By default, the driver behaves like a NoSQL document store. All data is stored in a single JSON blob column. This offers maximum flexibility.

import { SQLiteDriver } from '@hawiah/sqlite';

const driver = new SQLiteDriver('./mydb.sqlite', 'users');
await driver.connect();

// Store arbitrary data
await driver.set({ name: 'Ali', age: 25, role: 'admin' });

2. Hybrid Mode (Schema / Real SQL)

New in v0.2.x: You can provide a schema using setSchema(schema). The driver will create Real SQL Columns for the schema fields (improving query performance and storage efficiency) while keeping a specialized _extras JSON column for any extra dynamic fields.

This gives you the "Best of Both Worlds":

  • Structure & Speed for known fields (SQL).
  • Flexibility for unknown/runtime fields (NoSQL).
import { SQLiteDriver } from '@hawiah/sqlite';

const driver = new SQLiteDriver('./mydb.sqlite', 'products');

// Define Schema (Optional)
// Hawiah types are mapped to SQLite types (e.g., STRING -> TEXT, NUMBER -> REAL)
driver.setSchema({
    title: { type: 'STRING' },
    price: { type: 'NUMBER' },
    inStock: { type: 'BOOLEAN' }
});

await driver.connect();

// Inserting data:
// 'title', 'price', 'inStock' go into real SQL columns.
// 'tags', 'meta' go into the '_extras' JSON column automatically.
await driver.set({ 
    title: 'Gaming Mouse', 
    price: 150, 
    inStock: true,
    tags: ['wireless', 'rgb'], // stored in _extras
    meta: { supplier: 'X' }    // stored in _extras
});

// Reading data:
// The driver automatically merges SQL columns and _extras back into a single object.
const product = await driver.getOne({ title: 'Gaming Mouse' });
console.log(product.tags); // ['wireless', 'rgb']

Features

  • Fast & Reliable: Built on better-sqlite3 (synchronous API for max speed).
  • Hybrid Storage: Choose between Schema-less (JSON blob) or Hybrid (SQL + JSON).
  • Adaptive: Automatically maps Schema types to SQLite (TEXT, INTEGER, REAL, BLOB).
  • Transactions: Full support for beginTransaction, commit, rollback.
  • Automatic Indexing: Default indexes on _createdAt and _updatedAt.
  • Developer Friendly: Simple IDriver interface from Hawiah Core.

License

MIT