Skip to main content
Environment variables control the behavior of the YouTube Automation Agent. Configure them in a .env file in the project root.

Setup

1

Copy Example File

cp .env.example .env
2

Edit Configuration

Open .env in your text editor and fill in the required values.
3

Verify Settings

npm run setup

Required Variables

These variables must be set for the system to function:

OpenAI Configuration

OPENAI_API_KEY=sk-proj-...
Required for content generation, DALL-E image creation, and text-to-speech features.
Get your key from OpenAI Platform.

Application Settings

Control the core behavior of the application:

Node Environment

NODE_ENV=production
  • development - Enables verbose logging and debug features
  • production - Optimized for deployment
  • test - For running tests

Server Port

PORT=3456
The port where the web interface will be accessible. Default: 3456

Logging Level

LOG_LEVEL=info
  • error - Only errors
  • warn - Warnings and errors
  • info - General information (recommended)
  • debug - Detailed debugging information
  • verbose - Everything including API calls

Channel Settings

Configure your YouTube channel identity:
CHANNEL_NAME=Your Channel Name
DEFAULT_AUTHOR=Your Name
TARGET_AUDIENCE=Your target audience description
Examples:
CHANNEL_NAME=Tech Explainers
DEFAULT_AUTHOR=Alex Johnson
TARGET_AUDIENCE=Tech enthusiasts aged 18-35 interested in AI and automation

YouTube Settings

Control YouTube-specific behavior:

Region

YOUTUBE_REGION=US
Two-letter country code for content trending and recommendations.
  • US - United States
  • GB - United Kingdom
  • CA - Canada
  • AU - Australia
  • IN - India
  • DE - Germany
  • FR - France
  • JP - Japan

Default Privacy Status

DEFAULT_PRIVACY_STATUS=public
Videos are visible to everyone and appear in search results and recommendations.

Content Settings

Control how content is processed and formatted:
AUTO_SHORTEN_CONTENT=true
AUTO_ADD_BACKLINKS=true
PRESERVE_FORMATTING=true
AUTO_RESIZE_IMAGES=true
MAX_IMAGE_WIDTH=1280
MAX_IMAGE_HEIGHT=720
IMAGE_QUALITY=90

Content Processing

VariableTypeDefaultDescription
AUTO_SHORTEN_CONTENTbooleantrueAutomatically trim content to optimal length
AUTO_ADD_BACKLINKSbooleantrueAdd channel links in video descriptions
PRESERVE_FORMATTINGbooleantrueMaintain original text formatting

Image Processing

VariableTypeDefaultDescription
AUTO_RESIZE_IMAGESbooleantrueAutomatically resize images to optimal dimensions
MAX_IMAGE_WIDTHnumber1280Maximum image width in pixels
MAX_IMAGE_HEIGHTnumber720Maximum image height in pixels
IMAGE_QUALITYnumber90JPEG quality (1-100)

Rate Limiting

Prevent API quota exhaustion:
GLOBAL_RATE_LIMIT_PER_HOUR=50
DEFAULT_DELAY_BETWEEN_POSTS=60000
YouTube API has strict quota limits. Exceeding them will result in temporary suspension of API access.
VariableTypeDefaultDescription
GLOBAL_RATE_LIMIT_PER_HOURnumber50Maximum API requests per hour
DEFAULT_DELAY_BETWEEN_POSTSnumber60000Delay between operations in milliseconds

Text-to-Speech Settings

TTS_VOICE=en-US-JennyNeural
Female Voices:
  • en-US-JennyNeural - Friendly, professional
  • en-US-AriaNeural - Clear, expressive
  • en-US-AmberNeural - Warm, conversational
Male Voices:
  • en-US-GuyNeural - Professional, authoritative
  • en-US-DavisNeural - Clear, trustworthy
  • en-US-TonyNeural - News-style delivery

Security

JWT_SECRET=generate-a-random-secret-here
Generate a strong, random secret for JWT token signing. Never use the default value in production.
Generate a secure secret:
node -e "console.log(require('crypto').randomBytes(64).toString('hex'))"

Analytics & Monitoring

ENABLE_ANALYTICS=true
ANALYTICS_DB_PATH=./data/analytics.db
VariableTypeDefaultDescription
ENABLE_ANALYTICSbooleantrueTrack video performance metrics
ANALYTICS_DB_PATHstring./data/analytics.dbSQLite database location

File Upload Settings

MAX_FILE_SIZE=52428800
UPLOAD_PATH=./uploads
VariableTypeDefaultDescription
MAX_FILE_SIZEnumber52428800Maximum upload size in bytes (50MB)
UPLOAD_PATHstring./uploadsDirectory for uploaded files
YouTube supports videos up to 256GB, but initial uploads are limited to 15 minutes (or 128GB for verified accounts).

Error Handling

RETRY_ATTEMPTS=3
RETRY_DELAY=5000
VariableTypeDefaultDescription
RETRY_ATTEMPTSnumber3Number of retry attempts for failed operations
RETRY_DELAYnumber5000Delay between retries in milliseconds

Automation Settings

These are generated by the setup script but can be manually configured:
DAILY_CONTENT_ENABLED=true
AUTO_PUBLISH_ENABLED=true
OPTIMIZATION_ENABLED=true
CONTENT_BUFFER_DAYS=3
MAX_DAILY_POSTS=1
DAILY_CONTENT_ENABLEDEnable daily content generation pipeline.CONTENT_BUFFER_DAYSNumber of days of content to keep in the buffer (queue).MAX_DAILY_POSTSMaximum number of videos to publish per day.

Notification Settings

NOTIFICATION_ENABLED=true
Enable console notifications for important events (uploads, errors, milestones).

Debug Settings

DEBUG_MODE=false
VERBOSE_LOGGING=false
SAVE_SCREENSHOTS=false
SCREENSHOT_PATH=./debug/screenshots
Only enable debug settings during development. They generate large log files and slow down the system.
VariableTypeDefaultDescription
DEBUG_MODEbooleanfalseEnable detailed debugging
VERBOSE_LOGGINGbooleanfalseLog all API requests/responses
SAVE_SCREENSHOTSbooleanfalseSave screenshots during video generation
SCREENSHOT_PATHstring./debug/screenshotsScreenshot storage location

Optional API Keys

These can be set as environment variables instead of in credentials.json:
# ElevenLabs (Premium TTS)
ELEVENLABS_API_KEY=your_api_key
ELEVENLABS_VOICE_ID=your_voice_id

# Azure Speech Services
AZURE_SPEECH_KEY=your_subscription_key
AZURE_SPEECH_REGION=eastus

# Replicate (Advanced Video Generation)
REPLICATE_API_KEY=r8_...

# Google Gemini
GEMINI_API_KEY=your_gemini_key

Example Complete Configuration

# YouTube Automation Agent Environment Configuration

# Required
OPENAI_API_KEY=sk-proj-abc123...

# Application
NODE_ENV=production
PORT=3456
LOG_LEVEL=info

# Channel
CHANNEL_NAME=AI Tech Stories
DEFAULT_AUTHOR=Sarah Chen
TARGET_AUDIENCE=Tech enthusiasts interested in AI and automation

# YouTube
YOUTUBE_REGION=US
DEFAULT_PRIVACY_STATUS=public

# Content
AUTO_SHORTEN_CONTENT=true
AUTO_ADD_BACKLINKS=true
PRESERVE_FORMATTING=true
AUTO_RESIZE_IMAGES=true
MAX_IMAGE_WIDTH=1280
MAX_IMAGE_HEIGHT=720
IMAGE_QUALITY=90

# Rate Limiting
GLOBAL_RATE_LIMIT_PER_HOUR=50
DEFAULT_DELAY_BETWEEN_POSTS=60000

# TTS
TTS_VOICE=en-US-JennyNeural

# Security
JWT_SECRET=a1b2c3d4e5f6...

# Analytics
ENABLE_ANALYTICS=true
ANALYTICS_DB_PATH=./data/analytics.db

# Files
MAX_FILE_SIZE=52428800
UPLOAD_PATH=./uploads

# Error Handling
RETRY_ATTEMPTS=3
RETRY_DELAY=5000

# Automation
DAILY_CONTENT_ENABLED=true
AUTO_PUBLISH_ENABLED=true
OPTIMIZATION_ENABLED=true
CONTENT_BUFFER_DAYS=3
MAX_DAILY_POSTS=1

# Notifications
NOTIFICATION_ENABLED=true

# Debug (Development only)
DEBUG_MODE=false
VERBOSE_LOGGING=false

Next Steps

AI Providers

Configure OpenAI, Gemini, and other AI services

YouTube Setup

Complete YouTube API configuration and authentication