Getting Started

Welcome to the Enterprise AI Chatbot Platform! This guide will walk you through setting up and deploying your own instance of the platform.

Before You Begin: This guide assumes you have basic knowledge of Node.js, PostgreSQL, and command-line operations. If you need help with enterprise deployment, contact our enterprise team.

Prerequisites

Node.js

Version 18.x or higher

node --version

pnpm

Package manager

npm install -g pnpm

PostgreSQL

Version 14+ recommended

psql --version

API Keys

For AI providers

OpenAI, Claude, Vertex, and others

Installation

1 Clone the Repository

git clone https://github.com/Penguin-International-Gurgaon/ai-chatbot-entrpise-kit.git

cd ai-chatbot-entrpise-kit

2 Install Dependencies

pnpm install
Tip: If you prefer npm or yarn, you can use those instead, but pnpm is recommended for better performance and disk space efficiency.

3 Environment Setup

Create your environment configuration file:

cp .env.example .env.local

Edit .env.local with your configuration:

# Authentication

AUTH_SECRET=your-super-secret-auth-key-here
NEXTAUTH_URL=http://localhost:3000

# Database

DATABASE_URL=postgresql://username:password@localhost:5432/ai_chatbot

# AI Provider API Keys

OPENAI_API_KEY=your-openai-api-key-here
ANTHROPIC_API_KEY=your-anthropic-api-key-here

# Optional: Additional Providers

GOOGLE_API_KEY=your-google-api-key
VERTEX_API_KEY=your-vertex-api-key
Security Note: Never commit your .env.local file to version control. It contains sensitive API keys and secrets.

4 Database Setup

Initialize your PostgreSQL database:

# Create database (if not already created)

createdb ai_chatbot

# Run migrations to set up tables

pnpm db:migrate

5 Create Admin User

Set up your first admin user:

pnpm run set-admin --email admin@yourcompany.com
Success: Your admin user has been created! You can now log in with this email address.

6 Start the Application

# Development mode

pnpm dev

# Production mode

pnpm build
pnpm start

Visit http://localhost:3000 to access your application.

Configuration

Environment Variables Reference

Variable Description Required Default
AUTH_SECRET Secret key for authentication -
DATABASE_URL PostgreSQL connection string -
OPENAI_API_KEY OpenAI API key -
ANTHROPIC_API_KEY Anthropic API key -
ADMIN_EMAIL Default admin email -
NEXTAUTH_URL Application URL http://localhost:3000

Database Configuration

The application uses PostgreSQL with Drizzle ORM. You can configure your database connection in several ways:

Local PostgreSQL:

DATABASE_URL=postgresql://username:password@localhost:5432/ai_chatbot

Docker PostgreSQL:

docker run --name ai-chatbot-db -e POSTGRES_DB=ai_chatbot -e POSTGRES_USER=user -e POSTGRES_PASSWORD=password -p 5432:5432 -d postgres:14

Cloud PostgreSQL (Supabase, Neon, etc.):

DATABASE_URL=postgresql://username:password@your-host:5432/database_name?sslmode=require

First Steps After Installation

1. Login as Admin

  1. Navigate to http://localhost:3000/login
  2. Enter the admin email you configured
  3. Complete the authentication process

2. Configure AI Providers

  1. Go to Admin DashboardSettings
  2. Add your AI provider API keys
  3. Test the connections to ensure they're working

3. Create Your First User

  1. In the Admin Dashboard, go to User Management
  2. Click Add User
  3. Set up usage budgets for the user
  4. Assign appropriate roles

4. Set Usage Budgets

  1. Navigate to Usage Analytics
  2. Set default budgets for different user roles
  3. Configure budget request workflows

Production Deployment

Docker Deployment

Create a docker-compose.yml file:

version: '3.8'

services:
app:
build: .
ports: - "3000:3000"
environment: - DATABASE_URL=postgresql://postgres:password@db:5432/ai_chatbot - AUTH_SECRET=your-production-secret - OPENAI_API_KEY=your-openai-key
depends_on: - db

db:
image: postgres:14
environment: - POSTGRES_DB=ai_chatbot - POSTGRES_USER=postgres - POSTGRES_PASSWORD=password
volumes: - postgres_data:/var/lib/postgresql/data

volumes:
postgres_data:

Cloud Deployment Options

Vercel (Recommended for small-medium teams):

# Install Vercel CLI

npm install -g vercel

# Deploy

vercel --prod

AWS/Azure/GCP:

  • Use Docker containers with managed databases
  • Set up load balancers for high availability
  • Configure auto-scaling based on usage

Self-hosted:

  • Use reverse proxy (nginx/Apache)
  • Set up SSL certificates
  • Configure monitoring and logging

Troubleshooting

Common Issues

Database Connection Failed:

  • Verify PostgreSQL is running
  • Check DATABASE_URL format
  • Ensure database exists

Authentication Not Working:

  • Verify AUTH_SECRET is set
  • Check NEXTAUTH_URL matches your domain
  • Clear browser cookies and try again

API Keys Not Working:

  • Verify API keys are correct and active
  • Check rate limits haven't been exceeded
  • Ensure billing is set up for AI providers

Build Errors:

  • Clear node_modules and reinstall: rm -rf node_modules && pnpm install
  • Check Node.js version compatibility
  • Verify all environment variables are set

Getting Help

If you encounter issues:

  1. Check the GitHub Issues
  2. Review the troubleshooting guide
  3. Contact enterprise support for business-critical issues

Next Steps

Congratulations! Your Enterprise AI Chatbot Platform is now running. Here's what to do next: