Skip to main content
This guide shows how to integrate BlackSwan into a Next.js project using the App Router. The recommended pattern keeps SDK calls on the server inside an API route and uses a lightweight client component to fetch and display the data in the browser.

Install

Shared Client

Create a reusable client module so both your API routes and any server components can share the same instance:

API Route

The API route runs on the server and is the single place your application calls the BlackSwan SDK. It accepts a wallet query parameter and returns the credit dashboard as JSON:

Client Component

The client component calls the API route from the browser and renders the result. Mark it with "use client" so Next.js keeps it out of the server bundle:

Page

Compose the client component inside a server page. Pass the wallet address however your application resolves it — from session, from URL params, or from a form: