Skip to content

AI-powered website cloning tool with pixel-perfect accuracy, live visual/code editing, DOM analysis, and Google Gemini integration. Built with Next.js, React, Puppeteer, and Monaco Editor.

Notifications You must be signed in to change notification settings

SPatil2026/same

Repository files navigation

🌐 Website Cloner

Advanced Website Cloning & Analysis Tool

Clone any website with pixel-perfect accuracy, analyze DOM structures, and edit with AI assistance

Next.js TypeScript Tailwind CSS Puppeteer Google AI


πŸš€ Overview

Website Cloner is a sophisticated web application that allows you to clone any website with remarkable precision, analyze its structure, and edit it with AI-powered assistance. Built with cutting-edge technologies, it provides developers and designers with powerful tools for website analysis, prototyping, and learning.

✨ Key Features

  • 🎯 Pixel-Perfect Cloning: Clone any website with preserved styling, layout, and visual fidelity
  • 🧠 AI-Powered Analysis: Integrated Google Gemini AI for intelligent code analysis and suggestions
  • πŸ”§ Live Visual Editor: Edit websites directly in the browser with drag-and-drop functionality
  • 🌳 DOM Tree Visualization: Interactive DOM structure analysis with semantic scoring
  • πŸ“± Responsive Design: Fully responsive interface that works on all devices
  • ⚑ Real-time Preview: Instant preview of changes with hot-reload capabilities
  • 🎨 Monaco Code Editor: Professional code editing experience with syntax highlighting
  • πŸ“Š Website Analytics: Comprehensive analysis of website structure and performance
  • πŸ” Semantic Analysis: Intelligent identification of website components and layout patterns

πŸ› οΈ Tech Stack

Frontend Framework

  • Next.js 15.3.3 - React framework with App Router for server-side rendering and optimal performance
  • React 19.0 - Latest React with concurrent features and improved performance
  • TypeScript 5.0 - Type-safe development with enhanced developer experience

Styling & UI

  • Tailwind CSS 4.0 - Utility-first CSS framework for rapid UI development
  • Tailwind Typography - Beautiful typography defaults for content-rich applications
  • Custom CSS - Advanced styling for Monaco Editor and interactive components

Web Scraping & Analysis

  • Puppeteer 24.10.1 - Headless Chrome automation for website screenshots and DOM extraction
  • Cheerio 1.1.0 - Server-side jQuery implementation for HTML parsing and manipulation
  • Axios 1.10.0 - HTTP client for fetching external resources and stylesheets

AI Integration

  • Google Generative AI 0.21.0 - Gemini 2.5 Flash model for intelligent code analysis
  • Custom AI Prompts - Specialized prompts for website component analysis and suggestions

Code Editor

  • Monaco Editor 0.52.2 - VS Code's editor for in-browser code editing
  • React Monaco Editor 0.58.0 - React wrapper with TypeScript support

Development Tools

  • ESLint 9 - Code linting with Next.js configuration
  • PostCSS - CSS processing and optimization
  • Sharp 0.34.2 - High-performance image processing

πŸš€ Installation

Prerequisites

  • Node.js 18.0 or higher
  • npm, yarn, pnpm, or bun package manager
  • Google Gemini API key (for AI features)

Quick Start

  1. Clone the repository

    git clone https://github.com/yourusername/website-cloner.git
    cd website-cloner
  2. Install dependencies

    npm install
    # or
    yarn install
    # or
    pnpm install
    # or
    bun install
  3. Set up environment variables

    cp .env.local.example .env.local

    Add your Google Gemini API key to .env.local:

    GEMINI_API_KEY=your_gemini_api_key_here
  4. Run the development server

    npm run dev
    # or
    yarn dev
    # or
    pnpm dev
    # or
    bun dev
  5. Open your browser

    Navigate to http://localhost:3000 to see the application.


πŸ’‘ Usage

Basic Website Cloning

  1. Enter URL: Input any website URL in the search field
  2. Preview: Click "Preview Website" to analyze and capture the site
  3. Clone: Click "Show Final Output" to generate the cloned version
  4. Edit: Use the visual editor or code editor to make modifications

Advanced Features

🎨 Visual Editor Mode

  • Toggle edit mode to enable drag-and-drop editing
  • Resize elements with corner handles
  • Move components between containers
  • Real-time visual feedback

🧠 AI Assistant

  • Ask Gemini AI about code structure and components
  • Get suggestions for improvements
  • Analyze website patterns and best practices
  • Interactive code analysis and explanations

🌳 DOM Tree Analysis

  • Visualize website structure hierarchically
  • Semantic scoring for accessibility and SEO
  • Component identification and classification
  • Performance and structure recommendations

πŸ’» Code Editor

  • Professional Monaco editor with syntax highlighting
  • Real-time HTML/CSS editing
  • Auto-completion and error detection
  • Integrated with live preview

πŸ—οΈ Project Structure

src/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ api/
β”‚   β”‚   β”œβ”€β”€ analyze-dom/     # DOM structure analysis
β”‚   β”‚   β”œβ”€β”€ ask/             # Gemini AI integration
β”‚   β”‚   β”œβ”€β”€ clone/           # Website cloning logic
β”‚   β”‚   └── preview/         # Website preview generation
β”‚   β”œβ”€β”€ globals.css          # Global styles
β”‚   β”œβ”€β”€ layout.tsx           # Root layout component
β”‚   └── page.tsx             # Main application page
β”œβ”€β”€ components/
β”‚   └── MonacoEditor.tsx     # Code editor component
└── utils/
    └── gemini.js            # Gemini AI utilities

πŸ”§ API Endpoints

POST /api/preview

Analyzes a website and generates preview data including screenshots, metadata, and basic analysis.

POST /api/clone

Performs deep cloning of a website with computed styles and DOM tree extraction.

POST /api/analyze-dom

Analyzes DOM structure and provides semantic scoring and improvement suggestions.

POST /api/ask

Interacts with Gemini AI for code analysis and intelligent suggestions.


🌟 Key Capabilities

Website Analysis

  • Metadata Extraction: Title, description, Open Graph data, favicons
  • Screenshot Generation: Full-page and viewport screenshots
  • Style Extraction: Inline, internal, and external CSS collection
  • Asset Discovery: Images, fonts, and resource identification

DOM Processing

  • Computed Styles: Real browser-computed CSS values
  • Semantic Classification: Automatic component type detection
  • Structure Analysis: Layout patterns and hierarchy mapping
  • Accessibility Scoring: Semantic HTML usage evaluation

Interactive Editing

  • Visual Manipulation: Drag, drop, and resize elements
  • Code Synchronization: Bidirectional sync between visual and code editors
  • Live Preview: Real-time rendering of changes
  • Undo/Redo: Change history management

🀝 Contributing

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

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Commit your changes: git commit -m 'Add amazing feature'
  4. Push to the branch: git push origin feature/amazing-feature
  5. Open a Pull Request

Development Guidelines

  • Follow TypeScript best practices
  • Use Tailwind CSS for styling
  • Write meaningful commit messages
  • Add tests for new features
  • Update documentation as needed

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ™ Acknowledgments

  • Next.js Team - For the incredible React framework
  • Google AI - For the powerful Gemini API
  • Puppeteer Team - For headless browser automation
  • Monaco Editor - For the professional code editing experience
  • Tailwind CSS - For the utility-first CSS framework
  • Open Source Community - For the amazing tools and libraries

πŸ“ž Support

If you encounter any issues or have questions:


Made with ❀️ by developers, for developers

⭐ Star this repo if you find it useful!

About

AI-powered website cloning tool with pixel-perfect accuracy, live visual/code editing, DOM analysis, and Google Gemini integration. Built with Next.js, React, Puppeteer, and Monaco Editor.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published