Overview
Deriverse uses environment variables to configure blockchain connections, database access, and feature flags. All sensitive configuration should be stored in a.env.local file that is never committed to version control.
Setup Instructions
Required Variables
These environment variables are required for Deriverse to function properly:Supabase Configuration
Your Supabase project URL.How to get it:
- Go to your Supabase Dashboard
- Select your project
- Go to Settings → API
- Copy the “Project URL”
Your Supabase anonymous (public) API key.How to get it:
- Go to your Supabase Dashboard
- Select your project
- Go to Settings → API
- Copy the “anon public” key
Solana Network Configuration
Solana RPC endpoint URL for blockchain interactions.Available options:
- Devnet (Development)
- Mainnet (Production)
Use Solana’s public devnet endpoint:Recommended for: Local development and testing
Optional Variables
These variables are optional and enable additional features:Deriverse Program Configuration
The Solana program ID for Deriverse smart contract integration.Default:
Drvrseg8AQLP8B96DBGmHRjFGviFNYTkHueY9g3k27Gu (devnet)When to use: Only needed if you’re deploying a custom Deriverse program or using a different network.Example:The version of the Deriverse protocol to use.Default:
12Example:Advanced RPC Configuration
Custom Helius RPC endpoint with API key.When to use: If you have a Helius API key for better rate limits and reliability.Example:
Override the devnet RPC endpoint.Default: Falls back to
NEXT_PUBLIC_HELIUS_RPC_URL or Helius public devnet.Example:Override the mainnet RPC endpoint.Default:
https://api.mainnet-beta.solana.comExample:Set the default wallet cluster.Values:
devnet(default)mainnet-beta
Application Configuration
The base URL for your application.Default:
https://deriverse.appWhen to use: For generating absolute URLs, share links, or Open Graph metadata.Example:Node Environment
Specifies the Node.js environment.Values:
development- Local development (default)production- Production deploymenttest- Testing environment
Next.js automatically sets this during build. You typically don’t need to set this manually.
Complete Example
Here’s a complete.env.local example for local development:
.env.local
Environment Variable Naming
Variables prefixed with
NEXT_PUBLIC_ are exposed to the browser. All other variables are server-side only.- Must start with
NEXT_PUBLIC_ - Accessible in React components
- Embedded in the JavaScript bundle
- Example:
NEXT_PUBLIC_SUPABASE_URL
- No special prefix required
- Only accessible in API routes and server components
- Never exposed to the browser
- Example:
DATABASE_URL
Production Configuration
For production deployments (Vercel, etc.):Set environment variables in your hosting platform
Add all required variables through your platform’s dashboard:
- Vercel: Project Settings → Environment Variables
- Netlify: Site Settings → Environment Variables
Troubleshooting
Environment variables not loading
Environment variables not loading
Possible causes:
-
Server not restarted: Environment variables are loaded at startup. Restart your dev server:
-
Wrong file location: Ensure
.env.localis in the project root, not insrc/or other subdirectories. -
Syntax errors: Check for:
- Spaces around
=(should beKEY=value, notKEY = value) - Missing quotes for values with spaces
- Comments on the same line
- Spaces around
-
Missing
NEXT_PUBLIC_prefix: Client-side variables must have this prefix.
Supabase connection fails
Supabase connection fails
Verify your configuration:
-
Check URL format:
-
Verify anon key: The key should be a long JWT token starting with
eyJ. - Check Supabase project status: Ensure your project is active in the Supabase dashboard.
- Network access: Some Supabase projects require IP whitelisting.
RPC connection errors
RPC connection errors
Common issues:
Security Best Practices
Never Commit Secrets
Add
.env.local to .gitignore to prevent accidentally committing secrets.Use Different Keys
Use separate Supabase projects and keys for development, staging, and production.
Rotate Keys Regularly
Periodically rotate API keys and update them in your environment configuration.
Limit Permissions
Use Supabase RLS policies to restrict data access based on user authentication.
Next Steps
Local Setup
Complete your local development setup
Architecture
Understand how Deriverse components interact
Database Schema
Learn about Supabase database schema
Contributing
Start contributing to Deriverse
