Create a Firebase project and get a service account
- Go to the Firebase console and create a new project.
- In the left sidebar, click Build > Firestore Database, then click Create database and follow the prompts to enable Cloud Firestore.
- Go to Project Settings (gear icon) > Service accounts.
- Click Generate new private key and confirm. Firebase downloads a JSON file.
- Rename the downloaded file to
serviceAccount.jsonand move it to your project root.
Initialize the SDK
Create
index.js in your project root with the following code:index.js
The named export is
FirebaseExpressSdk — note the lowercase k at the end. Use this exact casing when importing from the package.Add a start script and run
Open Then start the server:Your server is now running at
package.json and update the scripts field:package.json
http://localhost:3001.