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

@firefuse/react

v0.0.7

Published

Firefuse react library

Readme


Installation

Add Firefuse to your project

npm install @firefuse/react

Usage in the application

Set the firebase auth configuration

import { getAuth } from 'firebase/auth';
import { initializeApp } from 'firebase/app';

/**
 * Depends on your project setup, you may want to use firebase config directly
 * or like here via environment variables.
 * Here we assume you are using Vite and have firebase config in .env file.
 */
export const firebaseConfig = {
  apiKey: import.meta.env.FIREBASE_API_KEY,
  authDomain: import.meta.env.FIREBASE_AUTH_DOMAIN,
  projectId: import.meta.env.FIREBASE_PROJECT_ID,
  storageBucket: import.meta.env.FIREBASE_STORAGE_BUCKET,
  messagingSenderId: import.meta.env.FIREBASE_MESSAGING_SENDER_ID,
  appId: import.meta.env.FIREBASE_APP_ID,
  measurementId: import.meta.env.FIREBASE_MEASUREMENT_ID,
};

const firebaseApp = initializeApp(firebaseConfig)

const firebaseAuth = getAuth(firebaseApp);
// here init firestore, analytics etc.

export { firebaseAuth };

Use the FirefuseProvider

import React from 'react';
import { FirefuseProvider } from '@firefuse/react';
import { firebaseAuth } from '../config/firebase';

const App = () => {
  return (
    <FirefuseProvider
      domain="my-app.firefuse.io"
      redirectUrl={window.location.origin}
      firebaseAuth={firebaseAuth}
    >
      <h1>Firefuse</h1>
    </FirefuseProvider>
  );
};

Check if user is authenticated

import React from 'react';
import { useAuth } from '@firefuse/react';

const Home = () => {
  const { isAuthenticated, user, loginWithRedirect, logout } = useAuth();

  return (
    <div>
      {isAuthenticated ? (
        <div>
          <h1>Welcome {user.displayName}</h1>
          <button onClick={() => logout()}>Logout</button>
        </div>
      ) : (
        <div>
          <h1>Welcome Guest</h1>
          <button onClick={() => loginWithRedirect({ redirectUrl: window.location.origin })}>Login</button>
        </div>
      )}
    </div>
  );
};

Protecting routes

Create a ProtectedRoutes component

import {useAuth} from "@firefuse/react";
import {Outlet} from "react-router";
import {useEffect} from "react";

export const ProtectedRoutes = () => {
  const { isAuthenticated, getAuthUrl } = useAuth();

  useEffect(() => {
    if (!isAuthenticated) {
      window.location.href = getAuthUrl({ redirectUrl: window.location.href });
    }
  }, [isAuthenticated, getAuthUrl]);

  if (!isAuthenticated) {
    return null;
  }

  return <Outlet/>;
}

Use the ProtectedRoutes component

import './App.css'
import {Route, Routes} from "react-router";
import Home from "./pages/Home.tsx";
import Dashboard from "./pages/Dashboard.tsx";
import {ProtectedRoutes} from "./components/ProtectedRoutes.tsx";

function App() {
  return (
    <Routes>
      <Route path="/" element={<Home />} />
      <Route element={<ProtectedRoutes/>}>
        <Route path="/dashboard" element={<Dashboard />} />
      </Route>
    </Routes>
  )
}

export default App;

Debugging

To get more details in the dev console you can also provide additional param debug.

<FirefuseProvider
  {...otherParams}
  debug={true}
>
  <h1>Firefuse</h1>
</FirefuseProvider>

Contributing

We are open to any contributions. Just fork the project, make your changes and open a pull request.

Credits

This project is developed and maintained by Firefuse team.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.