Environment Variables Setup
Environment Configuration: Set up all required environment variables for LogoAIpro v1.0. This includes database connections, API keys, and service configurations.
Complete .env.local Template
Security Note: Never commit your
.env.local file to version control. Add it to your .gitignore file to keep your secrets safe.
# ===========================================
# LogoAIpro v1.0 - Environment Variables
# ===========================================
# Create .env.local in project root (Next.js automatically loads it)
# ===========================================
# FRONTEND CONFIGURATION (Public Variables)
# ===========================================
# Clerk Authentication (Public Key)
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_xxxxxxxxxxxxx
# Stripe Payment (Public Key)
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_xxxxxxxxxxxxx
# Application URL
NEXT_PUBLIC_APP_URL=http://localhost:3000
# Production: NEXT_PUBLIC_APP_URL=https://yourdomain.com
# Development URL (for local development)
NEXT_PUBLIC_DEVELOPMENT_URL=http://localhost:3000
# ===========================================
# DATABASE CONFIGURATION
# ===========================================
# MongoDB Connection (Required)
DATABASE_URL=mongodb+srv://username:password@cluster.mongodb.net/logoai-pro?retryWrites=true&w=majority
# Alternative variable name:
# MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/logoai-pro?retryWrites=true&w=majority
# ===========================================
# AUTHENTICATION (CLERK)
# ===========================================
# Clerk Secret Key (Required)
CLERK_SECRET_KEY=sk_test_xxxxxxxxxxxxx
# Clerk Webhook Secret (Required for webhooks)
CLERK_WEBHOOK_SECRET=whsec_xxxxxxxxxxxxx
# Clerk Redirect URLs
NEXT_PUBLIC_CLERK_SIGN_IN_FORCE_REDIRECT_URL=/dashboard
NEXT_PUBLIC_CLERK_SIGN_UP_FORCE_REDIRECT_URL=/dashboard
# ===========================================
# AI PROVIDERS (Nebius AI)
# ===========================================
# Nebius AI API Key (Required)
NEBIUS_API_KEY=your-nebius-api-key
# Helicone API Key (Optional - for observability)
HELICONE_API_KEY=your-helicone-api-key
# ===========================================
# PAYMENT PROCESSING (STRIPE)
# ===========================================
# Stripe Secret Key (Required)
STRIPE_SECRET_KEY=sk_test_xxxxxxxxxxxxx
# Stripe Webhook Secret (Required for webhooks)
STRIPE_WEBHOOK_SECRET=whsec_xxxxxxxxxxxxx
# Stripe Price IDs for Credit Packages
STRIPE_PRICE_ID_BASIC=price_xxxxxxxxxxxxx
STRIPE_PRICE_ID_PRO=price_xxxxxxxxxxxxx
STRIPE_PRICE_ID_ENTERPRISE=price_xxxxxxxxxxxxx
# ===========================================
# RATE LIMITING (Upstash Redis)
# ===========================================
# Upstash Redis REST URL (Required)
UPSTASH_REDIS_REST_URL=https://your-redis-instance.upstash.io
# Upstash Redis REST Token (Required)
UPSTASH_REDIS_REST_TOKEN=your-upstash-redis-token
# ===========================================
# ANALYTICS & MONITORING (Optional)
# ===========================================
# Umami Analytics (Optional)
# NEXT_PUBLIC_UMAMI_WEBSITE_ID=your-umami-website-id
# NEXT_PUBLIC_UMAMI_SCRIPT_URL=https://analytics.yourdomain.com/script.js
# ===========================================
# VERCEL DEPLOYMENT (Automatic)
# ===========================================
# Vercel Analytics and other features are automatic if deployed on Vercel
# No configuration needed
Environment Variable Details
Authentication (Clerk)
| Variable | Description | Required |
|---|---|---|
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY |
Public key from Clerk Dashboard → API Keys | Yes |
CLERK_SECRET_KEY |
Secret key from Clerk Dashboard → API Keys | Yes |
CLERK_WEBHOOK_SECRET |
Webhook secret from Clerk Dashboard → Webhooks | Yes |
NEXT_PUBLIC_CLERK_SIGN_IN_FORCE_REDIRECT_URL |
Redirect URL after sign in (default: /dashboard) | Optional |
NEXT_PUBLIC_CLERK_SIGN_UP_FORCE_REDIRECT_URL |
Redirect URL after sign up (default: /dashboard) | Optional |
AI Processing (Nebius AI)
| Variable | Description | Required |
|---|---|---|
NEBIUS_API_KEY |
API key from Nebius AI Studio | Yes |
HELICONE_API_KEY |
Helicone API key for AI request monitoring (optional) | Optional |
Payments (Stripe)
| Variable | Description | Required |
|---|---|---|
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY |
Publishable key from Stripe Dashboard → Developers → API keys | Yes |
STRIPE_SECRET_KEY |
Secret key from Stripe Dashboard → Developers → API keys | Yes |
STRIPE_WEBHOOK_SECRET |
Webhook secret from Stripe Dashboard → Developers → Webhooks | Yes |
STRIPE_PRICE_ID_BASIC |
Stripe Price ID for Basic plan (50 credits) | Yes |
STRIPE_PRICE_ID_PRO |
Stripe Price ID for Pro plan (150 credits) | Yes |
STRIPE_PRICE_ID_ENTERPRISE |
Stripe Price ID for Enterprise plan (500 credits) | Yes |
Database (MongoDB)
| Variable | Description | Required |
|---|---|---|
DATABASE_URL |
MongoDB connection string from Atlas or local instance | Yes |
MONGODB_URI |
Alternative variable name (same as DATABASE_URL) | If DATABASE_URL not set |
Rate Limiting (Upstash Redis)
| Variable | Description | Required |
|---|---|---|
UPSTASH_REDIS_REST_URL |
Upstash Redis REST API URL | Yes |
UPSTASH_REDIS_REST_TOKEN |
Upstash Redis REST API token | Yes |
Setup Instructions
Step 1: Create .env.local File
- In your project root, create a new file named
.env.local - Copy the template above into the file
- Replace all placeholder values with your actual keys
Step 2: Get Required API Keys
Follow these guides to get your API keys:
- Clerk Authentication Setup - For authentication keys
- Nebius AI Setup - For AI logo generation API key
- Stripe Payment Setup - For payment processing keys
- MongoDB Database Setup - For database connection string
Step 3: Configure Upstash Redis
- Create an Upstash account at upstash.com
- Create a new Redis database
- Copy the REST URL and REST Token
- Add credentials to
.env.local
Step 4: Verify Configuration
- Start the development server:
npm run dev - Check console for any missing environment variable warnings
- Test authentication by trying to sign up/login
- Test logo generation to ensure Nebius AI is working
Important Notes:
- Development vs Production: Use test keys for development and production keys for deployment
- Variable Names: Variables prefixed with
NEXT_PUBLIC_are exposed to the browser - Security: Never commit
.env.localto version control - Restart Server: Always restart your dev server after changing environment variables
Production Deployment
For production deployments, set these variables in your hosting platform:
Vercel
- Go to Project Settings → Environment Variables
- Add each variable individually
- Select appropriate environment (Production, Preview, Development)
- Update
NEXT_PUBLIC_APP_URLto your production domain - Use production API keys (not test keys)
- Redeploy your application
AWS EC2
- Create a
.envfile on your server - Copy all variables from
.env.local - Update
NEXT_PUBLIC_APP_URLto your production domain - Use production API keys (not test keys)
Next Steps: Once your environment variables are configured, proceed to: