How to Clone Single-Page Applications (SPAs) with the AI Website Cloner Template

Yes, the AI Website Cloner Template fully supports cloning single-page applications by capturing rendered DOM states through a headless browser pipeline that operates independently of the site's underlying architecture.

The JCodesMore/ai-website-cloner-template provides a complete system for reverse-engineering websites into Next.js 16 App Router projects. Whether you need to clone single-page applications or traditional multi-page sites, the template's headless browser workflow extracts design tokens, assets, and interaction patterns directly from the rendered DOM.

How SPA Cloning Works at the DOM Level

The template does not rely on static HTML files. Instead, it launches a headless browser to execute JavaScript and capture the fully rendered DOM. This approach works identically for SPAs because the cloning pipeline records visual states, computed CSS values, and user interactions (scroll, click, hover) after the JavaScript framework has rendered the page.

According to the repository's docs/research/INSPECTION_GUIDE.md, the inspection stage extracts design tokens and interaction data from any rendered page, regardless of whether the underlying site uses React Router, Vue Router, or another client-side navigation system.

Running the Clone Command on SPA URLs

To clone single-page applications, use the /clone-website command with a single target URL. The template accepts one or more URLs, and supplying a single SPA URL follows the standard execution path established in .opencode/commands/clone-website.md.


# Install dependencies

npm install

# Start your AI coding agent with browser access

claude --chrome

# Execute the clone command on the SPA

/clone-website https://example-spa.com

The process documented in the README.md executes five distinct phases:

  1. Reconnaissance – Launches a headless browser, scrolls through the page, and captures all visual states including dynamically loaded content.
  2. Foundation – Downloads fonts, colors, images, and videos referenced by the SPA's rendered output.
  3. Component Specs – Writes detailed specification files to docs/research/components/ with exact CSS values and interaction details extracted from the DOM.
  4. Parallel Build – Spins up builder agents (one per component) that generate React components using the Next.js 16 App Router structure.
  5. Assembly & QA – Merges generated worktrees, wires the page together, and runs a visual diff against the original SPA.

Source Files That Enable SPA Cloning

Several key files in the repository define how the template handles SPA architectures:

  • .opencode/commands/clone-website.md – Defines the command syntax /clone-website <url> and documents multi-URL handling, confirming that single-URL SPAs are fully supported.
  • src/app/page.tsx – Serves as the generated entry point for cloned sites, functioning correctly for both multi-page applications and SPAs.
  • CHANGELOG.md – Contains the "Multi-URL support for /clone-website" entry, which implicitly validates that single-URL SPA scenarios work as a subset of the multi-URL functionality.
  • docs/research/INSPECTION_GUIDE.md – Details how the inspection stage reverse-engineers design tokens from rendered pages, including JavaScript-heavy SPAs.

Output Structure for Cloned SPAs

The template generates a Next.js 16 App Router project regardless of the original site's architecture. For SPAs, this means the output maintains the single-page navigation pattern while converting the original framework's components into React-based equivalents. The generated src/app/page.tsx imports the reconstructed components and preserves the interaction patterns captured during the reconnaissance phase.

Summary

  • The AI Website Cloner Template captures SPAs by rendering them in a headless browser and extracting the post-JavaScript DOM.
  • The /clone-website command accepts single URLs, making SPA cloning a standard use case supported by the multi-URL architecture.
  • Output generates as a Next.js 16 App Router project with exact CSS values and interaction specs preserved in docs/research/components/.
  • Key implementation files include .opencode/commands/clone-website.md, src/app/page.tsx, and docs/research/INSPECTION_GUIDE.md.

Frequently Asked Questions

Does the template execute JavaScript when cloning SPAs?

Yes. The reconnaissance phase runs a headless browser that fully executes JavaScript, allowing the template to capture the rendered DOM state rather than static HTML. This ensures accurate extraction of dynamically loaded content and client-side rendered styles.

Can I clone SPAs that use React Router or Vue Router?

Yes. Because the template operates at the visual DOM level after rendering completes, it works with any client-side routing system including React Router, Vue Router, or Angular Router. The extracted components reconstruct the final UI state regardless of the original navigation implementation.

How does the template handle dynamic content in SPAs?

The headless browser scrolls through the entire page and captures all visual states, including content loaded via XHR or Fetch API calls. The inspection pipeline records these states as static component specifications in the research documentation, which builder agents then convert to React components.

Will the cloned SPA maintain the original responsive behavior?

Yes. The template records responsive breakpoints and hover states during the reconnaissance phase. The generated Next.js project includes these exact media queries and interaction handlers, preserving the original SPA's responsive design and user experience.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →