Overview
The project includes Docker support for running the backend and dashboard in containers. This is ideal for:- Local development
- Self-hosted deployments
- Consistent environments across teams
- Testing production builds locally
Prerequisites
- Docker 20+
- Docker Compose 2+
- Convex deployed with production
CONVEX_URL .envfile configured
Quick Start
1. Configure Environment
Create.env file in the project root:
.env with your values:
2. Start Services
- Backend on
http://localhost:4000 - Dashboard on
http://localhost:3000
Docker Compose Configuration
Thedocker-compose.yml file defines two services:
Dockerfile Structure
TheDockerfile uses multi-stage builds:
Stage 1: Dependencies (deps)
Stage 2: Builder
Stage 3: Backend Image
Stage 4: Dashboard Image
Port Mappings
-
Backend:
4000:4000(host:container)- Access at
http://localhost:4000 - Widget bundle:
http://localhost:4000/widget/chat-widget.js - API endpoints:
http://localhost:4000/v1/chat
- Access at
-
Dashboard:
3000:3000(host:container)- Access at
http://localhost:3000 - Login:
http://localhost:3000/login - Widget test:
http://localhost:3000/widget-test.html
- Access at
Docker Commands
Start in Background
View Logs
Stop Services
Rebuild After Code Changes
Remove Volumes
Environment Variables
Docker Compose loads variables from.env file automatically. The env_file directive passes all variables to containers.
You can override specific variables in docker-compose.yml under the environment section.
Production Self-Hosting
For production self-hosted deployments:- Build production images:
- Push to registry (optional):
- Deploy with production environment variables:
- Use reverse proxy (Nginx/Caddy) for HTTPS:
Verify Docker Deployment
Troubleshooting
Backend can’t connect to Convex
- Verify
CONVEX_URLin.env - Check Convex deployment is running
- Ensure container has internet access
Dashboard shows connection error
- Verify
NEXT_PUBLIC_BACKEND_URLpoints to backend - Check backend is running:
docker compose ps - Check backend logs:
docker compose logs backend
Widget not loading
- Verify
WIDGET_BUNDLE_PATH=/app/widget/dist/chat-widget.js - Check widget was built in Docker image
- Verify backend logs for errors
Next Steps
- Embed the widget using
http://localhost:4000 - Test the chat functionality
- View conversations at
http://localhost:3000