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

fire2sql

v0.1.8

Published

Use Firebase with a basic SQL-like promise-based syntax.

Readme

Fire2SQL

Use Firebase with a basic SQL-like promise-based syntax.

Installation

fire2sql is available on npm as firebase-admin:

$ npm install --save fire2sql

To use the module in your application, require it from any JavaScript file:

var Fire2SQL = require("fire2sql");

If you are using ES2015, you can import the module instead:

import Fire2SQL from "fire2sql";

peerDependencies

(npm 3 behavior assumed)

You will need at least one of the following packages to use fire2sql, according to your project structure.

Realtime Database:

Cloud Firestore:

  • none

Examples

Include firebase

// example using ES2015 syntax
import * as firebase from 'firebase';
import * as Fire2SQL from 'fire2sql';

or firebase-admin

// example using CommonJS syntax
const admin = require('firebase-admin');
const Fire2SQL = require('fire2sql');

then, if you properly initialized Firebase, you can pass the "firebase" (or "admin") variable to the constructor, plus the locale (default is "en") that will be used in case of client-side sorting (through localeCompare).

new Fire2SQL(firebase, "es")
.select("*").from("users")
.where("age", ">=", 18)
.orderBy("displayName") // --> "orderByChild" will be used
.limit(10, 1)
.json()
.then(console.log).catch(console.error);

new Fire2SQL(admin)
.select("*").from("news/politics")
.where("date", "between", "2017-09-01", "2017-09-31");
.orderBy("date", "DESC") // --> "orderByChild" will be used
.json()
.then(console.log).catch(console.error);

new Fire2SQL(admin)
.select("*")
.from("categories")
.orderBy(null, "DESC") // --> "orderByValue" will be used
.json()
.then(console.log).catch(console.error);

Formats

.json()

Returns the promise of a json object

{k0: v0, k1: v1, ...}

.entries()

Returns the promise of an array of key/value pairs (similar to Object.entries())

[[k0, v0], [k1, v1], ...]

.object()

Returns the promise of an object with "keys" and "values" attrubutes (similar to Object.keys() plus Object.values())

{keys: [k0, k1, ...], values: [v0, v1, ...]}

.map()

Returns the promise of a Map object

{k0 => v0, k1 => v1, ...}

.ref()

Returns the promise of an array of Firebase references

[Reference0, Reference1, ...]

.query()

Returns the promise of a pure Firebase query (some option could be not applied)

Query

Limitations

Due to Firebase

  • sometime superfluous data could be downloaded
  • you can perform just only one "when"
  • "when" available operators are: "==", ">=", "<=", "between" (inclusive)
  • "orderBy" and "limit" could be computed client-side
  • no advanced SQL functions support, i.e. aliaes, join, count, distinct, date_format, views, functions, ...

Due to fire2sql

  • select always return all columns ("*" is used in examples just for readability)
  • from accepts only one path
  • no advanced Firebase functions support, i.e. transaction, users, priority, ...