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.
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 othersInstallation
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
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
.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
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
- Navigate to http://localhost:3000/login
- Enter the admin email you configured
- Complete the authentication process
2. Configure AI Providers
- Go to Admin Dashboard → Settings
- Add your AI provider API keys
- Test the connections to ensure they're working
3. Create Your First User
- In the Admin Dashboard, go to User Management
- Click Add User
- Set up usage budgets for the user
- Assign appropriate roles
4. Set Usage Budgets
- Navigate to Usage Analytics
- Set default budgets for different user roles
- 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:
- Check the GitHub Issues
- Review the troubleshooting guide
- Contact enterprise support for business-critical issues