nuxt-actions

Type-safe server actions for Nuxt with Standard Schema validation.

CRUD Actions

Create and list todos using E2E typed action references from #actions.

Form Actions

useFormAction with field-level validation errors, dirty tracking, and reset.

Optimistic Updates

Toggle todo status with instant UI updates and automatic rollback on error.

Smart Cache Invalidation

useActionMutation + tags — a write auto-refetches every query that depends on it.

File Uploads

multipart/form-data parsed into typed file fields. Avatar upload with preview.

Auth Preset

defineAuthMiddleware resolves ctx.user or rejects with a typed 401.

OpenAPI & Swagger UI

Generate an OpenAPI 3.1 document and Swagger UI straight from your actions.

Idempotent Payments

Double-clicking Pay never double-charges — idempotency option replays duplicate requests.

Observability

Global action:start/success/error/settled hooks plus grouped actions.admin.metrics.

Resilience

Exponential retry backoff with jitter, cancelPrevious search, and manual cancel().

Streaming

AI-style text streaming via Server-Sent Events with real-time chunk updates.

SSR Queries

Server-rendered queries with debounced search and automatic re-fetching.

Middleware & Auth

Authentication flow with chained middleware, validation, and error handling.

Advanced Features

Retry, timeout, custom headers, dedupe, throttle, output validation, and executeAsync.

Polling & Auto-Refetch

refetchInterval, refetchOnFocus, refetchOnReconnect, enabled toggle, and transform.

Infinite Scroll

Cursor-based pagination with useInfiniteActionQuery — fetchNextPage, hasNextPage.

Batch Execution

Execute multiple actions in parallel or sequentially with useActions.

Security Middleware

Built-in rateLimitMiddleware and csrfMiddleware for action protection.

Progressive Enhancement

useActionState for forms that work with and without JavaScript.

Real-World App

Complete mini todo app combining auth, CRUD, optimistic updates, and validation.

Prefetch & Stream Cache

prefetchAction to pre-warm cache on hover, useStreamActionQuery with persistent cache.