Skip to content

feat(backend): Add email template system (verification, notifications… - #505

Open
elcabasa wants to merge 2 commits into
StayLitCodes:mainfrom
elcabasa:Add-email-template-system
Open

feat(backend): Add email template system (verification, notifications…#505
elcabasa wants to merge 2 commits into
StayLitCodes:mainfrom
elcabasa:Add-email-template-system

Conversation

@elcabasa

Copy link
Copy Markdown

feat(backend): Add reusable email template system for Vaultix notifications

fixes #491

Summary

This PR introduces a reusable email templating system for Vaultix, providing a consistent, branded experience across all transactional emails. The implementation includes a shared base layout, reusable components, event-specific templates, and an admin preview endpoint to simplify development and testing.

The goal is to establish a maintainable foundation for all future email communications while ensuring compatibility with major email clients.

Closes #491


What Changed

Email Template System

  • Selected and integrated a reusable email template engine suitable for transactional emails.
  • Introduced a shared base email layout to standardise branding and reduce template duplication.
  • Added reusable email components for:
    • Header
    • Footer
    • Logo
    • CTA buttons
    • Content sections
    • Common typography and spacing

Transactional Email Templates

Implemented templates for:

  • Email Verification
  • Password Reset
  • Escrow Invitation
  • Escrow Status Change Notification
  • Dispute Filed Notification
  • Dispute Resolved Notification
  • Milestone Release Notification

Each template supports dynamic content including:

  • Recipient name
  • Escrow details
  • Proposal or dispute information
  • Relevant action links
  • Status updates
  • Dates and timestamps where applicable

Template Preview

  • Added an admin-only template preview endpoint.
  • Allows developers and administrators to preview each email with sample data without sending real emails.
  • Simplifies QA and future template development.

Styling

  • Applied inline CSS for improved compatibility across major email clients.
  • Ensured consistent Vaultix branding throughout all templates.
  • Preserved responsive rendering where supported by email clients.

Testing

Added test coverage for:

  • Template rendering
  • Dynamic data interpolation
  • Base layout rendering
  • Preview endpoint
  • Individual email template generation

Validation

Verified that:

  • All templates render successfully with representative data.
  • Dynamic placeholders populate correctly.
  • Branding remains consistent across all email types.
  • Templates render correctly in common email clients.
  • Admin preview endpoint returns the expected template output.
  • Existing backend functionality remains unaffected.

Why This Change?

Vaultix previously had no dedicated email template system, making future email functionality inconsistent and difficult to maintain.

This implementation provides:

  • Consistent branding
  • Improved maintainability
  • Reusable email components
  • Easier testing through preview functionality
  • Better compatibility across email clients
  • A scalable foundation for future notification emails

Acceptance Criteria

  • ✅ Email verification template implemented.
  • ✅ Password reset template implemented.
  • ✅ Escrow invitation template implemented.
  • ✅ Escrow status notification template implemented.
  • ✅ Dispute filed notification template implemented.
  • ✅ Dispute resolved notification template implemented.
  • ✅ Milestone release notification template implemented.
  • ✅ Shared branded email layout added.
  • ✅ Dynamic content renders correctly.
  • ✅ Inline CSS improves email client compatibility.
  • ✅ Admin preview endpoint implemented.
  • ✅ Test coverage added for rendering and preview functionality.

Security Impact

No security changes were introduced.

This PR focuses on email presentation and template infrastructure. The preview endpoint follows the project's existing authentication and authorisation patterns to prevent unauthorised access.


Notes for Reviewers

  • The implementation is designed to be easily extensible for future email types.
  • Common layout and styling have been centralised to minimise duplication.
  • The preview endpoint allows templates to be reviewed without triggering actual email delivery.

…, dispute)

- Add Handlebars-based email template engine with EmailTemplateService
- Create base layout with Vaultix branding (dark theme, inline CSS)
- Add templates: email verification, password reset, escrow invitation,
  escrow status change, dispute filed, dispute resolved, milestone release,
  party accepted/rejected, condition fulfilled/confirmed, expiration warning
- Refactor EmailSender to use template service instead of inline HTML
- Wire up sendEmailVerification() in AuthService to send real emails
- Add admin preview endpoint (GET /v1/admin/email-templates/preview/:name)
- All templates use inline CSS and table-based layout for email client compatibility
@drips-wave

drips-wave Bot commented Jul 25, 2026

Copy link
Copy Markdown

@elcabasa Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(backend): Add email template system (verification, notifications, dispute)

1 participant