Skip to main content
Create a .env file in the root directory. Use .env.example as a starting point.

Required Variables

# Application
NODE_ENV="development"
NEXT_PUBLIC_BASE_URL=http://localhost:3000
PORT=3000

# Database
MONGODB_URI="mongodb+srv://username:password@cluster.mongodb.net/SignalisticsDB?retryWrites=true&w=majority"

# Authentication
BETTER_AUTH_SECRET="generate_with_openssl_rand_base64_32"
BETTER_AUTH_URL=http://localhost:3000

# Email (Gmail SMTP)
NODEMAILER_EMAIL="your_email@gmail.com"
NODEMAILER_PASSWORD="your_gmail_app_password"

# Stock Market API
NEXT_PUBLIC_FINNHUB_API_KEY="your_finnhub_api_key"

Optional Variables

# AI Features
GEMINI_API_KEY="your_gemini_api_key"

# Event Processing
INNGEST_EVENT_KEY="your_inngest_key"

Getting API Keys

  1. Sign up at finnhub.io
  2. Get your free API key from the dashboard
  3. Set it as NEXT_PUBLIC_FINNHUB_API_KEY
  1. Enable 2-Factor Authentication on your Gmail account
  2. Go to Google App Passwords
  3. Generate a new app password for “Mail”
  4. Use this password as NODEMAILER_PASSWORD
Generate a secure secret:
openssl rand -base64 32
Set the output as BETTER_AUTH_SECRET.

Environment-Specific Behavior

When NODE_ENV=development:
  • Email verification is disabled (auto sign-in after signup)
  • Verification and reset URLs are logged to console
  • Uses NEXT_PUBLIC_BASE_URL as the base URL

MongoDB URI

The MONGODB_URI must include the database name in the connection string. Without it, data defaults to the test database.
# Correct
mongodb+srv://user:pass@cluster.mongodb.net/SignalisticsDB?retryWrites=true&w=majority

# Wrong (defaults to 'test' database)
mongodb+srv://user:pass@cluster.mongodb.net/?retryWrites=true&w=majority