This guide covers both Docker setup (recommended) and manual setup for VT development.
- Docker & Docker Compose installed
- At least one AI API key
-
Clone repository:
git clone https://github.com/vinhnx/vtchat.git cd vtchat -
Setup environment:
cp apps/web/.env.example apps/web/.env.local
-
Configure required variables:
# Generate authentication secret node -e "console.log(require('crypto').randomBytes(32).toString('hex'))" # Copy output to BETTER_AUTH_SECRET in .env.local # Add your AI API key (choose one) OPENAI_API_KEY=sk-your-key-here # OR ANTHROPIC_API_KEY=sk-ant-your-key-here # OR GEMINI_API_KEY=your-key-here
-
Validate & run:
./validate-setup.sh docker-compose up --build
-
Access VT: http://localhost:3000
- PostgreSQL 15 database with automatic initialization
- VT application with hot reload development
- All dependencies pre-installed
- Health checks and proper startup sequencing
- Volume persistence for database data
# Start services
docker-compose up --build
# Run in background
docker-compose up -d --build
# View logs
docker-compose logs vtchat
docker-compose logs postgres
# Stop services
docker-compose down
# Reset everything (deletes database)
docker-compose down -vFor developers who prefer manual control over their environment.
- Bun v1.1.19+ (primary runtime)
- Node.js 18+ (for compatibility)
- PostgreSQL 15+ (local or cloud)
- Git
git clone https://github.com/vinhnx/vtchat.git
cd vtchat
bun install# Install PostgreSQL
brew install postgresql@15
brew services start postgresql@15
# Create database
createdb vtchat_dev
# Connection string for .env.local
DATABASE_URL=postgresql://yourusername@localhost:5432/vtchat_dev# Run PostgreSQL in Docker
docker run -d --name vtchat-postgres \
-e POSTGRES_DB=vtchat_dev \
-e POSTGRES_USER=vtchat \
-e POSTGRES_PASSWORD=vtchat_password \
-p 5432:5432 postgres:15-alpine
# Connection string for .env.local
DATABASE_URL=postgresql://vtchat:vtchat_password@localhost:5432/vtchat_dev# Use your cloud database URL
DATABASE_URL=postgresql://user:pass@host:port/databasecp apps/web/.env.example apps/web/.env.localRequired variables (edit apps/web/.env.local):
# Database
DATABASE_URL=postgresql://vtchat:vtchat_password@localhost:5432/vtchat_dev
# Authentication
BETTER_AUTH_SECRET=your-32-character-secret-here
BETTER_AUTH_URL=http://localhost:3000
NEXT_PUBLIC_BASE_URL=http://localhost:3000
# AI Provider (at least one required)
OPENAI_API_KEY=sk-your-key-here
# OR
ANTHROPIC_API_KEY=sk-ant-your-key-here
# OR
GEMINI_API_KEY=your-key-herecd apps/web
bun run generate# From project root
bun dev
# Or from apps/web directory
cd apps/web
bun dev# Start development server
bun dev
# Code changes auto-reload
# Edit files → see changes instantly# After schema changes
cd apps/web
bun run generate
# Restart server if needed
bun dev# Lint code
bun run lint
# Format code
bun run fmt
# Check formatting
bun run fmt:check# Run all tests
bun test
# Run with coverage
bun test:coverage
# Watch mode
bun test --watch- Visit platform.openai.com/api-keys
- Create new API key
- Add to
.env.local:OPENAI_API_KEY=sk-...
- Visit console.anthropic.com/settings/keys
- Create new API key
- Add to
.env.local:ANTHROPIC_API_KEY=sk-ant-...
- Visit ai.google.dev/api
- Get API key
- Add to
.env.local:GEMINI_API_KEY=...
- Go to github.com/settings/developers
- Create OAuth App
- Authorization callback URL:
http://localhost:3000/api/auth/callback/github - Add to
.env.local:GITHUB_CLIENT_ID=your-client-id GITHUB_CLIENT_SECRET=your-client-secret
- Go to console.cloud.google.com
- Create OAuth 2.0 credentials
- Authorized redirect URIs:
http://localhost:3000/api/auth/callback/google - Add to
.env.local:GOOGLE_CLIENT_ID=your-client-id.googleusercontent.com GOOGLE_CLIENT_SECRET=your-client-secret
Run the validation script first:
./validate-setup.shThis checks for common configuration issues.
# Check Docker status
docker --version
docker-compose --version
# Clear Docker cache
docker system prune -f
# Rebuild without cache
docker-compose build --no-cache
# Check container logs
docker-compose logs vtchat
docker-compose logs postgres# Clear all caches
rm -rf node_modules apps/web/node_modules apps/web/.next .next
# Reinstall dependencies
bun install
# Clear Bun cache
bun pm cache rm# Check PostgreSQL connection
psql $DATABASE_URL -c "SELECT version();"
# Reset Docker database
docker-compose down -v
docker-compose up --build# Generate new secret
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
# Clear browser data
# Hard refresh: Cmd+Shift+R (macOS) or Ctrl+Shift+R (Linux/Windows)If ports 3000 or 5432 are in use:
# Find process using port
lsof -i :3000
lsof -i :5432
# Kill process
kill -9 <PID>
# Or change ports in docker-compose.yml
# ports:
# - "3001:3000" # Change VT port
# - "5433:5432" # Change PostgreSQL port- Main README - Quick overview
- Docker Guide - Detailed Docker instructions
- Architecture - System design
- Features - Complete feature list
- Security - Security implementation