Skip to content

Latest commit

 

History

History
88 lines (63 loc) · 1.67 KB

File metadata and controls

88 lines (63 loc) · 1.67 KB

Local Development Setup

Quick setup guide for Windows and Mac.

Prerequisites

Quick Start

1. Start the Database

# Start PostgreSQL in Docker
docker-compose up -d

# Verify it's running
docker-compose ps

2. Configure Environment

# Copy example env file
cp .env.example .env.local

# Edit .env.local and fill in:
# - AUTH_SECRET (generate at https://generate-secret.vercel.app/32)
# - XAI_API_KEY (from https://console.x.ai)
# - POSTGRES_URL=postgresql://chatbot:chatbot@localhost:5432/chatbot
# (Optional) AI_GATEWAY_API_KEY if you want to proxy through Vercel AI Gateway

3. Install Dependencies & Run Migrations

# Install packages
pnpm install

# Run database migrations
pnpm db:migrate

4. Start Development Server

pnpm dev

Open http://localhost:3000

Common Commands

# Stop database
docker-compose down

# Stop and remove all data
docker-compose down -v

# View database logs
docker-compose logs -f postgres

# Open Drizzle Studio (database UI)
pnpm db:studio

Troubleshooting

Port 5432 already in use

Stop any existing PostgreSQL or change the port in docker-compose.yml:

ports:
  - "5433:5432"  # Use 5433 instead

Then update POSTGRES_URL to use port 5433.

Database connection refused

Make sure Docker Desktop is running and the container is up:

docker-compose ps
docker-compose up -d

Migration fails

Check your POSTGRES_URL is correct and the database is running.