Transform any website into a modern, responsive, and SEO-optimized experience using Google Gemini AI.
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.
- Web Crawler (
crawl_site.py) - Selenium-based content extraction with SSRF protection - AI Processor (
remake_site_with_ai.py) - Gemini AI integration for holistic site redesign - Dashboard Interface (
dashboard.py) - Streamlit UI for seamless user experience - Prompt Engineering (
prompts/rebuild_prompt.txt) - Sophisticated AI instructions for site generation
- 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
- 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
- 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
- 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
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]
- π·οΈ Web Crawling:
crawl_site.py:main()discovers and crawls website pages using Selenium WebDriver - π Content Extraction:
save_page_data()structures HTML, CSS, images, and text content - π§ AI Analysis:
remake_site_with_ai.pyprocesses all content with Google Gemini for comprehensive understanding - π¨ Design Generation: AI creates modern, responsive design with improved UX and SEO
- π¦ Output Generation: Produces clean, organized website files ready for deployment
- Python 3.9+ (see
requirements.txt) - Chrome browser and ChromeDriver (for Selenium WebDriver in
crawl_site.py:setup_driver()) - Google Gemini API key (Get one here)
git clone <repository-url>
cd ai-website-modernizer# 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# 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
π One-Click Startup (Recommended)
# macOS/Linux
./start.sh
# Windows
start.batManual Launch
streamlit run dashboard.pyOpen your browser to http://localhost:8501 and start transforming websites! π
The startup scripts automatically handle virtual environment creation, dependency installation, and dashboard launch.
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
python crawl_site.py https://example.com --max_pages 10 --depth 2python remake_site_with_ai.py example.com --model gemini-2.5-flash-preview-05-20Available Models:
gemini-2.5-flash-preview-05-20(default, fast)gemini-1.5-pro-latest(comprehensive, large context)
π¦ 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
π·οΈ Crawl β π§ AI Processing β π¦ Generation
-
Crawler Module (
crawl_site.py)- Selenium WebDriver with
setup_driver()for JavaScript-rendered sites - Structured content extraction via
get_page_content() - Configurable depth and page limits with
DEFAULT_MAX_PAGESandDEFAULT_CRAWL_DEPTH
- Selenium WebDriver with
-
AI Processing (
remake_site_with_ai.py)- Google Gemini integration with
gemini_generate_entire_site() - Holistic content analysis and design generation using
prompts/rebuild_prompt.txt - Enhanced path traversal protection with filename validation
- Google Gemini integration with
-
Dashboard Interface (
dashboard.py)- Streamlit-powered user interface with
st.set_page_config() - Real-time progress monitoring via
update_step_status() - Manifest-based reliable inter-process communication with
read_crawl_manifest()
- Streamlit-powered user interface with
- 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
- π Secure API Handling: Environment-based API key management via
load_gemini_api_key() - π‘οΈ Path Traversal Protection: Enhanced filename validation in
remake_site_with_ai.py:369-387 - β±οΈ Timeout Management: Prevents hanging on unresponsive pages with
driver.set_page_load_timeout(30) - π Manifest Communication: Reliable inter-script communication via
crawl_manifest.json
- 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
| 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() |
# Enable verbose logging
export DEBUG_MODE=1
streamlit run dashboard.py- π 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
- Setup Guide - Complete installation and configuration
- Architecture Guide - Technical system design
- API Documentation - Function references and examples
We welcome contributions! Here's how you can help:
- π 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
# 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 requestMIT License - see LICENSE file for details.
- Main Crawler:
crawl_site.py:main()- Entry point for web crawling - AI Generation:
remake_site_with_ai.py:main()- AI-powered site rebuilding - Dashboard:
dashboard.py:run_full_process()- Complete transformation pipeline - Content Extraction:
get_page_content()- Page data extraction logic - Security Validation:
is_safe_url()- SSRF protection implementation
- Crawl Limits:
DEFAULT_MAX_PAGES = 20,DEFAULT_CRAWL_DEPTH = 2 - File Names:
COPY_FILENAME = "copy.txt",HTML_FILENAME = "page.html" - AI Models: Available in
remake_site_with_ai.py