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

@codefire/firebase-react

v1.0.1

Published

Plug-and-play Firebase utilities for Firestore and Storage in React/frontend projects

Downloads

155

Readme

@codefire/firebase-react

Plug-and-play Firebase utilities for Firestore and Storage in React and other frontend projects.

Installation

npm install @codefire/firebase-react firebase

firebase is a peer dependency; your project controls the version.

Setup

Initialize Firebase once (e.g. in your app entry or root layout):

import { initFirebase } from "@codefire/firebase-react";

initFirebase({
  apiKey: "your-api-key",
  authDomain: "your-project.firebaseapp.com",
  projectId: "your-project-id",
  storageBucket: "your-project.appspot.com",
  messagingSenderId: "...",
  appId: "...",
});

Firestore

Import from the main package or the firestore subpath:

import {
  addDocument,
  getDocument,
  setDocument,
  updateDocument,
  deleteDocument,
  queryCollection,
  getDb,
  serverTimestamp,
  where,
  orderBy,
  limit,
} from "@codefire/firebase-react/firestore";

API

| Function | Description | |----------|-------------| | getDb() | Returns the Firestore instance (call after initFirebase). | | addDocument(collectionName, data) | Creates a document with auto-generated ID. Adds createdAt. Returns document ID. | | setDocument(collectionName, docId, data) | Creates or overwrites a document with the given ID. Sets updatedAt. | | updateDocument(collectionName, docId, data) | Updates existing document fields. Sets updatedAt. | | deleteDocument(collectionName, docId) | Deletes a document. | | getDocument(collectionName, docId) | Fetches a document by ID. Returns null if not found. Result includes id. | | queryCollection(collectionName, constraints?) | Fetches documents with optional where, orderBy, limit. Results include id. |

Helpers serverTimestamp, where, orderBy, limit are re-exported from Firebase for building queries.

Example

const id = await addDocument("waitlist", { email: "[email protected]", city: "Santiago" });

const items = await queryCollection("services", [
  where("active", "==", true),
  orderBy("order", "asc"),
  limit(10),
]);

Storage

import { uploadFile, deleteFile, getFileUrl } from "@codefire/firebase-react/storage";

API

| Function | Description | |----------|-------------| | uploadFile(file, options?) | Uploads a file. Options: folder, fileName, onProgress(percent). Returns { url, path }. | | deleteFile(path) | Deletes a file by path. | | getFileUrl(path) | Returns the public download URL for a path. |

Example

const { url, path } = await uploadFile(file, {
  folder: "profiles",
  onProgress: (p) => console.log(`${p}%`),
});

Subpath imports

To avoid pulling in unused code:

  • @codefire/firebase-react — core + firestore + storage
  • @codefire/firebase-react/firestore — Firestore only
  • @codefire/firebase-react/storage — Storage only

You still need to call initFirebase() from the main package once before using Firestore or Storage.

License

MIT