Observability
One place to watch every action — global hooks
The problem: you want analytics, latency tracking, and error toasts for every server action — without sprinkling onSuccess/onError in every component.
The fix: the action:start/success/error/settled hooks fire on nuxtApp for every call, with typed payloads including durationMs. This page also calls the grouped namespace reference actions.admin.metrics.
Hook event stream
Trigger an action to see hook events.
How it works
// plugins/action-analytics.ts
export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.hook('action:success', ({ path, durationMs }) => {
useTrackEvent('action', { path, durationMs })
})
nuxtApp.hook('action:error', ({ error }) => {
if (error.code !== 'VALIDATION_ERROR') useToast().error(error.message)
})
})