Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@tfarras/nestjs-firebase-admin

tfarras818MIT2.0.1TypeScript support: included

NestJS Module for Firebase Admin SDK

node.js, nestjs, nest, google, firebase, firebase-admin, module, sdk

readme

NestJS Module for Firebase Admin SDK

Installation

npm install @tfarras/nestjs-firebase-admin

Import module

import { Module } from '@nestjs/common';
import { FirebaseAdminModule } from '@tfarras/nestjs-firebase-admin'
import * as admin from 'firebase-admin'

@Module({
  imports: [
    FirebaseAdminModule.forRootAsync({
      useFactory: () => ({
        credential: admin.credential.applicationDefault()
      })
    }),
  ],
})
export class AppModule {}

Example

Inject FirebaseAdminSDK

import { Injectable, Inject } from '@nestjs/common';
import { FIREBASE_ADMIN_INJECT, FirebaseAdminSDK } from '@tfarras/nestjs-firebase-admin';

@Injectable()
export class AppService {
  constructor(
    @Inject(FIREBASE_ADMIN_INJECT) private firebaseAdmin: FirebaseAdminSDK,
  ) {}

  getUsers() {
    return this.firebaseAdmin.auth().listUsers();
  }
}

changelog

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

2.0.0 - 2021-04-22

Fixed

  • Changed name of exported module. Now it's the same in documentation and module: FirebaseAdminModule

Changed

  • Updated NestJS dependencies
  • Updated firebase-admin dependecy
  • Updated scripts. Now it's using Nest Cli