Skip to main content
The Confidence Next.js SDK provides feature flag evaluation for Next.js applications using the Confidence Resolver—a Rust-based resolver that runs as WebAssembly. It supports both React Server Components and Client Components with the App Router.

Features

  • Local evaluation: Flag rules evaluate on your infrastructure in microseconds
  • App Router support: Works with React Server Components and Client Components
  • OpenFeature compatible: Standard feature flag API through OpenFeature provider
  • Background sync: Flag rules and logging sync with Confidence in the background
  • High reliability: No network dependency at evaluation time

Installation

Requirements: Node.js 18+ with WebAssembly support.

Setup

1. Configure the provider

Create a file to initialize the Confidence provider:

2. Add the provider to your layout

Wrap your application with the ConfidenceProvider:

Usage

Server Components

Use the getFlag function in React Server Components:

Client Components

Use the useFlag hook in Client Components:

Resources

GitHub repository

Source code and examples

OpenFeature JS SDK

OpenFeature documentation

Context

Configure evaluation context

Apply events

Understand flag assignment tracking