Socket
Socket
Sign inDemoInstall

@cuaklabs/nestjs-firebase-admin

Package Overview
Dependencies
0
Maintainers
6
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @cuaklabs/nestjs-firebase-admin

meow meow meow


Version published
Weekly downloads
41
decreased by-85.2%
Maintainers
6
Created
Weekly downloads
 

Readme

Source

Nest Logo

Nestjs Firebase Admin Module

Build status Coverage status

Description

Firebase Admin module for Nest.

Installation

$ npm i --save firebase-admin @cuaklabs/nestjs-firebase-admin

Quick Start

Initialization
import { FirebaseAdminModule } from '@cuaklabs/nestjs-firebase-admin';

@Module({
  imports: [FirebaseAdminModule.forRoot()],
})
export class AppModule {}
import { FirebaseAdminModule } from '@cuaklabs/nestjs-firebase-admin';
import { ConfigModule, ConfigService } from '@nestjs/config';
import { AppOptions } from 'firebase-admin';

@Module({
  imports: [
    FirebaseAdminModule.forRootAsync({
      imports: [ConfigModule],
      inject: [ConfigService],
      useFactory: (configService: ConfigService): AppOptions => {
        return {
          databaseURL: configService.get('DATABASE_URL'),
        };
      },
    }),

  ],
})
export class AppModule {}
Inject Providers
import { Auth } from 'firebase-admin/auth';
import { CatService } from './CatService';
import { FirebaseAdminModule } from '@cuaklabs/nestjs-firebase-admin';

@Module({
  imports: [FirebaseAdminModule.injectProviders([Auth])],
  providers: [CatService],
})
export class CatModule {}
import { Auth } from 'firebase-admin/auth';
import { InjectFirebaseProvider } from '@cuaklabs/nestjs-firebase-admin';

export class CatService {
  constructor(@InjectFirebaseProvider(Auth) private readonly auth: Auth) {}

  public doSomething(): void {

  }
}

Multiple apps/connections

Initialization
import { FirebaseAdminModule } from '@cuaklabs/nestjs-firebase-admin';

@Module({
  imports: [FirebaseAdminModule.forRoot([{ name: 'app-name' }])],
})
export class AppModule {}
import { FirebaseAdminModule } from '@cuaklabs/nestjs-firebase-admin';
import { ConfigModule, ConfigService } from '@nestjs/config';
import { AppOptions } from 'firebase-admin';

@Module({
  imports: [
    FirebaseAdminModule.forRootAsync({
      imports: [ConfigModule],
      inject: [ConfigService],
      useFactory: (configService: ConfigService): AppOptions => {
        return [
          { 
            name: 'app-name',
            appOptions: {
              databaseURL: configService.get('DATABASE_URL'),
            },
          },
        ];
      },
    }),

  ],
})
export class AppModule {}
Inject Providers
import { Auth } from 'firebase-admin/auth';
import { CatService } from './CatService';
import { FirebaseAdminModule } from '@cuaklabs/nestjs-firebase-admin';

@Module({
  imports: [FirebaseAdminModule.injectProviders([Auth], 'app-name')],
  providers: [CatService],
})
export class CatModule {}
import { Auth } from 'firebase-admin/auth';
import { InjectFirebaseProvider } from '@cuaklabs/nestjs-firebase-admin';

export class CatService {
  constructor(@InjectFirebaseProvider(Auth, 'app-name') private readonly auth: Auth) {}

  public doSomething(): void {

  }
}

Keywords

FAQs

Last updated on 11 Dec 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc