An interactive web application that uses AI to generate websites based on natural language descriptions. Features a real-time preview, version history, and a draggable interface.
- 🤖 AI-powered website generation using OpenAI's API
- 🔑 Bring your own OpenAI API key
- 🎯 Multiple AI model options:
- GPT-4o Mini
- GPT-4o
- GPT-4
- GPT-3.5
- O1 Mini
- O1 Preview
- 🖥️ Real-time preview
- 📝 Version history with restore points
- 🔄 Copy generated HTML code
- 🌐 Publish and share generated websites
- 🖱️ Draggable interface
- ⚡ Fast and responsive
- 🔒 Multi-user support with session management
- 💾 Persistent storage using pickle with file locking
Before you begin, ensure you have the following installed:
- Python 3.7+
- pip (Python package manager)
- An OpenAI API key (get one at https://platform.openai.com/api-keys)
-
Clone the repository:
git clone https://github.com/BonifacioCalindoro/ai-website-builder cd ai-website-builder
-
Create a virtual environment (recommended):
python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Start the server:
python main.py
Or alternatively:
uvicorn main:app --reload --port 8001
-
Open your browser and navigate to:
http://localhost:8001
- Enter your OpenAI API key in the input field
- Select your preferred AI model from the dropdown
- Type your website description
- Click "Generate" or press Enter
- Watch as your website appears in the preview window
- Type your website description in the input field at the top of the screen
- Click "Generate" or press Enter
- Watch as your website appears in the preview window below
Example prompts:
- "Create a landing page for a coffee shop with a dark theme"
- "Make a personal portfolio with three sections: About, Projects, and Contact"
- "Build a simple blog homepage with recent posts"
You can continue editing the website by clicking "Generate" with a new prompt.
- Click the "Chat History" dropdown in the prompt panel
- View your previous prompts with timestamps
- Click "Restore" next to any version to revert to that design
- The active version is highlighted in blue
- Use "Clear History" to start fresh
- Click the "Publish" button when you're happy with your design
- Copy the generated URL from the modal
- Share the URL with others to view your website
- API Key: Enter your OpenAI API key (required for generation)
- Model Selection: Choose your preferred AI model
- Drag & Drop: Click and drag the prompt panel header to move it
- Minimize: Click the "-" button to collapse the prompt panel
- Copy HTML: Click the "Copy HTML" button to copy the generated code
- Preview: Updates automatically with each generation or restoration
- Show/Hide API Key: Toggle visibility of your API key
- Backend: FastAPI (Python)
- AI Models: Multiple OpenAI models with optimizations
- Frontend: Vanilla JavaScript
- Session Management: Cookie-based with pickle storage
- Real-time updates using iframe refresh
- File locking for concurrent access
- Persistent sessions across server restarts
- Requires OpenAI API key
- Different models have different capabilities and speeds
- API costs vary by model choice
Feel free to submit issues, fork the repository, and create pull requests for any improvements.
This project is licensed under the MIT License - see the LICENSE file for details.