Skip to main content
The Nuxt client provides native integration with Nuxt 3, offering composables like useFetch, useAsyncData, and SSR support out of the box.

Installation

Basic Usage

1

Create a client instance

2

Use with $fetch

3

Use with useFetch

Configuration

The Nuxt client extends Nuxt’s fetch configuration:

Client Options

Composables

The Nuxt client supports all Nuxt composables:

$fetch

Direct fetch without reactivity:

useFetch

Reactive data fetching with SSR support:

useAsyncData

Custom async data handling:

useLazyFetch

Lazy loading with useFetch:

useLazyAsyncData

Lazy loading with useAsyncData:

HTTP Methods

Reactive Parameters

Use Vue refs for reactive query parameters:

Authentication

Token from Composable

Per-Request Security

Server-Sent Events

Stream real-time data:

Caching and Refresh

Manual Refresh

Auto Refresh

Cache Keys

SSR Support

Server-Side Rendering

Client-Only Fetching

Error Handling

Advanced Examples

Parallel Requests

Dependent Requests

Optimistic Updates

TypeScript Types

Best Practices

Choose the right composable for your use case:
  • $fetch for one-off requests
  • useFetch for reactive SSR data
  • useAsyncData for custom async logic
  • useLazyFetch for deferred loading
Use refs for parameters that should trigger re-fetching:
Use unique keys for caching:
Always show loading indicators:

Next Steps

Fetch Client

Learn about the underlying Fetch client

Composables

Explore Nuxt composables

SSR Support

Configure server-side rendering

Authentication

Set up API authentication