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

v1.1.1

Published

One API. Multiple Databases. Zero Complexity. Schema-less database abstraction with smart relationships and DataLoader optimization. Works with Node.js, Bun, and Deno.

Downloads

41

Readme


Modular database abstraction with virtual relationships. Support for 7 drivers, 50+ methods, and DataLoader batching. One API to rule them all.

✨ Features

  • Universal API - Same code works with any database
  • Multiple Drivers - JSON, YAML, SQLite, MongoDB, Firebase, PostgreSQL, MySQL
  • Runtime Agnostic - Works with Node.js, Bun, and Deno
  • Virtual Relationships - Define relations between any collections, even across different databases!
  • Hybrid Schema - Blends SQL tables with NoSQL flexibility (Real columns + JSON)
  • DataLoader Optimization - Automatic query batching and caching eliminates N+1 problems
  • Extensible - Create custom drivers for any data source
  • Schema-less / Schema-full - You choose: Strict validation or total freedom
  • TypeScript Ready - Full type definitions included

📦 Installation

# Core package (required)
npm install hawiah
# or
bun add hawiah
# or
deno install npm:hawiah

# Choose one or more drivers
npm install @hawiah/local      # JSON & YAML
npm install @hawiah/sqlite     # SQLite
npm install @hawiah/mongo      # MongoDB
npm install @hawiah/firebase   # Firebase Firestore
npm install @hawiah/postgres   # PostgreSQL
npm install @hawiah/mysql      # MySQL

Works with:

  • ✅ Node.js
  • ✅ Bun
  • ✅ Deno

🚀 Quick Start

import { Hawiah } from 'hawiah';
import { MongoDriver } from '@hawiah/mongo';

const db = new Hawiah({
  driver: new MongoDriver({
    uri: 'mongodb://localhost:27017',
    databaseName: 'myapp',
    collectionName: 'users'
  })
});

await db.connect();
await db.insert({ id: 1, name: 'John', age: 25 });
const users = await db.get({});
await db.disconnect();

Switch to SQLite or Firebase? Just change the driver. Your code stays the same.

🧬 The Hybrid Schema System

Hawiah v1.1 introduces a game-changing Hybrid Schema capabilities.

Virtual vs. Real Schemas

How Hawiah handles your schema depends on the driver:

| Feature | SQL Drivers (Postgres, SQLite, MySQL) | NoSQL Drivers (Mongo, Firebase, Local) | | :--- | :--- | :--- | | Logic | Real Schema (Physical columns) | Virtual Schema (Validator) | | Storage | Columns for defined fields + JSON for extras. | Full JSON Document. | | Benefit | Native SQL performance & indexing. | Maximum flexibility & speed. |

Schema Definition

import { Schema, DataTypes } from '@hawiah/core';

const userSchema = new Schema({
  // Basic Types
  username: { type: DataTypes.STRING, required: true },
  age:      { type: DataTypes.INTEGER, min: 18 },
  
  // Advanced Types
  email:    { type: DataTypes.EMAIL, unique: true },
  tags:     { type: DataTypes.ARRAY },
  
  // Default Values
  isActive: { type: DataTypes.BOOLEAN, default: true },
  created:  { type: DataTypes.DATE, default: () => new Date() }
});

🔗 Virtual Relationships - The Game Changer

Define relationships between collections without foreign keys or schema changes. Works across different databases!

import { Hawiah } from 'hawiah';
import { MongoDriver } from '@hawiah/mongo';
import { SQLiteDriver } from '@hawiah/sqlite';

// Users in MongoDB
const users = new Hawiah({
  driver: new MongoDriver({
    uri: 'mongodb://localhost:27017',
    databaseName: 'myapp',
    collectionName: 'users'
  })
});

// Posts in SQLite
const posts = new Hawiah({
  driver: new SQLiteDriver('./blog.db', 'posts')
});

// Define virtual relationship - MongoDB ↔ SQLite!
users.relation('posts', posts, '_id', 'userId', 'many');
posts.relation('author', users, 'userId', '_id', 'one');

await users.connect();
await posts.connect();

// Query with relationships - automatically optimized!
const usersWithPosts = await users.getWith({}, 'posts');
// Each user includes their posts from SQLite - no N+1 queries!

const postsWithAuthors = await posts.getWith({}, 'author');
// Each post includes author from MongoDB - fully batched!

Why Virtual Relationships are Powerful:

Cross-Database Relations - Connect MongoDB users with SQLite posts, or any combination
Zero N+1 Problems - DataLoader automatically batches and caches all queries
🚀 No Schema Changes - No foreign keys, no migrations, just pure flexibility
🎯 Type-Safe - Full TypeScript support with proper typing
🔄 Nested Relations - Load relations of relations infinitely
💪 Production Ready - Battle-tested optimization used by GraphQL servers worldwide

🗄️ Available Drivers

| Driver | Package | Use Case | |--------|---------|----------| | JSON | @hawiah/local | Development, Testing | | YAML | @hawiah/local | Configuration | | SQLite | @hawiah/sqlite | Desktop/Mobile Apps | | MongoDB | @hawiah/mongo | Web/Cloud Apps | | Firebase | @hawiah/firebase | Real-time Apps | | PostgreSQL | @hawiah/postgres | Enterprise Apps | | MySQL | @hawiah/mysql | Web Apps | | Custom | - | Any Data Source |

📚 API Overview

Basic Operations: insert, insertMany, get, getOne, getById, update, updateById, remove, removeById, clear

Virtual Relationships:

  • relation(name, targetCollection, localKey, foreignKey, type) - Define virtual relation
  • getWith(query, relations) - Load data with relations (auto-optimized with DataLoader)

Advanced: sort, paginate, select, count, sum, group, unique

Arrays: push, pull, shift, unshift, pop

Fields: increment, decrement, unset, rename

📖 Documentation

For detailed documentation, driver examples, relationships guide, and custom driver tutorials:

📚 Full Documentation

🔗 Links

📦 GitHub Repositories

Core & Documentation

Database Drivers

📄 License

MIT © Shuruhatik