Overview
NutriFit uses Laravel’s notification system to send email notifications to users throughout their journey on the platform. All notifications implement theShouldQueue interface, meaning they are processed asynchronously through Laravel’s queue system for improved performance.
Architecture
Notification System
The notification system is built on Laravel’s native notification framework with the following characteristics:- Namespace:
App\Notifications - Base Class:
Illuminate\Notifications\Notification - Queue Support: All notifications implement
ShouldQueueinterface - Delivery Channel: Email (
mail) - Mail Driver: Configurable via
MAIL_MAILERenvironment variable (default:log)
Queue Configuration
Default Queue Connection:database (configured via QUEUE_CONNECTION env variable)
Queue Settings:
Mail Configuration
Supported Mail Drivers
- SMTP (default port: 2525)
- SES (Amazon Simple Email Service)
- Postmark
- Resend
- Sendmail
- Log (development)
- Array (testing)
SMTP Configuration
Configure via environment variables:Mail From Address
Default Configuration:Notification Categories
NutriFit notifications are organized into two main categories:Appointment Notifications
Notifications related to appointment lifecycle events:- Appointment created
- Appointment confirmed
- Appointment cancelled (by patient or nutritionist)
- Appointment rescheduled
- Appointment reminder (24 hours before)
- Attention completed
User Notifications
Notifications related to user account management:- Welcome email
- Email verification
- Password reset
- Password changed
- Account enabled
- Account disabled
Usage Example
Sending a Notification
Queueing Notifications
Since all NutriFit notifications implementShouldQueue, they are automatically queued:
Notification Delivery Channels
All notifications currently use themail channel. To add additional channels (database, SMS, etc.), update the via() method:
Testing
For testing notifications without sending actual emails:Localization
All notification content is currently in Spanish. Email subjects and content use Spanish language with appropriate emojis for visual context.Best Practices
- Always queue notifications to avoid blocking user requests
- Handle queue failures with retry logic and dead letter queues
- Monitor queue workers in production using Laravel Horizon or similar tools
- Test notification content before deploying to production
- Use notification preferences to allow users to opt-out of certain notifications
- Log notification failures for debugging and monitoring