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

@effect-firebase/admin

v0.6.10

Published

Firebase Admin SDK integration for Effect Firebase. This package provides the FirestoreService implementation for server-side applications and Cloud Functions support.

Readme

@effect-firebase/admin

Firebase Admin SDK integration for Effect Firebase. This package provides the FirestoreService implementation for server-side applications and Cloud Functions support.

[!WARNING] This project is still under heavy development and APIs may change frequently.

Features

  • 🔥 Firebase Admin SDK Integration - Complete FirestoreService implementation
  • Cloud Functions Support - Effect-based function handlers
  • 📝 Cloud Logging - Automatic logging integration
  • 🎯 Type-Safe Function Handlers - Schema validation for function inputs/outputs
  • 🔄 Firestore Triggers - Document lifecycle event handlers
  • 📮 Cloud Tasks Triggers - Typed task queue handlers with optional payload decoding
  • 🚀 Effect Native - Built on Effect's powerful composition and error handling

Installation

npm install @effect-firebase/admin effect-firebase effect @effect/experimental
npm install firebase-admin firebase-functions

Cloud Functions

HTTP Functions (onRequest)

import { Effect } from 'effect';
import { initializeApp } from 'firebase-admin/app';
import {
  Admin,
  FunctionsRuntime,
  onRequestEffect,
} from '@effect-firebase/admin';

// Create the runtime with your layers
const runtime = FunctionsRuntime.make(Admin.layerFromApp(initializeApp()));

// Define the function
export const myHttpFunction = onRequestEffect(
  { runtime },
  (request, response) =>
    Effect.gen(function* () {
      const repo = yield* PostRepository;
      const posts = yield* repo.query();

      response.json({ posts });
    }).pipe(Effect.provide(PostRepository))
);

Callable Functions (onCall)

import { Effect, Schema } from 'effect';
import { initializeApp } from 'firebase-admin/app';
import { Admin, FunctionsRuntime, onCallEffect } from '@effect-firebase/admin';

const runtime = FunctionsRuntime.make(Admin.layerFromApp(initializeApp()));

// Define request/response schemas
const CreatePostRequest = Schema.Struct({
  title: Schema.String,
  content: Schema.String,
});

const CreatePostResponse = Schema.Struct({
  postId: Schema.String,
});

// Define the function
export const createPost = onCallEffect(
  {
    runtime,
    inputSchema: CreatePostRequest,
    outputSchema: CreatePostResponse,
  },
  (request) =>
    Effect.gen(function* () {
      const repo = yield* PostRepository;
      const { title, content } = request.data;

      const postId = yield* repo.add({
        title,
        content,
        status: 'draft',
        likes: 0,
      });

      return { postId };
    }).pipe(Effect.provide(PostRepository))
);

Cloud Tasks Functions (onTaskDispatched)

import { Effect, Schema } from 'effect';
import { initializeApp } from 'firebase-admin/app';
import {
  Admin,
  FunctionsRuntime,
  onTaskDispatchedEffect,
} from '@effect-firebase/admin';

const runtime = FunctionsRuntime.make(Admin.layerFromApp(initializeApp()));

const ProcessEmailTask = Schema.Struct({
  email: Schema.String,
  template: Schema.String,
});

export const processEmail = onTaskDispatchedEffect(
  {
    runtime,
    retryConfig: { maxAttempts: 5 },
    rateLimits: { maxConcurrentDispatches: 10 },
    dataSchema: ProcessEmailTask,
  },
  (task, request) =>
    Effect.gen(function* () {
      yield* Effect.log('Processing task', {
        email: task.email,
        queue: request.queueName,
      });
    })
);

Cloud Logging

The Admin layer automatically provides Cloud Logging integration:

import { Effect } from 'effect';
import { initializeApp } from 'firebase-admin/app';
import { Admin } from '@effect-firebase/admin';

Effect.gen(function* () {
  // Logs automatically go to Cloud Logging
  yield* Effect.log('Info message');
  yield* Effect.logError('Error message');
  yield* Effect.logDebug('Debug message');

  // Logs with structured data
  yield* Effect.log('User action', {
    userId: '123',
    action: 'create_post',
    metadata: { postId: 'abc' },
  });
}).pipe(Effect.provide(Admin.layerFromApp(initializeApp())));

Configuration

Function Options

All function handlers support Firebase Functions configuration options:

import { onCallEffect } from '@effect-firebase/admin';

export const myFunction = onCallEffect(
  {
    runtime,
    // Firebase Functions options
    region: 'us-central1',
    memory: '512MB',
    timeoutSeconds: 60,
    maxInstances: 100,
    minInstances: 0,
    // CORS
    cors: true,
  },
  (request) => /* ... */
);

API Reference

Admin

  • Admin.layer - Layer providing FirestoreService and CloudLogger (requires App in the environment)
  • Admin.layerFromApp(app) - Convenience layer with Firebase Admin app already provided

Functions

  • onRequestEffect - HTTP request handler
  • onCallEffect - Callable function handler
  • onDocumentCreatedEffect - Document created trigger
  • onDocumentUpdatedEffect - Document updated trigger
  • onDocumentDeletedEffect - Document deleted trigger
  • onDocumentWrittenEffect - Document written (any change) trigger
  • onMessagePublishedEffect - Pub/Sub message published trigger
  • onTaskDispatchedEffect - Cloud Tasks dispatch trigger
  • FunctionsRuntime.make(layer) - Create an Effect runtime from a layer
  • FunctionsRuntime.Default(app) - Create a runtime from the provided Firebase Admin app

Documentation

For core concepts, schemas, models, and queries, see the effect-firebase documentation.

License

MIT

Resources