This application generates custom websites using Cloudflare Workers AI for both text and image generation. It automatically deploys the generated sites to GitHub and Vercel.
- 🎨 Website generation using Cloudflare AI
- 🖼️ Image generation using Cloudflare Stable Diffusion XL
- 🚀 Automatic GitHub deployment
- ⚡ Vercel integration
- 🐳 Docker support
- Python 3.9+
- Git
- Docker (optional)
- Cloudflare account
- GitHub account
- Vercel account
.\deploy.ps1
./deploy.sh
- Clone the repository:
git clone https://github.com/yourusername/AI-website-generator
cd AI-website-generator
-
Set up Cloudflare:
- Create a Cloudflare account
- Get your Account ID from the dashboard
- Create an API token with AI permissions
- Note down: CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_KEY
-
Configure environment:
cp .env.example .env
Edit .env with your credentials:
CLOUDFLARE_API_KEY=your_api_key
CLOUDFLARE_ACCOUNT_ID=your_account_id
CLOUDFLARE_AI_MODEL=@cf/meta/llama-2-7b-chat-int8
GITHUB_ACCESS_TOKEN=your_github_token
GITHUB_REPO_NAME=your_repo_name
GIT_USER_EMAIL=your_email
GIT_USER_NAME=your_name
- Install dependencies:
python -m venv venv
source venv/bin/activate # or `venv\Scripts\activate` on Windows
pip install -r requirements.txt
flask run
docker-compose up --build
- Connect your GitHub repository to Render
- Use these settings:
- Build Command:
pip install -r requirements.txt
- Start Command:
gunicorn app:app --timeout 180
- Add environment variables from .env
- Build Command:
- Install Vercel CLI:
npm i -g vercel
- Deploy:
vercel
GET /
: Main interfacePOST /generate
: Generate website- Parameters:
input_text
: Website description
- Parameters:
Variable | Description | Required |
---|---|---|
CLOUDFLARE_API_KEY | Cloudflare API key | Yes |
CLOUDFLARE_ACCOUNT_ID | Cloudflare account ID | Yes |
CLOUDFLARE_AI_MODEL | AI model name | Yes |
GITHUB_ACCESS_TOKEN | GitHub personal access token | Yes |
GITHUB_REPO_NAME | Target repository name | Yes |
GIT_USER_EMAIL | Git commit email | Yes |
GIT_USER_NAME | Git commit name | Yes |
.
├── app.py # Flask application
├── beautifulsoup.py # HTML processing
├── github_utils.py # GitHub integration
├── main.py # Core logic
├── openai_utils.py # Cloudflare AI integration
├── stablehorde.py # Image generation
├── templates/ # HTML templates
├── workers/ # Cloudflare Workers
├── Dockerfile # Docker configuration
└── docker-compose.yml # Docker Compose config
-
Image Generation Issues:
- Check Cloudflare API permissions
- Verify account has AI access enabled
-
Deployment Issues:
- Verify environment variables
- Check API key permissions
- Ensure GitHub token has correct scopes
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
MIT License