Skip to content
This repository was archived by the owner on Apr 26, 2026. It is now read-only.

Repository files navigation

🚀 AI Website Modernizer

Transform any website into a modern, responsive, and SEO-optimized experience using Google Gemini AI.

Python License Streamlit

🎯 Overview

AI Website Modernizer is an intelligent web transformation tool that analyzes existing websites and automatically rebuilds them with modern design principles, improved user experience, and optimized performance. Using advanced AI capabilities powered by Google Gemini, it creates cohesive, responsive websites that maintain brand identity while dramatically improving functionality.

🏗️ Core Components


✨ Key Features

🤖 Intelligent Website Analysis

  • Smart Content Extraction: Automatically crawls and analyzes website structure using crawl_site.py:get_page_content()
  • Comprehensive Data Collection: Captures HTML, CSS, images, and copy with configurable depth and page limits
  • SSRF Protection: Enhanced security with is_safe_url() validation
  • Content Understanding: AI processes all page data simultaneously for holistic redesign approach

🎨 AI-Powered Modernization

  • Holistic Redesign: Google Gemini AI analyzes entire site structure via gemini_generate_entire_site()
  • Mobile-First Approach: Automatically optimizes for responsive design and mobile user experience
  • SEO Optimization: Implements modern SEO best practices and performance improvements
  • Brand Consistency: Maintains brand identity while upgrading design language and user experience

🔧 Technical Excellence

  • Structured Output: Generates clean, maintainable code with global stylesheets and organized HTML
  • Scalable Architecture: Three-stage pipeline (Crawl → AI Processing → Generation) for reliable results
  • Security-First: Secure API key handling via load_gemini_api_key() and path traversal protection
  • Error Resilience: Comprehensive timeout handling and graceful error recovery

📊 User-Friendly Interface

  • Interactive Dashboard: Streamlit-powered UI with run_full_process()
  • Real-Time Monitoring: Live progress tracking via run_subprocess_and_log()
  • Direct Browser Access: Open generated websites directly in browser tabs
  • Process Transparency: Clear status indicators and detailed feedback

🔄 How It Works

graph LR
    A[Input Website URL] --> B[Web Crawling]
    B --> C[Content Extraction]
    C --> D[AI Analysis]
    D --> E[Design Generation]
    E --> F[Modern Website Output]
Loading
  1. 🕷️ Web Crawling: crawl_site.py:main() discovers and crawls website pages using Selenium WebDriver
  2. 📝 Content Extraction: save_page_data() structures HTML, CSS, images, and text content
  3. 🧠 AI Analysis: remake_site_with_ai.py processes all content with Google Gemini for comprehensive understanding
  4. 🎨 Design Generation: AI creates modern, responsive design with improved UX and SEO
  5. 📦 Output Generation: Produces clean, organized website files ready for deployment

📋 Prerequisites

🚀 Quick Start

1. Clone & Setup

git clone <repository-url>
cd ai-website-modernizer

2. Environment Setup

# Create virtual environment
python3 -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install pinned dependencies for reproducible builds
pip install -r requirements.txt

# For development: install pip-tools to manage dependencies
pip install pip-tools

# To update dependencies: edit requirements.in, then run:
# pip-compile requirements.in

3. API Configuration

# Set your Google Gemini API key
export GOOGLE_GEMINI_API_KEY=your-api-key-here

# For permanent setup (recommended)
echo 'export GOOGLE_GEMINI_API_KEY=your-api-key-here' >> ~/.bashrc
source ~/.bashrc

🔑 Get your API key: Google AI Studio

4. Launch Dashboard

🚀 One-Click Startup (Recommended)

# macOS/Linux
./start.sh

# Windows
start.bat

Manual Launch

streamlit run dashboard.py

Open your browser to http://localhost:8501 and start transforming websites! 🎉

The startup scripts automatically handle virtual environment creation, dependency installation, and dashboard launch.


💻 Usage Options

🎯 Recommended: Interactive Dashboard

streamlit run dashboard.py
  • User-friendly interface with real-time progress tracking via dashboard.py
  • One-click transformation from URL input to modernized website
  • Live preview of transformed pages with modify_html_for_preview()
  • Detailed logging and status monitoring

🔧 Advanced: Command Line Interface

Crawl Website

