Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Ajith66310/task-manager-full/llms.txt

Use this file to discover all available pages before exploring further.

TaskFlow includes a dedicated notification microservice that sends transactional emails to users when admins take action on their tasks. Emails are dispatched through EmailJS using server-side API calls, keeping your SMTP credentials out of the frontend entirely.

When emails are sent

TaskFlow triggers an email notification in two scenarios:
  1. Admin marks a task as completed — when an admin calls PUT /api/tasks/:id and sets status to completed, the task service fetches the task owner’s email from the user service and queues an email.
  2. Admin verifies a task — when an admin calls PATCH /api/admin/tasks/:id/verify, a verification confirmation email is sent to the task owner.
  3. Admin assigns a task — when an admin calls POST /api/admin/tasks/assign, an assignment notification email is sent to the assigned user.

Email payload

Each email sent to the notification service includes:
FieldDescription
emailRecipient’s email address
subjectEmail subject line (e.g. "Task Completed by Admin")
messagePlain-text message body (e.g. "Hello Ada, your task … has been …")
htmlHTML version of the email body
Example payload for a completed-task notification:
{
  "email": "ada@example.com",
  "subject": "Task Completed by Admin",
  "message": "Hello Ada, your task \"Write quarterly report\" has been marked as completed by the admin.",
  "html": "<h3>Hello Ada,</h3><p>Your task <strong>Write quarterly report</strong> has been marked as completed by the admin.</p>"
}

Notification service endpoint

The notification microservice runs independently on port 5003 and exposes a single endpoint:
POST /api/notifications/send-email
Content-Type: application/json
The task service and admin service call this endpoint internally via HTTP. You do not need to call it directly during normal operation. A health check is also available:
GET /health

Fire-and-forget pattern

Email dispatch is non-blocking. The task service sends the notification request to the microservice in the background using a fetch call that is not awaited:
fetch('http://notification-service:5003/api/notifications/send-email', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ email, subject, message, html })
}).catch(err => console.error("Background Email Error:", err));
This means the API response for the task update or assignment is returned to the caller immediately, without waiting for the email to be queued or delivered. A failure in the notification service will not cause the originating API call to fail.
Because email dispatch is fire-and-forget, notification failures are only visible in the server logs. If EmailJS is misconfigured or the notification service is unreachable, emails will silently drop without affecting task operations. Monitor your service logs to detect delivery issues.

EmailJS configuration

The notification service reads four environment variables at startup. All four must be set for emails to send successfully:
VariableDescription
EMAILJS_SERVICE_IDThe EmailJS service ID linked to your email provider
EMAILJS_TEMPLATE_IDThe ID of the EmailJS template to use
EMAILJS_PUBLIC_KEYYour EmailJS public (user) API key
EMAILJS_PRIVATE_KEYYour EmailJS private API key for server-side calls
Set these in the notification service’s .env file or your container environment:
EMAILJS_SERVICE_ID=service_xxxxxxx
EMAILJS_TEMPLATE_ID=template_xxxxxxx
EMAILJS_PUBLIC_KEY=your_public_key
EMAILJS_PRIVATE_KEY=your_private_key
Your EmailJS template must include template variables that match the fields sent in the payload: {{email}}, {{subject}}, {{message}}, and {{html_content}}.
The notification service does not validate that the recipient address resolves to an active inbox. Ensure users provide a valid email address during signup.

Build docs developers (and LLMs) love