API Setup

Configure API keys for full platform functionality

API Keys Overview

OnChain Clinic uses several external services to provide its features. Some API keys are required, while others are optional.

Required

  • • BaseScan API
  • • Alchemy API
  • • WalletConnect Project ID

Optional

  • • Pinata API (for profiles)
  • • Neynar API (Farcaster)
  • • OpenSea API

BaseScan API

Required - Used for fetching transaction history and contract verification.

How to get it:

  1. 1Visit basescan.org/apis
  2. 2Create a free account
  3. 3Generate an API key
  4. 4Add it to your `.env.local` file
bash
NEXT_PUBLIC_BASESCAN_API_KEY=your_basescan_api_key_here

Alchemy API

Required - Provides RPC endpoint for blockchain interactions.

How to get it:

  1. 1Visit alchemy.com
  2. 2Create a free account
  3. 3Create a new app for "Base Mainnet"
  4. 4Copy the API key
bash
NEXT_PUBLIC_ALCHEMY_API_KEY=your_alchemy_api_key_here

WalletConnect Project ID

Required - Enables wallet connection via WalletConnect protocol.

How to get it:

  1. 1Visit cloud.reown.com
  2. 2Sign up and create a new project
  3. 3Copy the Project ID
bash
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID=your_project_id_here

Optional API Keys

These APIs enhance the platform but are not required for basic functionality:

Pinata API

Required for user profile storage and custom NFT metadata uploads

Get Pinata API Key →

Neynar API

Enables Farcaster username display in profiles

Get Neynar API Key →

API Security

Never commit API keys to Git! Always use `.env.local` file and add it to `.gitignore`

✅ Good Practices

  • • Store keys in `.env.local` file
  • • Use `NEXT_PUBLIC_` prefix for client-side keys
  • • Never share keys publicly
  • • Rotate keys if compromised

📝 Complete .env.local Example

bash
# Required API Keys
NEXT_PUBLIC_BASESCAN_API_KEY=your_basescan_api_key
NEXT_PUBLIC_ALCHEMY_API_KEY=your_alchemy_api_key
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID=your_walletconnect_project_id

# Optional API Keys
NEXT_PUBLIC_PINATA_JWT=your_pinata_jwt
NEXT_PUBLIC_PINATA_GATEWAY=your_gateway_url
NEXT_PUBLIC_NEYNAR_API_KEY=your_neynar_key

For detailed setup instructions, see ENV_SETUP.md