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

firebase-admin-edge

v1.0.24

Published

A demo package for Total TypeScript

Readme

Firebase Admin Edge

Lightweight helpers to use Firebase Admin features in edge runtimes and serverless environments. Built on top of the Firebase REST APIs; no long-running server processes or additional runtime dependencies required.

Supported runtimes:

  • Vercel Edge
  • Cloudflare Workers
  • Deno (Edge)
  • Bun
  • Node.js

Installation

npm i firebase-admin-edge

Quick Start

Basic setup

import { createFirebaseEdgeServer, TokenCache } from 'firebase-admin-edge';
import { getCookie, setCookie } from 'your-framework-library';

// Optional: Create a cache for service account tokens (recommended for performance)
const cache = new TokenCache();

// Create the edge server once during initialization. Keep secrets out of
// source control — load the `serviceAccount` and client secrets from
// environment variables or a secret manager.
export const firebaseServer = createFirebaseEdgeServer({
    serviceAccount: {
        type: 'service_account',
        project_id: 'your-project-id',
        private_key_id: 'your-private-key-id'
        ...
    },
    firebaseConfig: {
        apiKey: 'your-web-api-key',
        authDomain: 'your-project.firebaseapp.com'
    },
    providers: {
        google: {
            client_id: 'your-google-oauth-client-id',
            client_secret: 'your-google-oauth-client-secret'
        },
        github: {
            client_id: 'your-github-oauth-client-id',
            client_secret: 'your-github-oauth-client-secret'
        }
    },
    cookies: {
        // Provide your framework's cookie helpers
        getSession: (name) => getCookie(name),
        saveSession: (name, value, options) => setCookie(name, value, options)
    },
    // Optional: Token caching for improved performance (tokens cached for 1 hour)
    cache: {
        getCache: (name) => cache.get(name),
        setCache: (name, value, ttl) => cache.set(name, value, ttl)
    },
    // Optional: Custom session cookie name (defaults to '__session')
    cookieName: '__session',
    // Optional: Custom cookie options
    cookieOptions: {
        httpOnly: true,
        secure: true,
        sameSite: 'lax',
        path: '/',
        maxAge: 60 * 60 * 24 * 5 // 5 days
    },
    // OAuth callback URL (registered with your provider)
    redirectUri: 'https://example.com/auth/callback',
    // Optional: Tenant ID for multi-tenancy
    tenantId: 'your-tenant-id',
    // Optional: Automatically link accounts with same email
    autoLinkProviders: false
});

Get User

const { data: user } = await firebaseServer.getUser();

Login with code (callback)

// Pass the request URL (the server extracts code and state from query params)
const { error } = await firebaseServer.signInWithCallback(request.url);

Create Login URL

// Create an OAuth login URL for the `next` state.
// `next` should be the URL or path to return to after successful login.
const next = '/dashboard';

// Generate provider-specific login URLs (server uses configured redirectUri)
const loginUrlGoogle = await firebaseServer.getGoogleLoginURL(next);
const loginUrlGithub = await firebaseServer.getGitHubLoginURL(next);

// Redirect the user to the provider's login page
redirect(302, loginUrlGoogle);

Logout

await firebaseServer.signOut();

// Your framework redirect method
redirect(302, '/');

Features

  • Edge Runtime Compatible - Works in Vercel Edge, Cloudflare Workers, Deno, and Bun
  • Zero Dependencies - Uses only fetch API and jose
  • TypeScript Support - Full type safety and IntelliSense
  • Session Management - Secure HTTP-only cookies
  • OAuth Support - Google and GitHub OAuth 2.0 flows
  • Token Management - Generate client tokens from server sessions
  • Token Caching - Optional caching for service account tokens (1-hour TTL)
  • Multi-Tenancy - Support for Firebase Auth tenant IDs
  • Flexible Configuration - Customizable cookie options and cache implementations

Firebase Auth Todo

  • ☐ Magic Link Login (auto save email option)
  • ☐ Link and Unlink Providers
  • ☐ Email / Password / Annonymous Login
  • ☐ Reset Password
  • ☐ Change Email
  • ☐ Get User By ID
  • ☐ Get All Users with Order By and Pagination
  • ☐ Create User
  • ☐ Delete
  • ☐ Update User
  • ☐ Add / Remove Custom Claims
  • ☐ Disable User (Ban User)
  • ☐ Add All Providers
  • ☐ Add App Check
  • ☐ Ban Users
  • ☐ RBAC

Firestore Todo

  • ☐ Get Document By ID
  • ☐ Create Document
  • ☐ Update Document (merge option)
  • ☐ Delete Document
  • ☐ Query Documents

Firebase Storage

  • ☐ Create File
  • ☐ Delete File
  • ☐ Get File