NestJS backend API auth template using Firebase Authentication.
Can be combined with the frontend Next.js + Firebase Auth template for fullstack auth.
npm install
A Firebase project must be created and connected to the app using the Firebase Admin SDK.
To configure the connection, download a private key for your project from the Firebase console (Project Settings -> Service Accounts -> "Generate new private key") and add the JSON key file here:
src/auth/strategies/service-account-key.json
This project is set-up to utilize Firebase Local Emulator Suite during local development.
Ensure that the Firebase Admin SDK is connected to the Authentication emulator by setting the environment variable FIREBASE_AUTH_EMULATOR_HOST=127.0.0.1:9099
as mentioned here.
Run NestJS locally:
npm run start:debug
Start Auth Emulator (requires Firebase CLI):
firebase emulators:start