Notification Trigger Architecture
Why it matters
Synchronous in-line notification creation ties the success of a user action (like, follow, comment) to the reliability of a secondary side-effect. If the notification INSERT fails — due to a database timeout, connection exhaustion, or a schema constraint — the user sees an error for an action that actually succeeded. Under ISO 25010:2011 reliability, the primary mutation and the downstream notification are separate concerns with different fault tolerances. Coupling them in one request also adds latency: notification creation may involve email dispatch or push webhook calls, blocking the response for hundreds of milliseconds.
Severity rationale
High because synchronous notification coupling turns transient notification failures into visible errors on high-frequency user actions, degrading the core interaction loop.
Remediation
Move notification creation out of the request handler and into an async queue using Inngest, BullMQ, or a Vercel background function. The primary mutation returns immediately; the queue worker handles notification delivery independently.
// app/api/posts/[id]/like/route.ts
import { inngest } from '@/lib/inngest'
export async function POST(req: Request, { params }: { params: { id: string } }) {
const userId = getCurrentUserId()
const like = await db.like.create({ data: { userId, postId: params.id } })
// Fire-and-forget — notification failure does not affect the response
await inngest.send({
name: 'notification/post.liked',
data: { likerId: userId, postId: params.id }
})
return Response.json({ success: true })
}
The Inngest function handles retries and dead-lettering without coupling them to the HTTP response cycle.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the Social Features & Engagement Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- iso-25010:2011 · reliability — Fault Tolerance
Taxons
History
- 2026-04-18·v1.0.0·Initial import from community-social-engagement·automated