nestjs-firebase-module
v1.0.1
Published
Nestjs-firebase-module is nest styled firebase-admin provider. It is inspired by @nestjs/mongoose
Downloads
26
Readme
Nestjs Firebase Module
Nestjs-firebase-module is nest styled firebase-admin provider. It is inspired by @nestjs/mongoose
Installation
This module requires Nestjs to run.
$ npm install --save nestjs-firebase-module
Examples
you can import firebase module like this
imports: [
FirebaseModule.forRootAsync({
useFactory: (config: ConfigService) => ({
credentials: {
privateKey: config.firebasePrivateKey,
projectId: config.firebaseProjectId,
clientEmail: config.firebaseClientEmail,
},
}),
inject: [ConfigService],
}),
]
and in your service file
@Inject('Firestore')
private readonly firestore,
@Inject('Firebase')
private readonly firebase,
If your project is using firestore as its core db. you can inject collection like
FirebaseModule.forFeature('collectionName')
and in your service,
@Inject('collectionName')
private readonly collectionName,
To contribute
This is the base repo, you can contribute to it to expose more functionality of firebase
TODOs
- inject firebase subscriptions in decorators style
- firestore schema validation like mongoose