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

@mifistix-cloud/database

v2.0.5

Published

Realtime Database SDK for Mifistix Cloud - Store and sync data in realtime

Downloads

450

Readme

@mifistix-cloud/database

Realtime Database SDK for Mifistix Cloud - Store and sync data in realtime.

License

This module is licensed for internal use within Mifistix only. See LICENSE for details.

Installation

npm install @mifistix-cloud/database

Quick Start

const { initializeApp } = require('@mifistix-cloud/app');
const { getDatabase, ref, set, get, push, update, remove } = require('@mifistix-cloud/database');

// Initialize app
const app = initializeApp({
  apiKey: 'your-api-key',
  projectId: 'your-project-id'
});

// Get database instance
const db = getDatabase(app);

// Write data
await set(ref(db, 'users/user1'), {
  name: 'John Doe',
  email: '[email protected]'
});

// Read data
const snapshot = await get(ref(db, 'users/user1'));
console.log(snapshot.val());

// Push with auto ID
const result = await push(ref(db, 'users'), { name: 'Jane' });
console.log('New key:', result.key);

// Update partial data
await update(ref(db, 'users/user1'), { email: '[email protected]' });

// Delete data
await remove(ref(db, 'users/user1'));

API Reference

getDatabase(app)

Get database instance.

Parameters:

  • app (Object, required): Initialized app instance

Returns: Database service instance

ref(db, path?)

Create a database reference.

Parameters:

  • db (Object): Database instance
  • path (string, optional): Database path (validated for path traversal)

Returns: Database reference

Example:

const userRef = ref(db, 'users/user1');

set(dbRef, data)

Write or overwrite data at path.

Parameters:

  • dbRef (Object): Database reference
  • data (any): Data to write

Example:

await set(ref(db, 'users/user1'), { name: 'John' });

push(dbRef, data)

Push data with auto-generated ID.

Parameters:

  • dbRef (Object): Database reference
  • data (any): Data to push

Returns: Object with key, path, and ref

Example:

const result = await push(ref(db, 'messages'), { text: 'Hello' });
console.log('New key:', result.key);

get(dbRef)

Read data from database.

Parameters:

  • dbRef (Object): Database reference

Returns: Snapshot with exists() and val() methods

Example:

const snapshot = await get(ref(db, 'users/user1'));
if (snapshot.exists()) {
  console.log(snapshot.val());
}

update(dbRef, partial)

Update specific fields without overwriting entire object.

Parameters:

  • dbRef (Object): Database reference
  • partial (Object): Partial data to update

Example:

await update(ref(db, 'users/user1'), { email: '[email protected]' });

remove(dbRef)

Delete data at path.

Parameters:

  • dbRef (Object): Database reference

Example:

await remove(ref(db, 'users/user1'));

smartPush(dbRef, storage, file, docData)

Upload file to storage and create database record.

Parameters:

  • dbRef (Object): Database reference
  • storage (Object): Storage instance
  • file (File/Blob): File to upload
  • docData (Object): Additional document data

Returns: Promise with database record

Example:

const storage = getStorage(app);
const result = await smartPush(
  ref(db, 'documents'),
  storage,
  fileObject,
  { title: 'My Document', category: 'docs' }
);

Security Features

  • Path Traversal Protection: Validates paths to prevent ../ attacks
  • Data Validation: Validates required parameters
  • Project Isolation: Uses project ID in all requests
  • Error Handling: Throws appropriate error types

Data Snapshot

The get() method returns a snapshot object:

const snapshot = await get(ref(db, 'path'));
snapshot.exists();   // boolean - whether data exists
snapshot.val();      // any - the data value
snapshot.key();      // string - the key of the snapshot

Architecture

database/
├── src/
│   ├── core/
│   │   └── DatabaseClient.js    # Main database client
│   ├── services/
│   │   └── DatabaseService.js   # CRUD operations
│   ├── utils/
│   │   └── helpers.js          # Helper functions
│   ├── types/
│   │   └── index.js            # Type definitions
│   └── config/
│       └── constants.js        # Configuration constants
└── index.js

License

MIT