Skip to content

Build Contact Form backend module with email notifications #495

@yusuftomilola

Description

@yusuftomilola

Description:
Create a full NestJS Contact module that handles contact form submissions end-to-end. This includes: a ContactMessage entity stored in PostgreSQL, a validated DTO, a public POST /contact endpoint with rate limiting (5 requests/minute), and two email notifications — a confirmation to the user and a notification to the admin.

Acceptance Criteria:

  • ContactMessage entity with: fullName, email, phone (optional), company (optional), subject, message, ipAddress, isRead
  • SubmitContactDto with class-validator decorators and @SanitizeString()
  • POST /contact endpoint — public (@Public()), rate-limited (@Throttle)
  • Saves submission to database
  • Sends confirmation email to user (non-blocking)
  • Sends notification email to admin with full message (non-blocking)
  • Two Handlebars email templates: contact-confirmation.hbs and contact-notification.hbs
  • sendContactConfirmation() and sendContactNotification() methods added to EmailService
  • ContactModule registered in app.module.ts
  • Rate limit config added to ThrottlerModule: { name: 'contact', ttl: 60_000, limit: 5 }

File(s): backend/src/contact/ (new module), backend/src/email/email.service.ts, backend/src/email/templates/contact-confirmation.hbs, backend/src/email/templates/contact-notification.hbs, backend/src/app.module.ts

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions