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:
- 1Visit basescan.org/apis
- 2Create a free account
- 3Generate an API key
- 4Add it to your `.env.local` file
bash
NEXT_PUBLIC_BASESCAN_API_KEY=your_basescan_api_key_hereAlchemy API
Required - Provides RPC endpoint for blockchain interactions.
How to get it:
- 1Visit alchemy.com
- 2Create a free account
- 3Create a new app for "Base Mainnet"
- 4Copy the API key
bash
NEXT_PUBLIC_ALCHEMY_API_KEY=your_alchemy_api_key_hereWalletConnect Project ID
Required - Enables wallet connection via WalletConnect protocol.
How to get it:
- 1Visit cloud.reown.com
- 2Sign up and create a new project
- 3Copy the Project ID
bash
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID=your_project_id_hereOptional API Keys
These APIs enhance the platform but are not required for basic functionality:
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_keyFor detailed setup instructions, see ENV_SETUP.md