> ## Documentation Index
> Fetch the complete documentation index at: https://opensource.weam.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Environment Variables

> Complete environment variable configuration guide for Weam AI. Set up database connections, security keys, storage, and service URLs for local and production deployments.

<Info>
  This guide covers all environment variables for **Node.js API** and **Next.js frontend** components of Weam AI.
</Info>

## Service-Specific Variables

<AccordionGroup>
  <Accordion title="Node.js API Server Variables">
    Complete environment variables for the Node.js API backend service:

    ### Server Configuration

    ```env theme={null}
    SERVER_PORT=4050
    API_PREFIX=v1
    ```

    ### Service URLs

    ```env theme={null}
    FRONT_URL=http://localhost:3000
    BASE_URL=http://localhost:4050
    OPEN_AI_MODAL=gpt-4
    OPEN_AI_API_URL=https://api.openai.com
    GEMINI_API_URL=https://gemini.google.com
    ANTHROPIC_AI_API_URL=https://api.anthropic.com
    ```

    ### Model Provider API Keys

    ```env theme={null}
    Weam AI_OPEN_AI_KEY=sk-your-openai-key
    Weam AI_GEMINI_KEY=your-gemini-key
    Weam AI_OPEN_ROUTER_KEY=sk-or-your-openrouter-key
    HUGGING_FACE_AUTH_TOKEN=hf-your-token
    Weam AI_ANTHROPIC_API_KEY=sk-ant-your-key
    Weam AI_DEEPSEEK_KEY=sk-your-deepseek-key
    ```

    ### Authentication Settings

    ```env theme={null}
    JWT_SECRET=access-secret
    JWT_REFRESH_SECRET=refresh-secret
    JWT_ACCESS_EXPIRE=1h
    JWT_REFRESH_EXPIRE=7d
    QR_NAME=YourApp-name
    ```

    ### Storage Settings

    ```env theme={null}
    BUCKET_TYPE=MINIO
    AWS_ACCESS_KEY_ID=your-key
    AWS_SECRET_ACCESS_KEY=your-secret
    AWS_REGION=us-east-1
    AWS_S3_BUCKET=yourcompany-media
    AWS_S3_URL=https://s3.amazonaws.com
    AWS_CDN_URL=https://cdn.yourexampledomain.com
    MINIO_PORT=9000
    MINIO_DASHBOARD_PORT=9001
    MINIO_ENDPOINT=http://minio
    ```

    ### Email Configuration

    ```env theme={null}
    EMAIL_PROVIDER=SMTP
    AWS_SES_VERIFIED_MAIL=noreply@yourexampledomain.com
    SMTP_USER=user@example.com
    SMTP_PASSWORD=password123
    SMTP_SENDER_EMAIL=noreply@yourexampledomain.com
    SMTP_SERVER=smtp.gmail.com
    SMTP_PORT=587
    ```

    ### Additional Settings

    ```env theme={null}
    SECURITY_KEY=secure-key
    SIGNUP_INFO_EMAIL=welcome@yourexampledomain.com
    API_RATE_LIMIT=100
    SEED=42
    TZ=Asia/Kolkata
    ```

    ### SEO Agent Settings

    ```env theme={null}
    SEO_USER_ID=seo@yourexampledomain.com
    SEO_PASSWORD=securepassword
    ```
  </Accordion>

  <Accordion title="Next.js Frontend Variables">
    Complete environment variables for the Next.js frontend application:

    ### API Endpoints

    ```env theme={null}
    NEXT_PUBLIC_BACKEND_API_URL=http://localhost:4050
    NEXT_PUBLIC_DOMAIN_URL=http://localhost:3000
    NEXT_PUBLIC_API_PREFIX=/v1
    ```

    ### Application Settings

    ```env theme={null}
    NEXT_PUBLIC_APP_ENVIRONMENT=dev
    NEXT_PUBLIC_COOKIE_NAME=yourapp-token
    NEXT_PUBLIC_COOKIE_PASSWORD=encrypt-me
    NEXT_PUBLIC_HTTPS_PROTOCOL=false
    ```

    ### Asset Configuration

    ```env theme={null}
    NEXT_PUBLIC_AWS_S3_URL=https://cdn.yourexampledomain.com
    NEXT_PUBLIC_IMAGE_DOMAIN=cdn.yourexampledomain.com
    ```

    ### WebSocket Settings

    ```env theme={null}
    NEXT_PUBLIC_SOCKET_CONNECTION_URL=ws://localhost:3000
    ```

    ### Additional Frontend Settings

    ```env theme={null}
    NEXT_PUBLIC_SECURITY_KEY=secure-frontend-key
    NEW_RELIC_APPNAME=YourAppFrontend
    NEXT_PUBLIC_OPENAI_PLATFORM_URL=https://platform.openai.com
    ```
  </Accordion>
</AccordionGroup>

## Required Configuration

These environment variables must be configured for Weam AI to function properly.

### Database Settings

Configure MongoDB and Redis connections for data storage and caching:

```env theme={null}
# MongoDB Database
MONOGODB_URI=mongodb://localhost:27017
DB_DATABASE=yourappdb

# Redis Cache and Queues
REDIS_HOST=localhost
REDIS_PORT=6379
```

### Security Configuration

Generate and configure secure keys for authentication and encryption:

```env theme={null}
# JWT Authentication
JWT_SECRET=your-super-secure-jwt-secret-here
JWT_REFRESH_SECRET=your-super-secure-refresh-secret-here

# Application Security
SECURITY_KEY=your-16-byte-security-key
CSRF_TOKEN_SECRET=your-csrf-token-secret
```

**Generate secure keys:**

```bash theme={null}
# Using OpenSSL (recommended - available on all platforms)
openssl rand -hex 32

# Alternative: Using Node.js
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"

# Alternative: Using Python (if installed)
python -c "import secrets; print(secrets.token_urlsafe(32))"
```

### Service URLs

Configure service endpoints and domain settings:

```env theme={null}
# Frontend Application
NEXT_PUBLIC_DOMAIN_URL=http://localhost:3000
FRONT_URL=http://localhost:3000

# Backend Services
BASE_URL=http://localhost:4050
```

### File Storage Configuration

Choose between local MinIO storage or AWS S3 for file management:

<Tabs>
  <Tab title="Local Development (MinIO)">
    ```env theme={null}
    BUCKET_TYPE=MINIO
    MINIO_ENDPOINT=http://localhost:9000
    AWS_ACCESS_KEY_ID=minioadmin
    AWS_SECRET_ACCESS_KEY=minioadmin
    AWS_S3_BUCKET=yourapp-media
    ```

    **Benefits:**

    * No external dependencies
    * Free for development
    * Easy local testing
  </Tab>

  <Tab title="Production (AWS S3)">
    ```env theme={null}
    BUCKET_TYPE=AWS
    AWS_ACCESS_KEY_ID=your-aws-access-key
    AWS_SECRET_ACCESS_KEY=your-aws-secret-key
    AWS_REGION=us-east-1
    AWS_S3_BUCKET=your-s3-bucket-name
    ```

    **Benefits:**

    * Scalable cloud storage
    * Built-in CDN integration
    * Production reliability
  </Tab>
</Tabs>

### Vector Database Settings

Configure Qdrant for AI embeddings and vector search:

```env theme={null}
# Qdrant Vector Database
LOCAL_QDRANT_URL=http://localhost:6333
QDRANT_DASHBOARD_PORT=6333
```

## Optional Configuration

These settings enhance functionality but aren't required for basic operation.

### Optional Dashboard (Mongo Express)

<Info>
  An optional dashboard is available to view MongoDB records for the running project. It is disabled by default. Enable only if you need the dashboard (recommended for development, not production).
</Info>

#### Enable the dashboard

1. Update `docker-compose.yml` by adding/uncommenting this service:

```yaml theme={null}
mongo-express:
  image: mongo-express:latest
  restart: always
  ports:
    - "8081:8081"
  environment:
    ME_CONFIG_MONGODB_ENABLE_ADMIN=true
    ME_CONFIG_MONGODB_ADMINUSERNAME=admin
    ME_CONFIG_MONGODB_ADMINPASSWORD=password
    ME_CONFIG_BASICAUTH_USERNAME=weam
    ME_CONFIG_BASICAUTH_PASSWORD=password
    ME_CONFIG_MONGODB_SERVER=mongo
  networks:
    - app-network
  depends_on:
    - mongo
```

2. Start the service:

```bash theme={null}
docker compose up -d mongo-express
```

3. Open the dashboard:

```
URL: http://localhost:8081
Login: uses the basic auth from the service block above
```

### Email Notifications

Configure SMTP for user notifications and account management:

```env theme={null}
# Email Service
EMAIL_PROVIDER=SMTP
SMTP_SERVER=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=your-email@gmail.com
SMTP_PASSWORD=your-app-password
```

**Popular SMTP providers:**

* **Gmail**: `smtp.gmail.com:587` (requires app password)
* **SendGrid**: `smtp.sendgrid.net:587`
* **AWS SES**: Regional endpoints available

### External Service Integration

Configure OAuth credentials for third-party integrations:

<Tabs>
  <Tab title="Slack Integration">
    ```env theme={null}
    SLACK_CLIENT_ID=your-slack-client-id
    SLACK_CLIENT_SECRET=your-slack-client-secret
    NEXT_PUBLIC_SLACK_CLIENT_ID=your-slack-client-id
    NEXT_PUBLIC_SLACK_CLIENT_SECRET=your-slack-client-secret
    ```

    Enable Slack workspace integration for team collaboration.
  </Tab>

  <Tab title="GitHub Integration">
    ```env theme={null}
    GITHUB_CLIENT_ID=your-github-client-id
    GITHUB_CLIENT_SECRET=your-github-client-secret
    GITHUB_REDIRECT_URI=https://yourexampledomain.com/api/auth/github/callback
    ```

    Connect GitHub repositories for code-based workflows.
  </Tab>

  <Tab title="Google Workspace">
    ```env theme={null}
    GOOGLE_CLIENT_ID=your-google-client-id.googleusercontent.com
    GOOGLE_CLIENT_SECRET=your-google-client-secret
    ```

    Integrate Google Drive, Gmail, and Calendar services.
  </Tab>
</Tabs>

## Environment-Specific Settings

Configure different settings for development and production environments.

### Local Development Environment

```env theme={null}
# Development Configuration
NEXT_PUBLIC_APP_ENVIRONMENT=dev
NEXT_PUBLIC_HTTPS_PROTOCOL=false
NEXT_PUBLIC_DOMAIN_URL=http://localhost:3000

# Local Service URLs
NEXT_PUBLIC_BACKEND_API_URL=http://localhost:4050
```

### Production Deployment Environment

```env theme={null}
# Production Configuration
NEXT_PUBLIC_APP_ENVIRONMENT=production
NEXT_PUBLIC_HTTPS_PROTOCOL=true
NEXT_PUBLIC_DOMAIN_URL=https://yourexampledomain.com

# Production Service URLs
NEXT_PUBLIC_BACKEND_API_URL=https://yourexampledomain.com
```

## Configuration Validation

Verify your environment variable configuration:

```bash theme={null}
# Check required variables exist
grep -E "(JWT_SECRET|MONOGODB_URI|REDIS_HOST)" .env

# Verify no placeholder values remain
grep -E "(your-|placeholder|example)" .env

# Test database connection
docker exec yourapp-mongodb mongosh --eval "db.runCommand('ping')"
```

## Next Steps

<CardGroup cols={2}>
  <Card title="API Credential Setup" icon="key" href="/setup/after-setup-complete/credential-setup">
    Configure model provider API keys and external integrations
  </Card>

  <Card title="Launch & Verify" icon="check" href="/setup/after-setup-complete/launch-verify">
    Start services and verify your environment configuration
  </Card>
</CardGroup>
