Skip to content
This repository was archived by the owner on Dec 30, 2025. It is now read-only.

namanxajmera/website-builder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

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

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published