python crawl_site.py https://example.com --max_pages 10 --depth 2

AI Transformation

python remake_site_with_ai.py example.com --model gemini-2.5-flash-preview-05-20

Available Models:

  • gemini-2.5-flash-preview-05-20 (default, fast)
  • gemini-1.5-pro-latest (comprehensive, large context)

📁 Output Structure

📦 example.com/                    # Original crawled data
 ┣ 📂 home/
 ┃ ┣ 📄 url.txt                   # Page URL
 ┃ ┣ 📄 page.html                 # Original HTML
 ┃ ┣ 📄 copy.txt                  # Extracted text content
 ┃ ┣ 📄 images.txt                # Image URLs
 ┃ ┗ 📄 css.txt                   # CSS styles
 ┣ 📂 about/
 ┃ ┗ 📄 ...
 ┗ 📄 crawl_manifest.json         # Crawl metadata

📦 example.com_ai/                 # 🎨 AI-Enhanced Website
 ┣ 📄 global_styles.css           # Modern global stylesheet
 ┣ 📂 home/
 ┃ ┣ 📄 index.html                # ✨ Modernized HTML
 ┃ ┗ 📄 original_*.txt            # Reference files
 ┗ 📂 about/
   ┗ 📄 index.html

🏗️ Architecture

Three-Stage Pipeline

🕷️ Crawl → 🧠 AI Processing → 📦 Generation
  1. Crawler Module (crawl_site.py)

  2. AI Processing (remake_site_with_ai.py)

  3. Dashboard Interface (dashboard.py)

🧠 AI & Technical Details

Prompt Engineering

  • Holistic Analysis: All crawled content processed simultaneously for cohesive design via prompts/rebuild_prompt.txt
  • Design Principles: Mobile-first responsiveness, SEO optimization, accessibility
  • Brand Preservation: Maintains original brand identity while modernizing experience
  • Structured Output: JSON-formatted response with global CSS and individual page HTML

Security & Reliability

Performance Considerations

  • Context Window: Leverages large context windows (1M+ tokens) for comprehensive analysis
  • Scalable Architecture: Modular design supports easy enhancement and maintenance
  • Error Resilience: Graceful handling of network issues, API limits, and malformed content

🛠️ Troubleshooting

Common Issues & Solutions

Issue Solution Code Reference
Missing Dependencies Run pip install -r requirements.txt in activated virtual environment requirements.txt
ChromeDriver Issues Ensure ChromeDriver matches Chrome version and is in PATH setup_driver()
API Key Not Found Verify GOOGLE_GEMINI_API_KEY environment variable is set load_gemini_api_key()
Timeout Errors Check internet connection; large sites may need multiple attempts TimeoutException
JSON Parse Errors AI model occasionally returns malformed JSON; retry the process json.JSONDecodeError
Memory Issues Use gemini-2.5-flash-preview-05-20 for large sites instead of pro model gemini_generate_entire_site()

Debug Mode

# Enable verbose logging
export DEBUG_MODE=1
streamlit run dashboard.py

Getting Help

  • 📖 Documentation: Check docs/ folder for comprehensive guides
  • 🐛 Issues: Report bugs via GitHub Issues
  • 💬 Discussions: Join community discussions for usage questions
  • 📧 Contact: Reach out for enterprise or custom solutions

📚 Documentation


🤝 Contributing

We welcome contributions! Here's how you can help:

Areas for Enhancement

  • 🌐 Additional AI Models: Support for Claude, GPT-4, or other language models
  • 🚀 Performance Optimization: Parallel processing for large sites
  • 🎨 Design Templates: Pre-built design themes and templates
  • 📱 Mobile Optimization: Enhanced mobile-specific optimizations
  • 🔍 SEO Features: Advanced SEO analysis and recommendations

Development Setup

# Fork the repository and clone your fork
git clone https://github.com/your-username/ai-website-modernizer.git

# Create feature branch
git checkout -b feature/your-feature-name

# Make changes and test thoroughly
python -m pytest tests/  # When tests are added

# Submit pull request

📄 License

MIT License - see LICENSE file for details.


🚀 Quick Reference

Key Files & Functions

Configuration Constants

About

AI website modernizer — turns existing websites into modern, responsive, SEO-optimized pages using Gemini.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages