How khanalbishnu333/multi-tenant-notification-system works
This Laravel application accepts tenant-scoped notification requests, persists notification and recipient state, records lifecycle events, then queues delivery for immediate or scheduled processing. The worker expands tenant-wide broadcasts or delivers to targeted recipients through a channel strategy, updating statuses and emitting outcome events. The API also exposes filtered history, cached summaries, timelines, and recipient status. The graph follows shown controller, service, repository, and job calls; channel implementations and some supporting wiring are represented from the README and SOURCE INDEX, which does not expose every connection.
Main entry points: NotificationController.php Notification API · ProcessNotificationJob.php Delivery job · NotificationService.php Notification service · NotificationRepository.php Notification repository
Components 24
API and orchestration
- Notification API
app/Http/Controllers/Api/NotificationController.php - Request validation
app/Http/Requests/CreateNotificationRequest.php - Notification DTO
app/DTOs/NotificationDTO.php - Notification service
app/Services/NotificationService.php - Rate limiter
app/Services/RateLimiterService.php - Throttle middleware
app/Http/Middleware/CustomRateLimitMiddleware.php - API resources
app/Http/Resources/NotificationResource.php - Timeline resource
app/Http/Resources/NotificationEventResource.php - Recipient resource
app/Http/Resources/RecipientStatusResource.php
Queued delivery
- Delivery job
app/Jobs/ProcessNotificationJob.php - Channel manager
app/Notifications/Channels/ChannelManager.php - Email channel
app/Notifications/Channels/EmailChannel.php - SMS channel
app/Notifications/Channels/SmsChannel.php - Push channel
app/Notifications/Channels/PushChannel.php - Sent event
app/Events/NotificationSent.php - Failed event
app/Events/NotificationFailed.php
Notification records
- Notification repository
app/Repositories/NotificationRepository.php - Notification records
app/Models/Notification.php - Recipient records
app/Models/NotificationRecipient.php - Event service
app/Services/NotificationEventService.php - Audit events
app/Models/NotificationEvent.php
Tenant access
- Tenant users
app/Models/User.php - Tenant
app/Models/Tenant.php
Other components
- API client
Connections 29
- API client → Notification API: calls API
- Notification API → Request validation: validates with
app/Http/Controllers/Api/NotificationController.php - Notification API → Tenant users: resolves UUIDs
app/Http/Controllers/Api/NotificationController.php - Notification API → Notification DTO: builds
app/Http/Controllers/Api/NotificationController.php - Notification API → Notification service: delegates
app/Http/Controllers/Api/NotificationController.php - Notification API → API resources: formats responses
app/Http/Controllers/Api/NotificationController.php - Notification API → Timeline resource: formats timeline
app/Http/Controllers/Api/NotificationController.php - Notification API → Recipient resource: formats recipients
app/Http/Controllers/Api/NotificationController.php - Notification service → Notification repository: persists and queries
app/Services/NotificationService.php - Notification service → Event service: records queued event
app/Services/NotificationService.php - Notification service → Delivery job: dispatches
app/Services/NotificationService.php - Notification repository → Notification records: creates and queries
app/Repositories/NotificationRepository.php - Notification repository → Recipient records: attaches recipients
app/Repositories/NotificationRepository.php - Event service → Audit events: records timeline
app/Services/NotificationEventService.php - Delivery job → Notification repository: updates status
app/Jobs/ProcessNotificationJob.php - Delivery job → Event service: records delivery events
app/Jobs/ProcessNotificationJob.php - Delivery job → Channel manager: resolves channel
app/Jobs/ProcessNotificationJob.php - Delivery job → Tenant users: loads broadcast users
app/Jobs/ProcessNotificationJob.php - Delivery job → Sent event: dispatches on success
app/Jobs/ProcessNotificationJob.php - Delivery job → Failed event: dispatches on failure
app/Jobs/ProcessNotificationJob.php - Channel manager → Email channel: resolves
app/Notifications/Channels/ChannelManager.php - Channel manager → SMS channel: resolves
app/Notifications/Channels/ChannelManager.php - Channel manager → Push channel: resolves
app/Notifications/Channels/ChannelManager.php - Delivery job → Recipient records: updates delivery status
app/Jobs/ProcessNotificationJob.php - Tenant users → Tenant: belongs to
app/Models/User.php - Throttle middleware → Rate limiter: checks limits
app/Http/Middleware/CustomRateLimitMiddleware.php - Notification API → Throttle middleware: throttled by
- Notification service → Notification repository: reads summaries and history
app/Services/NotificationService.php - Notification API → Event service: requests timeline
app/Http/Controllers/Api/NotificationController.php