A minimal Node.js application that wraps Firebase Authentication to handle email actions like password reset, email verification, and email recovery. Built with Express.js and Firebase, this app automates the process of handling these emails, saving time and effort in any Firebase-related projects.
- Automates Firebase Email Actions: Handles password reset, email verification, and email recovery.
- Express.js API: Lightweight server for routing.
- Pre-built HTML Templates: For common email actions.
- Reusable: Easily integrate into other Firebase-based apps.
- Self-hostable: Dockerized for easy deployment and scaling.
This app automates the handling of Firebase email actions (like password reset or email verification).
If you prefer not to set up your own server, you can use the hosted version. Just follow these steps:
-
Create a Firebase Project
- Go to the Firebase console and create a new Firebase project.
-
Enable Email/Password Authentication
- Navigate to Authentication > Sign-in method > Email/Password, and enable it.
-
Add Your Node.js App URL to Firebase
- In the Firebase console, go to Settings > Authorized Domains, and add your Node.js application URL (either my hosted URL or your custom domain).
-
Update Action URL in Firebase Console
- In the Templates section of Firebase Authentication, click the edit icon for the email actions.
- Customize the action URL by entering the following format:
https://your-nodejs-hosting-url/__/auth/action
- Save the settings.
Once your Node.js app is up and running, you need to configure the Firebase authentication to redirect users to this app for email actions.
-
Firebase Initialization Initialize Firebase in your frontend application. You can follow the Firebase documentation for this.
-
Set your Continue URL [OPITONAL] In your frontend code, you only need to set your web app url for your node.js applicaiton to point back to your main app:
const actionCodeSettings = { url: "https://your-web-app-url", // Replace with with your main application url [ContinueURL] };
-
Example Snippet You can use the example snippet provided in the
example-snippets
folder to get an idea of how it should work.
To install and run the app locally, follow these steps:
-
Clone the Repo:
$ git clone https://github.com/samay15jan/firebase-email-handler
-
Install Dependencies:
$ cd firebase-email-handler && npm install
-
Run the App:
$ npm start
A Docker image for this project can be found at Docker Hub
You can also deploy your own instance of the app by running it in a Docker container:
-
Clone the Repo
$ git clone https://github.com/samay15jan/firebase-email-handler
-
Build the Docker Image
- Navigate to the project directory and build the Docker image:
$ cd firebase-email-handler $ docker build -t firebase-email-handler .
-
Push to Docker Hub (Optional)
-
If you'd like to share your image, you can push it to Docker Hub which is easy if u want to host it later:
$ docker push your-dockerhub-username/firebase-email-handler
- Run the Docker Container
-
You can run the app locally or on your cloud provider (e.g., Google Cloud, Azure, or Render):
$ docker run -p 3000:3000 firebase-email-handler
- Deploy to Cloud Hosting
- You can use cloud platforms such as Render, Google Cloud, or Azure to deploy your Docker container.
- For More Information: Refer to the official Firebase Documentation for detailed guidance on Firebase Authentication and email handling.