Installation
Get started with DaisyChain by following these installation steps. We'll guide you through setting up the SDK and configuring your environment.
Prerequisites
- Node.js 18.0.0 or higher
- npm, yarn, or pnpm package manager
- A DaisyChain account (sign up here)
Installation Steps
1. Install the Package
Install the DaisyChain SDK using your preferred package manager:
npm install @daisychain/sdk @daisychain/react
yarn add @daisychain/sdk @daisychain/react
pnpm add @daisychain/sdk @daisychain/react
2. Configure Environment Variables
Create a .env.local
file in your project root and add your DaisyChain API keys:
NEXT_PUBLIC_DAISYCHAIN_PUBLIC_KEY=pk_... DAISYCHAIN_SECRET_KEY=sk_... NEXT_PUBLIC_APP_URL=http://localhost:3000
Note: Never commit your secret key to version control. Add .env.local
to your .gitignore
file.
3. Initialize the SDK
Create a new file lib/daisychain.ts
to initialize the SDK:
import { DaisyChain } from '@daisychain/sdk'; export const daisychain = new DaisyChain({ publicKey: process.env.NEXT_PUBLIC_DAISYCHAIN_PUBLIC_KEY!, secretKey: process.env.DAISYCHAIN_SECRET_KEY });
4. Add the Provider
Wrap your application with the DaisyChain provider in your root layout:
import { DaisyChainProvider } from '@daisychain/react'; import { daisychain } from '@/lib/daisychain'; export default function RootLayout({ children, }: { children: React.ReactNode; }) { return ( <DaisyChainProvider client={daisychain}> {children} </DaisyChainProvider> ); }
Next Steps
- Quick Start Guide - Create your first referral program
- SDK Configuration - Learn about advanced configuration options
- Next.js + Stripe Integration - Complete integration guide
Need Help?
If you run into any issues during installation, check out our Troubleshooting Guide or contact our support team.