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 🙏

© 2025 – Pkg Stats / Ryan Hefner

nuxt-firebase-auth

v0.2.0

Published

Nuxt Firebase Auth Module

Readme

Nuxt Firebase Auth

publish to npm

Nuxt 3 module for Google Firebase authentication.

1. Features

  1. Support for both SPA and SSR
  2. Local Firebase emulator support
  3. Multi tenancy support
  4. No firebase-admin needed with admin permissions in GKE

2. Quick Setup

  1. Install the package

pnpm i nuxt-firebase-auth firebase

  1. Update nuxt.config.ts
{
    modules: ['nuxt-firebase-auth'],
    // ...
    firebaseAuth: {
        config: {
            apiKey: '_',
        },
        emulatorHost: 'http://localhost:9099',
    },
}
  1. Use Firebase auth app in your application
const { $auth } = useNuxtApp();

const authUser = ref<FirebaseUser>();

$auth?.onIdTokenChanged((user: User | null) => {
  if (!user) {
    authUser.value = undefined;
    return;
  }

  authUser.value = user.toJSON() as FirebaseUser;
});
  1. Make sure to await the initial user state, for example in a middleware:
# middleware/authstate.global.ts

export default defineNuxtRouteMiddleware(async (to) => {
  const { $auth } = useNuxtApp();
  await $auth?.authStateReady();
});

3. Local development

a. Starting the playground

pnpm install

pnpm run dev

Visit the playground on: http://localhost:3000/

b. Starting a local auth emulator

If you want to use a local Firebase auth emulator instead of an online Firebase instance:

cd playground

docker compose up

Visit the auth emulator ui on: http://localhost:4000/auth

4. Overriding config with environment variables

Module configuration is mapped onto the runtimeConfig:

{
  "public": {
    "firebaseAuth": {
      "config": {
        "apiKey": "_"
      },
      "tenantId": "",
      "emulatorHost": "http://localhost:9099",
      "authCookieEndpoint": "/api/authcookie"
    }
  },
  "firebaseAuth": {
    "idTokenCookie": {
      "name": "nfa-id",
      "options": {
        "httpOnly": true,
        "sameSite": "strict",
        "secure": true
      }
    },
    "refreshTokenCookie": {
      "name": "nfa-refresh",
      "options": {
        "httpOnly": true,
        "sameSite": "strict",
        "secure": true
      }
    }
  }
}
# public
NUXT_PUBLIC_FIREBASE_AUTH_CONFIG={"apiKey":"apikeyhere"}
NUXT_PUBLIC_FIREBASE_AUTH_EMULATOR_HOST="http://localhost:9099"
NUXT_PUBLIC_FIREBASE_AUTH_TENANT_ID="tenantname"

# private
NUXT_FIREBASE_AUTH_ID_TOKEN_COOKIE_NAME="nfa-id"
NUXT_FIREBASE_AUTH_ID_TOKEN_COOKIE_OPTIONS={"httpOnly": true,"sameSite": "strict","secure": true}
NUXT_FIREBASE_AUTH_REFRESH_TOKEN_COOKIE_NAME="nfa-refresh"
NUXT_FIREBASE_AUTH_REFRESH_TOKEN_COOKIE_OPTIONS={"httpOnly": true,"sameSite": "strict","secure": true}