A FastAPI application that automatically generates web applications based on user requirements, creates GitHub repositories, and deploys them to GitHub Pages.
- AI-powered code generation using OpenAI
- GitHub repository creation and management
- Automatic GitHub Pages deployment
- Webhook notifications on completion
- Secure authentication with secrets
- Support for file attachments
- Duplicate request detection
- Python 3.13.7
- GitHub account and token
- OpenAI API key
-
Create a virtual environment:
python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Configure environment variables: Create a
.envfile with:GITHUB_TOKEN=your_github_token GITHUB_USERNAME=your_github_username OPENAI_API_KEY=your_openai_api_key USER_SECRET=your_secret_key OPENAI_BASE_URL=https://aipipe.org/openai/v1
-
Run the application:
uvicorn app.main:app --reload
The API will be available at http://127.0.0.1:8000
Once running, visit:
- Interactive API docs:
http://127.0.0.1:8000/docs - Alternative docs:
http://127.0.0.1:8000/redoc
Generate and deploy a web application.
Request Body:
{
"email": "[email protected]",
"secret": "your_secret",
"task": "project-name",
"round": 1,
"nonce": "unique-identifier",
"brief": "Description of the app to generate",
"checks": ["Requirement 1", "Requirement 2"],
"evaluation_url": "https://webhook.site/your-id",
"attachments": []
}Example:
curl -X POST http://127.0.0.1:8000/api-endpoint \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]",
"secret": "tdsproject1_2025",
"task": "weather-app",
"round": 1,
"nonce": "test-001",
"brief": "Create a weather app with city search",
"checks": ["Has README", "Works on mobile"],
"evaluation_url": "https://webhook.site/your-id",
"attachments": []
}'See DEPLOYMENT.md for detailed instructions on deploying to Render.
- Push code to GitHub
- Connect repository to Render
- Add environment variables
- Deploy!
Your API will be available at https://your-app.onrender.com
tds-project-1-main/
├── app/
│ ├── __init__.py
│ ├── main.py # FastAPI application
│ ├── llm_generator.py # OpenAI integration
│ ├── github_utils.py # GitHub API functions
│ ├── notify.py # Webhook notifications
│ └── signature.py # Request signing
├── .env # Environment variables (not in git)
├── .gitignore # Git ignore rules
├── requirements.txt # Python dependencies
├── runtime.txt # Python version
├── Procfile # Process file for deployment
├── build.sh # Build script for Render
├── render.yaml # Render configuration
└── README.md # This file
- Receives a request with project requirements
- Uses OpenAI to generate code based on the brief
- Creates a GitHub repository
- Commits generated files (HTML, README, LICENSE)
- Enables GitHub Pages
- Sends completion notification to evaluation URL
python test_github.pyThe application logs to stdout. In production, check Render logs.
| Variable | Description | Required |
|---|---|---|
GITHUB_TOKEN |
GitHub personal access token | Yes |
GITHUB_USERNAME |
Your GitHub username | Yes |
OPENAI_API_KEY |
OpenAI API key | Yes |
USER_SECRET |
Secret for request authentication | Yes |
OPENAI_BASE_URL |
OpenAI API base URL | No |
MIT License - See LICENSE file for details
For issues or questions:
- Check the DEPLOYMENT.md guide
- Review API documentation at
/docs - Check application logs