Installation
AppKit has support for Wagmi and Ethers v6 on Ethereum, @solana/web3.js on Solana and Bitcoin. Choose one of these to get started.
These steps are specific to Next.js app router. For other React frameworks read the React documentation.
Installation
If you prefer referring to a video tutorial for this, please click here.
AppKit CLI
Reown offers a dedicated CLI to set up a minimal version of AppKit in the easiest and quickest way possible.
To do this, please run the command below.
After running the command, you will be prompted to confirm the installation of the CLI. Upon your confirmation, the CLI will request the following details:
- Project Name: Enter the name for your project.
- Framework: Select your preferred framework or library. Currently, you have three options: React, Next.js, and Vue.
- Network-Specific libraries: Choose whether you want to install Wagmi, Ethers, Solana, or Multichain (EVM + Solana).
After providing the project name and selecting your preferences, the CLI will install a minimal example of AppKit with your preferred blockchain library. The example will be pre-configured with a projectId
that will only work on localhost
.
To fully configure your project, please obtain a projectId
from the Reown Cloud Dashboard and update your project accordingly.
Refer to this section for more information.
Custom Installation
Cloud Configuration
Create a new project on Reown Cloud at https://cloud.reown.com and obtain a new project ID.
Implementation
wagmi Example
Check the Next wagmi example
For a quick integration, you can use the createAppKit
function with a unified configuration. This automatically applies the predefined configurations for different adapters like Wagmi, Ethers, or Solana, so you no longer need to manually configure each one individually. Simply pass the common parameters such as projectId, chains, metadata, etc., and the function will handle the adapter-specific configurations under the hood.
This includes WalletConnect, Coinbase and Injected connectors, and the Blockchain API as a transport
Wagmi config
Create a new file for your Wagmi configuration, since we are going to be calling this function on the client and the server it cannot live inside a file with the ‘use client’ directive.
For this example we will create a file called config/index.tsx
outside our app directory and set up the following configuration
Importing networks
Reown AppKit use Viem networks under the hood, which provide a wide variety of networks for EVM chains. You can find all the networks supported by Viem within the @reown/appkit/networks
path.
Looking to add a custom network? Check out the custom networks section.
SSR and Hydration
:::info
- Using cookies is completely optional and by default Wagmi will use
localStorage
instead if thestorage
param is not defined. - The
ssr
flag will delay the hydration of the Wagmi’s store to avoid hydration mismatch errors. - AppKit don’t fully support the
ssr
flag. :::
Context Provider
Let’s create now a context provider that will wrap our application and initialized AppKit (createAppKit
needs to be called inside a Next Client Component file).
In this example we will create a file called context/index.tsx
outside our app directory and set up the following configuration
Layout
Next, in our app/layout.tsx
file, we will import our ContextProvider
component and call the Wagmi’s function cookieToInitialState
.
The initialState
returned by cookieToInitialState
, contains the optimistic values that will populate the Wagmi’s store both on the server and client.
wagmi Example
Check the Next wagmi example
For a quick integration, you can use the createAppKit
function with a unified configuration. This automatically applies the predefined configurations for different adapters like Wagmi, Ethers, or Solana, so you no longer need to manually configure each one individually. Simply pass the common parameters such as projectId, chains, metadata, etc., and the function will handle the adapter-specific configurations under the hood.
This includes WalletConnect, Coinbase and Injected connectors, and the Blockchain API as a transport
Wagmi config
Create a new file for your Wagmi configuration, since we are going to be calling this function on the client and the server it cannot live inside a file with the ‘use client’ directive.
For this example we will create a file called config/index.tsx
outside our app directory and set up the following configuration
Importing networks
Reown AppKit use Viem networks under the hood, which provide a wide variety of networks for EVM chains. You can find all the networks supported by Viem within the @reown/appkit/networks
path.
Looking to add a custom network? Check out the custom networks section.
SSR and Hydration
:::info
- Using cookies is completely optional and by default Wagmi will use
localStorage
instead if thestorage
param is not defined. - The
ssr
flag will delay the hydration of the Wagmi’s store to avoid hydration mismatch errors. - AppKit don’t fully support the
ssr
flag. :::
Context Provider
Let’s create now a context provider that will wrap our application and initialized AppKit (createAppKit
needs to be called inside a Next Client Component file).
In this example we will create a file called context/index.tsx
outside our app directory and set up the following configuration
Layout
Next, in our app/layout.tsx
file, we will import our ContextProvider
component and call the Wagmi’s function cookieToInitialState
.
The initialState
returned by cookieToInitialState
, contains the optimistic values that will populate the Wagmi’s store both on the server and client.
In this example we will create a new file called context/appkit.tsx
outside our app directory and set up the following configuration
Next, in your app/layout.tsx
or app/layout.jsx
file, import the custom AppKit component.
Make sure that the url
from the metadata
matches your domain and subdomain. This will later be used by the Verify API to tell wallets if your application has been verified or not.
ethers Example
Check the Next ethers example
In this example we will create a new file called context/appkit.tsx
outside our app directory and set up the following configuration
Next, in your app/layout.tsx
or app/layout.jsx
file, import the custom AppKit component.
Make sure that the url
from the metadata
matches your domain and subdomain. This will later be used by the Verify API to tell wallets if your application has been verified or not.
Solana Example
Check the Next Solana example
AppKit Solana provides a set of React components and hooks to easily connect Solana wallets with your application.
On top of your app set up the following configuration, making sure that all functions are called outside any React component to avoid unwanted rerenders.
Bitcoin Example
Check the Next Bitcoin example
AppKit Bitcoin provides a set of React components and hooks to easily connect Bitcoin wallets with your application.
On top of your app set up the following configuration, making sure that all functions are called outside any React component to avoid unwanted rerenders.
Bitcoin Provider Interface
Parameters
Responses
Trigger the modal
To open AppKit you can use our web component or build your own button with AppKit hooks.
In this example we are going to use the <appkit-button>
component.
Web components are global html elements that don’t require importing.
Learn more about the AppKit web components here
To open AppKit you can use our web component or build your own button with AppKit hooks.
In this example we are going to use the <appkit-button>
component.
Web components are global html elements that don’t require importing.
Learn more about the AppKit web components here
To open AppKit you can use our web component or build your own button with AppKit hooks.
Learn more about the AppKit web components here
Web components are global html elements that don’t require importing.
To open AppKit you can use our web component or build your own button with AppKit hooks.
Learn more about the AppKit web components here
Web components are global html elements that don’t require importing.
To open AppKit you can use our default web components or build your own logic using AppKit hooks.
Learn more about the AppKit web components here
Web components are global html elements that don’t require importing.
To open AppKit you can use our default web components or build your own logic using AppKit hooks.
In this example we are going to use the <appkit-button>
component.
Web components are global html elements that don’t require importing.
Smart Contract Interaction
Wagmi hooks can help us interact with wallets and smart contracts:
Read more about Wagmi hooks for smart contract interaction here.
Wagmi hooks can help us interact with wallets and smart contracts:
Read more about Wagmi hooks for smart contract interaction here.
Ethers can help us interact with wallets and smart contracts:
@Solana/web3.js library allows for seamless interaction with wallets and smart contracts on the Solana blockchain.
For a practical example of how it works, you can refer to our lab dApp.
Extra configuration
Next.js relies on SSR. This means some specific steps are required to make AppKit work properly.
- Add the following code in the
next.config.js
file
Video Tutorial
Was this page helpful?