Autonome Code-Generierung im Docker-Container mit Live-Preview und Web-Widget.
- 🐳 Docker containerized - Ubuntu 22.04 + Python 3.11 + Node.js 20
- 🖥️ Live VNC preview - Watch code execute in real-time via browser
- 🎛️ REST API - Full control via FastAPI endpoints
- 📡 WebSocket streaming - Real-time events and logs
- 🔌 Embeddable widget - Drop into any website
- ⏹️ User-controlled stop - No automatic timeouts
- 🔍 Auto project detection - Electron, Web Apps, CLI tools
- 📦 Git Integration - Automatic GitHub repository creation and push
# Navigate to infra directory
cd infra
# Start the container
docker-compose up --build
# Access the services:
# - Control API: http://localhost:8000
# - Widget: http://localhost:8000/widget/widget.html
# - VNC: http://localhost:6080/vnc.htmlThe container supports automatic GitHub repository creation and code pushing when generation completes.
-
Create a GitHub Personal Access Token (PAT)
- Go to GitHub → Settings → Developer Settings → Personal Access Tokens → Tokens (classic)
- Generate new token with
reposcope - Copy the token
-
Set the environment variable
Option A: Environment variable (recommended)
# Linux/macOS export GITHUB_TOKEN=ghp_your_token_here cd infra && docker-compose up # Windows PowerShell $env:GITHUB_TOKEN="ghp_your_token_here" cd infra; docker-compose up # Windows CMD set GITHUB_TOKEN=ghp_your_token_here cd infra && docker-compose up
Option B: .env file
# Create infra/.env file echo "GITHUB_TOKEN=ghp_your_token_here" > infra/.env
Check Git status:
curl http://localhost:8000/api/git/statusResponse:
{
"configured": true,
"username": "your-username",
"message": "GitHub configured for user: your-username"
}Start engine with Git enabled:
curl -X POST http://localhost:8000/api/start \
-H "Content-Type: application/json" \
-d '{
"requirements_file": "my-project.json",
"output_dir": "my-output",
"git_config": {
"repo_name": "my-generated-app",
"description": "Auto-generated by Coding Engine",
"private": true,
"create_repo": true,
"push_on_complete": true
}
}'Manual push (after generation):
curl -X POST "http://localhost:8000/api/git/push?output_dir=my-output" \
-H "Content-Type: application/json" \
-d '{
"repo_name": "my-repo",
"private": true
}'- Open the widget:
http://localhost:8000/widget/widget.html - Go to the Config tab
- Enable "Push to GitHub on completion"
- Optionally set repository name (defaults to output directory name)
- Choose private/public
- Click Start
- When complete, a banner shows the repository URL
The WebSocket stream includes these Git-related events:
| Event | Description |
|---|---|
git_repo_created |
Repository created on GitHub |
git_push_started |
Push operation started |
git_push_complete |
Code successfully pushed (includes repo_url) |
git_error |
Git operation failed |
┌─────────────────────────────────────────────────────────────────┐
│ Docker Container │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ supervisord │ │
│ │ │ │
│ │ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────────┐ │ │
│ │ │ Xvfb │ │ x11vnc │ │ noVNC │ │ FastAPI │ │ │
│ │ │ :99 │──│ :5900 │──│ :6080 │ │ Control │ │ │
│ │ └─────────┘ └─────────┘ └─────────┘ │ Server :8000│ │ │
│ │ │ │ │ │
│ │ ┌───────────────────────────────────┐ │ ┌─────────┐ │ │ │
│ │ │ Coding Engine │◄─┼─│ Git │ │ │ │
│ │ │ (src/mind/orchestrator.py) │ │ │ Service │ │ │ │
│ │ └───────────────────────────────────┘ │ └─────────┘ │ │ │
│ │ └─────────────┘ │ │
│ └──────────────────────────────────────────────────────────┘ │
│ │
│ Ports: 8000 (API), 6080 (VNC), 3000-3001/5000/8080 (Preview) │
└─────────────────────────────────────────────────────────────────┘
| Method | Endpoint | Description |
|---|---|---|
| GET | / |
API info and available endpoints |
| GET | /api/health |
Health check with service status |
| GET | /api/status |
Current engine state and metrics |
| POST | /api/start |
Start code generation |
| POST | /api/stop |
Stop running engine |
| GET | /api/logs |
Get log history |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/git/status |
Check GitHub configuration |
| POST | /api/git/create |
Create GitHub repository |
| POST | /api/git/push |
Push code to GitHub |
| Endpoint | Description |
|---|---|
/ws |
Real-time event stream |
infra/
├── Dockerfile # Container image definition
├── docker-compose.yml # Service configuration
├── supervisord.conf # Multi-process management
├── README.md # This file
│
├── control_server/ # FastAPI Control Server
│ ├── __init__.py
│ ├── server.py # Main API server
│ ├── models.py # Pydantic models
│ └── git_service.py # GitHub integration
│
├── widget/ # Embeddable widget
│ ├── widget.html # Widget markup
│ ├── widget.css # Widget styles
│ └── widget.js # Widget logic
│
├── scripts/ # Container scripts
│ ├── entrypoint.sh # Container startup
│ ├── start-preview.sh # Preview launcher
│ └── process-monitor.sh # Process monitor
│
└── data/ # Mounted volumes
├── requirements/ # Input requirements (read-only)
└── output/ # Generated code output
| Variable | Description | Default |
|---|---|---|
GITHUB_TOKEN |
GitHub PAT for repository operations | (none) |
OPENAI_API_KEY |
OpenAI API key for code generation | (none) |
ANTHROPIC_API_KEY |
Anthropic API key (alternative) | (none) |
DISPLAY |
X11 display for GUI apps | :99 |
NODE_ENV |
Node.js environment | development |
| Container Port | Host Port | Service |
|---|---|---|
| 8000 | 8000 | FastAPI Control Server |
| 6080 | 6080 | noVNC Web Interface |
| 3000 | 3000 | Preview (React/Next.js) |
| 3001 | 3001 | Preview (alternate) |
| 5000 | 5000 | Preview (Flask/Python) |
| 8080 | 8080 | Preview (general) |
<!-- Option 1: Direct embed -->
<iframe
src="http://localhost:8000/widget/widget.html"
width="900"
height="600"
frameborder="0">
</iframe>
<!-- Option 2: Custom integration -->
<div id="coding-engine-container"></div>
<link rel="stylesheet" href="http://localhost:8000/widget/widget.css">
<script src="http://localhost:8000/widget/widget.js"></script>
<script>
const widget = new CodingEngineWidget({
apiUrl: 'http://localhost:8000',
vncPath: '/vnc/vnc.html'
});
</script>The docker-compose.yml mounts control_server/ and widget/ directories, allowing live editing without rebuild:
# Edit files locally - changes reflect immediately
vim infra/widget/widget.js
# Only need to rebuild for Dockerfile changes
docker-compose up --build- New API endpoint: Edit
control_server/server.py - New data models: Edit
control_server/models.py - Widget UI: Edit
widget/widget.htmlandwidget.css - Widget logic: Edit
widget/widget.js
# Check Docker is running
docker info
# Remove old containers and rebuild
docker-compose down
docker-compose up --build# Check Xvfb is running in container
docker-compose exec coding-engine ps aux | grep Xvfb
# Check x11vnc
docker-compose exec coding-engine ps aux | grep x11vnc# Check token is set
curl http://localhost:8000/api/git/status
# Verify token permissions
# Token needs 'repo' scope for private repos
# Token needs 'public_repo' scope for public repos only# Check container health
docker-compose ps
# View logs
docker-compose logs -f coding-engineMIT License - See LICENSE file in root directory.