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

node-fireuser

v0.0.1

Published

A user-management system for firestore & realtime database

Readme

node-fireuser

This is a library for easy user management with Firebase Realtime Database and Firestore.

Installation and Initialization

Install the library easily with npm.

npm install node-fireuser 

You'll also need the Firebase-admin SDK for this library. Just install it aswell with npm.

npm install firebase-admin

After you installed both, you have to include them and do the first commands. If you don't know how to initialize the Firebase Admin SDK look here

With Webpack

import * as fireuser from ('node-fireuser')
import * as admin from ('firebase-admin')
import * as serviceWorker from ('path/to/your/json/file');

/* Initialize Firebase Admin
   It's necassary to do this BEFORE you init the Fireuser library
*/
admin.initializeApp({
    credential: admin.credential.cert(serviceWorker),
    databaseURL: "https://[YOUR PROJECT].firebaseio.com/"
});

/* Init Fireuser
   Use the firebase-admin variable as argument! In this case it's admin
*/
if(fireuser.init(admin)){
    console.log("Everything fine");
    ...
}else{
    console.log("An error appeared");
}

Without Webpack

const fireuser = require('node-fireuser')
const admin = require('firebase-admin')
const serviceWorker = require('path/to/your/json/file');
...
}

Realtime Database Commands

createUser(authID, options)

You'll need this command every time, you want to create a new user in the database. It uses the parameter authID and options . For authID you should use the Firebase Authentication ID of the user. options is an object where you can enter every data the user should have in the database.

// Basic syntax
fireuser.database.createUser(authID, options)

// Example
const authID = req.body.authID;
const rqUsername = req.body.username;
const rqEmail = req.body.email;
const rqFullname = req.body.fullname;

fireuser.database.createUser(authID, {
    username: rqUsername,
    email: rqEmail,
    fullname: rqFullname
});

getUserById(authID)

If you want to retrieve the data of a special user, you can use this function. As parameter, it takes the authID of the user. The function is a promise which returns an object.

fireuser.database.getUserById(authID).then(res => {
    let username = res.username;
    let email = res.email;
    console.log("The username is: " + username);
    console.log("The email address is: " + email);
});

getUserById([authID1, authID2])

coming soon...

changeUserData(authID,options)

Use this command to change data of an existing user. Parameters are the Firebase AuthID and the options object.

fireuser.database.changeUserData(authID, {
    username: newUsername,
    email: newEmail,
    newElement: newElement
});

watchUserChanges(authID,throwbackFunction)

If you want to watch changes of the user data live and interact with it, use this function. You need the Firebase AuthID and a throwback function.

fireuser.database.watchUserChanges(authID, newData => f(newData));

// gets fired every time the user data changes
function tb(newData){
    console.log(newData.username);
}

removeUser(authID)

Removes a user from the database

if(fireuser.database.removeUser(authID)){
    // user removed
}

getUserNumber()

Returns (a promise of) the total amount of users in the databse

fireuser.database.getUserNumber().then(number => console.log(number.toString()));

Firestore Commands

... under construction