System requirements
Before installing the chatbot, ensure your system meets these requirements:Required software
Node.js
Node.js
Minimum version: 18.18.0 or higherRecommended: Node.js 20.x LTS or 22.xThe chatbot uses modern JavaScript features and Next.js 16, which require Node.js 18+.Check your version:Install or update Node.js:
- macOS/Linux: Use nvm
- Windows: Download from nodejs.org
- Using package managers:
pnpm
pnpm
Required version: 9.12.3 (specified in package.json)Why pnpm? This project uses pnpm for:Verify installation:
- Faster installs with content-addressable storage
- Strict dependency resolution
- Efficient disk space usage
- Better monorepo support
While npm and yarn will work, using pnpm ensures compatibility with the project’s lock file (
pnpm-lock.yaml).Git
Git
Minimum version: 2.xRequired for cloning the repository and version control.Check your version:Install Git:
- macOS:
brew install gitor use Xcode Command Line Tools - Linux:
sudo apt-get install gitorsudo yum install git - Windows: Download from git-scm.com
Cloud services
The chatbot requires these Vercel services:| Service | Purpose | Required | Documentation |
|---|---|---|---|
| AI Gateway | LLM access (GPT-4, Claude, Gemini) | Yes | vercel.com/ai-gateway |
| Postgres | Database for chats, users, documents | Yes | vercel.com/docs/postgres |
| Blob Storage | File uploads and attachments | Yes | vercel.com/docs/vercel-blob |
| Redis | Caching and rate limiting | Optional | vercel.com/docs/redis |
All Vercel services offer generous free tiers. You can start development without any cost.
Installation steps
1. Clone the repository
Clone the chatbot from GitHub:- Go to github.com/vercel/openchat
- Click Fork in the top right
- Clone your fork:
2. Install dependencies
Install all Node.js packages:package.json:
Core dependencies (20+ packages)
Core dependencies (20+ packages)
- next (16.0.10) - React framework with App Router
- react (19.0.1) & react-dom - UI library
- ai (6.0.37) - Vercel AI SDK for LLM integration
- @ai-sdk/react - React hooks for AI interactions
- @ai-sdk/gateway - Multi-provider AI Gateway client
- next-auth (5.0.0-beta.25) - Authentication
- drizzle-orm (0.34.0) - TypeScript ORM
- postgres (3.4.4) - PostgreSQL client
UI dependencies (30+ packages)
UI dependencies (30+ packages)
- @radix-ui/react-* - Accessible UI primitives
- tailwindcss (4.1.13) - Utility-first CSS
- framer-motion - Animation library
- lucide-react - Icon library
- shadcn/ui components
- codemirror - Code editor
- prosemirror - Rich text editor
Storage & utilities (40+ packages)
Storage & utilities (40+ packages)
- @vercel/blob - File storage client
- @vercel/analytics - Analytics integration
- redis - Caching client
- bcrypt-ts - Password hashing
- zod - Schema validation
- date-fns - Date utilities
- nanoid - ID generation
Development dependencies (15+ packages)
Development dependencies (15+ packages)
- typescript (5.6.3) - Type checking
- drizzle-kit (0.25.0) - Database migrations
- @playwright/test - E2E testing
- ultracite (7.0.11) - Linting and formatting
- tsx - TypeScript execution
- @biomejs/biome - Fast formatter
3. Configure environment variables
Create your environment configuration file:.env.local with your credentials:
Detailed environment variable setup
Generate AUTH_SECRET
Create a secure random secret for session encryption:Copy the output and set it as
AUTH_SECRET in .env.local.Set up AI Gateway
- Go to vercel.com/ai-gateway
- Click Create API Key
- Name it (e.g., “Chatbot Development”)
- Copy the key (starts with
vg_) - Set as
AI_GATEWAY_API_KEYin.env.local
Vercel deployments: If deploying to Vercel, you can skip this step. The platform uses OIDC tokens automatically.
Create Postgres database
- Go to your Vercel dashboard
- Select your project (or create a new one)
- Navigate to Storage → Create Database
- Select Postgres
- Copy the
POSTGRES_URLconnection string - Set it in
.env.local
Set up Blob storage
- In Vercel dashboard, go to Storage
- Click Create Database → Blob
- Name your store (e.g., “chatbot-files”)
- Copy the
BLOB_READ_WRITE_TOKEN - Set it in
.env.local
4. Set up the database
Run database migrations to create all required tables:- Reads your
POSTGRES_URLfrom.env.local - Connects to the database
- Executes migration files from
lib/db/migrations/ - Creates tables:
users,chats,messages,documents,votes,suggestions - Sets up indexes and constraints
Alternative: Manual database setup
If migrations fail, you can use Drizzle Kit directly:5. Verify installation
Start the development server to verify everything works:Troubleshooting
pnpm: command not found
pnpm: command not found
Problem: pnpm is not installed or not in PATH.Solution:
Node version error
Node version error
Problem:
Error: The engine "node" is incompatible with this moduleSolution:Database migration fails
Database migration fails
Problem: Migrations fail with connection or permission errors.Solutions:
-
Check connection string:
-
Use Drizzle Studio to inspect:
-
Reset and retry:
Module not found errors
Module not found errors
Problem:
Cannot find module '@radix-ui/...' or similar.Solution:AI Gateway authentication fails
AI Gateway authentication fails
Problem:
401 Unauthorized when chatting.Solution:-
Verify API key:
- Check
.env.localhasAI_GATEWAY_API_KEY - Key should start with
vg_ - No spaces or quotes around the value
- Check
-
Restart dev server:
-
For Vercel deployments:
- Remove
AI_GATEWAY_API_KEY(uses OIDC instead) - Redeploy to apply changes
- Remove
Port already in use
Port already in use
Problem:
Error: listen EADDRINUSE: address already in use :::3000Solution:TypeScript errors during build
TypeScript errors during build
Problem: Type errors prevent compilation.Solution:
Post-installation
Explore the database
Use Drizzle Studio to view your database visually:https://local.drizzle.studio where you can:
- Browse tables and data
- Run queries
- Edit records
- View relationships
Run tests
Verify the installation with end-to-end tests:- Pages load correctly
- Authentication works
- Chat functionality operates
- Database operations succeed
Code quality checks
Run linting to catch code issues:Next steps
Quickstart guide
Follow the quickstart to get your chatbot running
Environment variables
Learn about all configuration options
Database setup
Deep dive into database configuration
Deploy to Vercel
Deploy your chatbot to production
Additional resources
- Package Manager: pnpm documentation
- Framework: Next.js 16 docs
- AI SDK: Vercel AI SDK
- Database: Drizzle ORM
- Authentication: Auth.js documentation
- UI Components: shadcn/ui
Having trouble? Join the Vercel Discord or open an issue on GitHub.