Skip to main content
The AutumnProvider component wraps your React application and provides the Autumn client to all hooks.
Learn how to setup Autumn hooks in the Getting Started guide.

Usage

// app/layout.tsx
import { AutumnProvider } from "autumn-js/react";

export default function RootLayout({ children }) {
  return (
    <html>
      <body>
        <AutumnProvider>{children}</AutumnProvider>
      </body>
    </html>
  );
}

Parameters

backendUrl
string
Base URL for your backend server (e.g., https://api.example.com). Defaults to current origin. Set this when your backend is hosted on a separate domain.
pathPrefix
string
Path prefix for Autumn routes. Defaults to /api/autumn, or /api/auth/autumn if useBetterAuth is true.
useBetterAuth
boolean
Use better-auth integration. Sets pathPrefix to /api/auth/autumn and includeCredentials to true.
includeCredentials
boolean
Include credentials (cookies) in cross-origin requests. Defaults to true if useBetterAuth is true.
queryClient
QueryClient
Custom TanStack Query client. Uses a default client if not provided.
suppressLogs
boolean
If true, suppresses console warnings and logs.