Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tfarras/nestjs-firebase-admin

NestJS Module for Firebase Admin SDK
https://github.com/tfarras/nestjs-firebase-admin

firebase firebase-admin-sdk nestjs nodejs sdk

Last synced: 19 days ago
JSON representation

NestJS Module for Firebase Admin SDK

Awesome Lists containing this project

README

        



Nest Logo

NestJS Module for Firebase Admin SDK



Built with NestJS

# Installation

```bash
npm install @tfarras/nestjs-firebase-admin
```

## Import module

```typescript
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

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