Automated code generation and deployment system using LLMs (via aipipe.org) and GitHub Pages.
- ✅ Generate HTML/CSS/JS apps using OpenAI GPT-4o-mini via aipipe.org
- ✅ Automatic GitHub repository creation
- ✅ Automatic GitHub Pages deployment
- ✅ Clean HTML extraction (removes markdown and explanations)
- ✅ Windows-compatible file paths
- ✅ TLS certificate handling for Python 3.13
# From project root with venv activated
cd D:\tds-proj1\llm-code-deployer\backend
pip install -r requirements.txtEdit backend/.env:
OPENAI_API_KEY=your_aipipe_token_here
GITHUB_USERNAME=your_github_username
GITHUB_TOKEN=your_github_personal_access_token
STUDENT_SECRET=your_secret_keyImportant:
- Get aipipe token from: https://aipipe.org/login
- Generate GitHub token: https://github.com/settings/tokens (with
reposcope) - No inline comments in
.envfile!
If you see TLS/SSL errors, clear these environment variables:
$env:CURL_CA_BUNDLE=$null
$env:SSL_CERT_FILE=$null
$env:REQUESTS_CA_BUNDLE=$nullcd D:\tds-proj1\llm-code-deployer\backend
# Clear CA env vars (important!)
$env:CURL_CA_BUNDLE=$null
$env:SSL_CERT_FILE=$null
$env:REQUESTS_CA_BUNDLE=$null
# Activate venv
D:\tds-proj1\.venv\Scripts\Activate.ps1
# Start server
python -m uvicorn main:app --reload --host 127.0.0.1 --port 8000.\start_server.ps1POST http://127.0.0.1:8000/build
Content-Type: application/json
{
"student": "username",
"brief": "Description of the app to generate",
"secret": "your_secret_key"
}PowerShell Example:
$env:CURL_CA_BUNDLE=$null
$env:SSL_CERT_FILE=$null
$env:REQUESTS_CA_BUNDLE=$null
Invoke-RestMethod -Uri "http://127.0.0.1:8000/build" -Method POST `
-Headers @{ "Content-Type" = "application/json" } `
-Body '{"student":"myname","brief":"A todo list app","secret":"rajsecret2151"}' `
-TimeoutSec 180Response:
{
"status": "deployed",
"repo": "myname-app",
"pages_url": "https://your-username.github.io/myname-app/"
}Use the provided test script:
.\test_build.ps1llm-code-deployer/
├── backend/
│ ├── .env # Environment variables
│ ├── main.py # FastAPI application
│ ├── generator.py # LLM code generation
│ ├── deploy_repo.py # GitHub deployment
│ └── requirements.txt # Python dependencies
├── frontend/
│ └── index.html # Frontend UI
├── test_build.ps1 # Test script
└── README.md # This file
- ❌ Old:
https://api.aipipe.org(doesn't exist) - ✅ New:
https://aipipe.org/openrouter/v1/chat/completions
- Removes markdown code blocks (
html...) - Extracts only HTML content
- Handles LLM explanations
- Automatically enables Pages after deployment
- Uses
mainbranch as source
- Validates GitHub credentials
- Handles existing repositories
- Force push to update content
- Uses
tempfile.gettempdir()instead of/tmp - Handles CA certificate bundle issues
# Make sure you're in backend folder
cd D:\tds-proj1\llm-code-deployer\backend
# Check Python path
python --version # Should be 3.13
# Reinstall uvicorn
pip install uvicorn --force-reinstall# Clear bad environment variables
$env:CURL_CA_BUNDLE=$null
$env:SSL_CERT_FILE=$null
$env:REQUESTS_CA_BUNDLE=$null
# Reinstall certifi
pip install certifi --upgrade- Verify token at: https://github.com/settings/tokens
- Ensure token has
reposcope - Generate new token if expired
- Update
.envfile (no comments!)
The updated generator.py now:
- Uses stricter prompts
- Extracts HTML using regex patterns
- Removes markdown formatting
MIT
- OpenAI GPT models via aipipe.org
- GitHub API via PyGithub
- FastAPI framework