Skip to main content

Quick Navigation

Installation

Basic Setup

1. Provider Setup

In your root layout.tsx:

2. Middleware Setup

In your middleware.ts:

Server-Side Features

The @rownd/next/server package provides server-side authentication utilities:

Server-Side Functions

Example Usage

Client-Side Features

The client-side features mirror the React SDK functionality but must be used within client components:

The useRownd Hook

The useRownd hook provides comprehensive authentication and user management functionality:

State Properties

Authentication Methods

User Data Methods

Additional Features

Example Usage

Authentication Flow

Combined Server/Client Authentication

Protected Routes

Server-Side Protection

Component-Level Protection

Data Access

Server-Side Data Access

Client-Side Data Access

Best Practices

  1. Server/Client Separation
  2. Efficient Token Handling
  3. Error Boundaries

Type Definitions

Core Types

Server-Side Types

Client-Side Types

TypeScript Examples

Server-Side Example

Client-Side Example

Combined Server/Client Example

Examples

Full Authentication Flow

For more examples and detailed client-side features, refer to the React SDK documentation.