@lontara/nestjs-firebase-admin
TypeScript icon, indicating that this package has built-in type declarations

4.0.1 • Public • Published

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

Package Sidebar

Install

npm i @lontara/nestjs-firebase-admin

Weekly Downloads

2

Version

4.0.1

License

MIT

Unpacked Size

142 kB

Total Files

20

Last publish

Collaborators

  • pabbas
  • uiaksara