This repository implements an example of firebase authentication with a frontend implemented in React and a backend implemented in nestjs.
The backend code has been written following the official nestjs and this tutorial. The frontend code has been written following this tutorial.
After cloning this repository to configure the frontend and the backend to interact with firebase take the following steps:
- Create the file
backend/src/auth/credential.jsonfollowing the instructions contained in this firebase docs under the section To generate a private key file for your service account - Create the file
frontend/src/firebaseConfig.jsonwith the configuration that you app needs to contact the firebase authentication server. In the tutorial this information is shown in the screenshot titled Add firebase to your app. The json file will result in something like
{
"apiKey": "your-apiKey",
"authDomain": "your-authDomain",
"projectId": "your-projectId",
"storageBucket": "your-storageBucket",
"messagingSenderId": "your-messagingSenderId",
"appId": "your-appId"
} To run the code follow the steps below:
docker-compose builddocker-compose up -d
when the services are up you should be able to contact the frontend at the address localhost:3000/login and the frontend at the backend at [localhost:4000].