Frontend

A common pattern for the SDK is to use it in a frontend application. This guide will walk you through the steps to integrate the SDK with a frontend application.

Next.JS

Next.JS is a popular frontend framework that allows you to build server-rendered React applications. It is a great choice for building a frontend application that uses the SDK.

1. Setup

Create a new Next.JS application using the create-next-app command (Typescript is recommended).

npx create-next-app@latest --typescript
# or
yarn create next-app --typescript
# or
pnpm create next-app --typescript

Follow the instructions to create a new Next.JS application.

2. Install the SDK

Install the SDK using your package manager of choice.

npm install @connext/sdk

3. Configure Next.JS

The Connext SDK contains some dependencies that must be polyfilled to work on client-side applications. At minimum, your next.config.js file should contain the following configuration:

Now you are ready to use the SDK in your Next.JS application!

For example:

Create React App (CRA)

React is a popular frontend framework that allows you to build client-rendered React applications. However, CRA is at end of life and the React team recommends other frameworks instead.

We highly recommend using NextJS for easier integration. If, however, you still want to use CRA for your project then you should follow these steps.

1. Setup

Create a new CRA using the create-react-app command.

2. Install the SDK

Install the SDK using your package manager of choice.

3. Configure CRA

  1. Install necessary dependencies

  1. Create a craco.config.js in your project root with the following contents.

  1. Change scripts in package.json to use craco commands instead of react-scripts.

Last updated