Skip to main content
Get started with MoonKey in your React or Next.js application by installing the React SDK.

Requirements

Before installing the MoonKey React SDK, ensure your project meets these requirements:
  • React 18 or higher — The SDK uses modern React features including hooks and concurrent rendering
  • TypeScript 5 or higher — For TypeScript projects (recommended but optional)

Install the SDK

Add the MoonKey React SDK to your project using your preferred package manager:
npm install @moon-key/react-auth@latest

Additional dependencies

Solana support

If your application needs to support Solana wallets and transactions, install the Solana Web3.js library:
npm install @solana/web3.js
Solana dependencies are only required if you plan to create Solana wallets or execute Solana transactions. EVM-only applications can skip this step.

Next.js configuration

If you’re using Next.js with webpack (not Turbopack), you may need to add polyfills for Node.js modules. Add the following to your next.config.js:
next.config.js
module.exports = {
  webpack: (config, { isServer }) => {
    if (!isServer) {
      config.resolve.fallback = {
        ...config.resolve.fallback,
        fs: false,
        net: false,
        tls: false,
      };
    }
    return config;
  },
};
Next.js 13+ with Turbopack handles these polyfills automatically. This configuration is only needed for webpack-based builds.

Verify installation

After installation, verify the SDK is working by importing it in your code:
import { MoonKeyProvider } from '@moon-key/react-auth';
If the import succeeds without errors, the SDK is installed correctly and you’re ready to configure it.

Next steps

Now that you’ve installed the MoonKey React SDK, continue to: