Capture Live Apps

Capture rendered DOM and screenshots from a running local dev server, an open browser tab, or a static HTML file, and upload them to the Stitch Canvas.

When you’re redesigning an existing page or prototyping a new feature inside an established app, don’t start from a blank canvas. Bring your real running UI onto the Stitch Canvas first so your edits build on your actual layout and styles.

Capture routes with the /stitch skill

With the /stitch skill installed (stitch agent-skills add), start your local dev server and ask your coding agent to capture your routes onto your Stitch project:

PROMPT
/stitch Capture the /checkout and /dashboard routes from my running dev server and upload them to my Stitch Canvas project.

Your agent auto-detects your running Vite, Next.js, or Astro dev server port, captures the hydrated DOM and a 1280x800 verification screenshot for each route, checks that no login modal blocked the page, and uploads the screens to your Stitch project.

Capture and upload from the terminal

The CLI splits capturing and uploading into two separate commands so you can always inspect what was captured on disk before sending anything to Stitch.

Capture a route

Pass a URL to stitch capture. It loads the page in headless Chrome, so it works for React, Next.js, Vite, or Vue apps that need JavaScript hydration, WebFonts, and computed styles:

stitch capture http://localhost:3000/checkout --wait-for "#checkout-root"

By default the HTML is saved to .stitch/captures/<route>.html (here, .stitch/captures/checkout.html). Pass -o to choose the path yourself, or -o - to print the HTML to stdout. Alongside the HTML, the CLI saves a 1280x800 verification screenshot under .stitch/ with the same name (for example .stitch/captures/checkout.png) so you can check the capture at a glance.

If your app keeps loading after the first paint, --wait-until (networkidle0, networkidle2, load, or domcontentloaded) and --settle-timeout control how long the CLI waits for spinners and skeletons to clear. If the page redirects to a different route (for example, to a login page), the capture fails rather than saving the wrong page. Pass --allow-redirect to save it anyway.

Capture a static file or server-rendered HTML

Pass a path instead of a URL to make a saved or pre-rendered HTML file self-contained. Add --origin so root-relative assets are inlined from your dev server:

stitch capture ./dist/index.html --origin http://localhost:3000 -o .stitch/index.html

For finer control, the advanced subcommands are still available: stitch capture browser (headless Chrome with extra flags such as --probe and --screenshot), stitch capture port (fetches server-rendered HTML over HTTP without running JavaScript), and stitch capture file (also reads from --stdin). Run stitch capture routes to list the routes the CLI finds in your codebase.

Get past login screens without touching code

Never edit your application source code just to bypass a login screen for a capture. stitch capture gives you three clean ways to capture authenticated views:

  • Sign in directly in the open tab: Log in or navigate inside the browser tab driven by the chrome-devtools CLI, then capture that tab as it is, without reloading:

    stitch capture --tab -o .stitch/dashboard.html
    
  • Pass saved cookies and localStorage: Point --auth at a Playwright storageState JSON file:

    stitch capture http://localhost:4321/schedule \
      --auth .stitch/storage.json \
      -o .stitch/schedule.html
    
  • Run a sign-in script before snapshot: Pass --prepare to run a small setup script in the page before the DOM is captured:

    stitch capture http://localhost:4321/login \
      --prepare .stitch/signin.js \
      --wait-for "#dashboard" \
      --allow-redirect \
      -o .stitch/dashboard.html
    

Upload to the Stitch Canvas

Once your local .html snapshot or image looks right, place it on your Stitch Canvas project with stitch upload screen:

stitch upload screen .stitch/checkout.html \
  --route "/checkout" \
  --title "Checkout"

Before saving or uploading a snapshot, the CLI strips secrets it finds in the page, such as values from your local .env files, API keys, OAuth tokens, and private keys embedded in hydration data or inline scripts.

Pass --route when uploading an application route so Stitch records that screen as the canonical reference for /checkout. Once uploaded, open your project with stitch open project or start iterating on the screen with stitch edit screen.

Original: https://stitch.withgoogle.com/docs/cli/capture-and-upload/

Translated from the official Google Stitch documentation. Original content © Google LLC. This is an independent, unofficial translation.