A standalone Node.js microservice designed to handle background email notifications for the ClinFlow movie booking platform.
To prevent the main API from slowing down or timing out during third-party network requests, this service uses a database-polling architecture. It reads PENDING notification tickets from a MongoDB database and dispatches them asynchronously using a scheduled cron job and the Resend API.
- Runtime: Node.js
- Framework: Express.js
- Database: MongoDB (Mongoose ORM)
- Email Provider: Resend API
- Task Scheduling:
node-cron
- Node.js (v16+)
- MongoDB (Local or Atlas)
- Resend API Key
- Clone the repository and install dependencies:
git clone https://github.com/prantaroy11/NotificationService.git
cd NotificationService
npm install- Create a
.envfile in the root directory:
PORT=3001
NODE_ENV=development
DB_URL=mongodb://localhost:27017/noti_db
PROD_DB_URL=your_mongodb_atlas_url
RESEND_API_KEY=re_your_api_key_here- Start the development server:
npm run devThe server will start on port 3001, and the mailer cron job will execute every 2 minutes.
Create a new email ticket (Status defaults to PENDING).
Retrieve all tickets (Pending, Success, Failed).
Retrieve a specific ticket by ID.
- ClinFlow (Core API): The main backend API that generates the ticket booking payloads.