JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 325
  • Score
    100M100P100Q106714F
  • License MIT

NestJS Module for Firebase Admin SDK

Package Exports

  • @tfarras/nestjs-firebase-admin

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@tfarras/nestjs-firebase-admin) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

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();
  }
}