1. Firebase
- Create a Firebase project and add a Firestore database.
- Go to Authentication, then Sign-in method, and enable Google.
- Go to Authentication, then Settings, then Authorized domains, and add the domain you will serve the app from (for example
mail.example.com) and your*.onrender.comhost if you use Render. - Lock the database so that only the server can use it. Under Firestore, then Rules, paste:
- Create a service-account key: Project settings, then Service accounts, then Node.js, then Generate new private key. You will paste this JSON into
FIREBASE_SERVICE_ACCOUNT. - Copy the web-app config: Project settings, then Your apps, then Web. You will paste it into
FIREBASE_WEB_CONFIG.
2. Resend
- Add and verify your domain in Resend, and enable receiving mail for it.
- Create an API key with send and receive access. This is
RESEND_API_KEY. - After the server is deployed (step 4), add a webhook that points to
https://<your-domain>/api/incomingfor theemail.receivedevent. - Copy the webhook’s signing secret into
RESEND_WEBHOOK_SECRET.
3. Push keys
Generate a pair of VAPID keys once, on any computer:VAPID_PUBLIC_KEY and the private key is VAPID_PRIVATE_KEY. Keep the private key secret. Without these keys mail still arrives, only the notification is skipped.
4. Deploy
On Render, create a Web Service from your fork of the repository:
Add these environment variables:
Older deployments that use
PERSONAL_GMAIL keep working, because it is used when MAILBOX_OWNER_EMAIL is not set. Rename it when convenient.5. Check that it works
- Open your server’s URL and sign in with the account in
MAILBOX_OWNER_EMAIL. - Tap Allow notifications. A test notification is sent to confirm.
- Send an email to one of your addresses. It should appear in the inbox and trigger a notification.
Running locally
Copy.env.example to .env, fill it in, and start the server. Node.js 20.6 or newer can read the file directly:
npm start.
Copyright © 2025–2026 Amit Dutta