Chatbot Creation Framework - Testing Guide
Prerequisites
Before we start testing, ensure you have these installed:
- Node.js 18+ (check with
node --version) - Docker Desktop (check with
docker --version) - Docker Compose (check with
docker-compose --version) - Git (for version control)
Step 1: Environment Setup
1.1 Install Dependencies
# Install all project dependencies
npm install
1.2 Set Up Environment Variables
# Copy the environment template for Next.js application
cp .env.example .env.local
# Copy the Docker environment template
cp .env.example .env
# Edit both files with your settings (for testing, default values work)
IMPORTANT: You need TWO environment files:
.env- Used by Docker Compose for container variables.env.local- Used by Next.js application
Required Variables in .env (for Docker):
POSTGRES_USER=chatbot_user
POSTGRES_PASSWORD=secure_password
POSTGRES_DB=chatbot_framework
MINIO_ACCESS_KEY=chatbot_access
MINIO_SECRET_KEY=chatbot_secret_key_min_32_chars_long
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=your-super-secret-key-min-32-chars-long-for-testing
Step 2: Infrastructure Testing
2.1 Start Docker Services
# Start all services in detached mode
docker-compose up -d
# Check if all services are running
docker-compose ps
Expected Output:
NAME COMMAND SERVICE STATUS PORTS
project-app-1 "docker-entrypoint.s…" app running 0.0.0.0:3000->3000/tcp
project-minio-1 "/usr/bin/docker-ent…" minio running 0.0.0.0:9000-9001->9000-9001/tcp
project-nginx-1 "/docker-entrypoint.…" nginx running 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp
project-postgres-1 "docker-entrypoint.s…" postgres running 0.0.0.0:5432->5432/tcp
project-redis-1 "docker-entrypoint.s…" redis running 0.0.0.0:6379->6379/tcp
2.2 Check Service Health
# Check service logs (if any issues)
docker-compose logs -f postgres
docker-compose logs -f redis
docker-compose logs -f minio
# Test individual services
docker-compose exec postgres pg_isready -U chatbot_user
docker-compose exec redis redis-cli ping
Step 3: Database Setup and Testing
3.1 Generate Prisma Client
# Generate the Prisma client
npx prisma generate
3.2 Set Up Database Schema
# Push the schema to the database
npx prisma db push
# Verify the database connection
npx prisma db pull
3.3 Test Database Connection
# Open Prisma Studio (optional but helpful)
npx prisma studio
Prisma Studio should open at http://localhost:5555 and show your database tables.
Step 4: Application Testing
4.1 Development Server
# Start the Next.js development server
npm run dev
4.2 Verify Application Access
Open your browser and navigate to:
- Main Application:
http://localhost:3000 - Prisma Studio:
http://localhost:5555(if running) - MinIO Console:
http://localhost:9001(login with MINIO_ACCESS_KEY/MINIO_SECRET_KEY)
4.3 Test Landing Page
The landing page should display:
- ✅ "Chatbot Creation Framework" title
- ✅ Three feature cards (Multimodal Processing, Real-time Chat, n8n Integration)
- ✅ "Get Started" and "Documentation" buttons
- ✅ "How it Works" section with 3 steps
Step 5: Service-by-Service Testing
5.1 Test PostgreSQL
# Connect to database directly
docker-compose exec postgres psql -U chatbot_user -d chatbot_framework
# Inside PostgreSQL, run:
\dt # List tables
\q # Quit
Expected Tables:
- users
- accounts
- sessions
- chatbot_projects
- documents
- chatbot_api_keys
- processing_jobs
- system_config
- activity_logs
5.2 Test Redis
# Test Redis connection
docker-compose exec redis redis-cli
# Inside Redis, run:
ping # Should return PONG
set test 123 # Set a test value
get test # Should return 123
exit
5.3 Test MinIO
- Web Console: Go to
http://localhost:9001 - Login: Use credentials from
.env.local - Verify: You should see the MinIO dashboard
# Test MinIO API directly
curl http://localhost:9000/minio/health/live
# Should return 200 OK
5.4 Test Application Build
# Test production build
npm run build
# Check build output
ls -la .next/
Step 6: Component Testing
6.1 Test TypeScript Compilation
# Check for TypeScript errors
npm run type-check
6.2 Test Linting
# Run ESLint
npm run lint
6.3 Test Database Operations
Create a simple test file to verify database operations:
# Create a test script
mkdir -p tests
6.4 Test Docker Production Build
# Build the production Docker image
docker build -t chatbot-framework .
# Test production container (optional)
docker run -p 3001:3000 --env-file .env.local chatbot-framework
Step 7: Verification Checklist
✅ Infrastructure Verification
- PostgreSQL container running and accessible
- Redis container running and responding to ping
- MinIO container running and console accessible
- Nginx container running (if using)
- All Docker containers healthy
✅ Database Verification
- Prisma client generated successfully
- Database schema pushed without errors
- All expected tables created
- Database connection working from application
✅ Application Verification
- Next.js development server starts without errors
- Landing page loads and displays correctly
- Tailwind CSS styles applied correctly
- TypeScript compilation successful
- No console errors in browser
✅ Build Verification
- Production build completes successfully
- Docker image builds without errors
- All environment variables properly configured
Step 8: Troubleshooting Common Issues
Issue 1: Docker Services Won't Start
# Check Docker is running
docker --version
# Check available resources
docker system df
# Restart Docker Desktop if needed
Issue 2: Database Connection Errors
# Check if PostgreSQL is accepting connections
docker-compose logs postgres
# Verify environment variables
cat .env.local | grep DATABASE_URL
Issue 3: Port Conflicts
# Check what's using your ports
netstat -an | grep :3000
netstat -an | grep :5432
# Stop conflicting services or change ports in docker-compose.yml
Issue 4: Permission Issues (Linux/Mac)
# Fix Docker permissions
sudo chmod 666 /var/run/docker.sock
# Fix file permissions
sudo chown -R $USER:$USER .
Step 9: Performance Testing
9.1 Basic Load Test
# Install simple load testing tool
npm install -g autocannon
# Test the landing page
autocannon -c 10 -d 5 http://localhost:3000
9.2 Database Performance
# Check database performance
docker-compose exec postgres pg_stat_activity
Step 10: Clean Up (Optional)
Stop All Services
# Stop and remove containers
docker-compose down
# Remove volumes (WARNING: This deletes all data)
docker-compose down -v
Remove Docker Images
# List images
docker images | grep chatbot
# Remove images (optional)
docker rmi chatbot-framework
Success Criteria
🎉 Your setup is successful if:
- All Docker containers are running and healthy
- Landing page loads at
http://localhost:3000 - Database schema is properly created
- MinIO console is accessible at
http://localhost:9001 - No TypeScript or build errors
- Prisma Studio shows all database tables
Next Steps
Once all tests pass, you're ready to:
- Implement user authentication (NextAuth.js)
- Build the dashboard interface
- Add file upload functionality
- Integrate with n8n workflows
Need Help?
If you encounter issues:
- Check the logs:
docker-compose logs [service-name] - Verify environment variables in
.env.local - Ensure all prerequisites are installed
- Try rebuilding:
docker-compose down && docker-compose up --build -d
Your foundation is solid and ready for the next phase of development!