Back to Blog
January 17, 20266 min readReplay for Fresh:

Replay for Fresh: Islands Architecture UI from Video

R
Replay Team
Developer Advocates

TL;DR: Replay revolutionizes Fresh.js development by generating Island Architecture-compliant UI code directly from video recordings of user interactions, accelerating development and ensuring accurate behavior replication.

Stop building UI from static mockups. The industry standard of translating static images into dynamic code is fundamentally broken. Designers design, developers interpret. This gap introduces errors, delays, and a constant back-and-forth that kills productivity. We need a source of truth that captures behavior, not just appearance.

Enter Replay.

Replay is a video-to-code engine powered by Gemini that understands user behavior and automatically reconstructs fully functional UI components. Forget pixel-perfect imitations; Replay delivers behavior-driven reconstruction. This means Replay doesn’t just see what’s on the screen; it understands what the user is trying to do.

This is especially powerful for frameworks like Fresh.js, where Island Architecture demands granular control and efficient hydration. Replay bridges the gap between design intent and functional implementation in a way that screenshot-to-code tools simply can't.

Replay and Fresh.js: A Perfect Match#

Fresh.js thrives on its Island Architecture: small, independent components that hydrate only when necessary. This approach delivers incredible performance but can also increase development complexity. Manually crafting these islands and ensuring they behave as intended can be time-consuming and error-prone.

Replay simplifies this process by generating Fresh.js-compatible code directly from video recordings. Imagine capturing a user interacting with a prototype, uploading that video to Replay, and receiving a fully functional, hydrated Fresh.js component in seconds.

Here's how Replay changes the game:

  • Faster Development: Generate code directly from video, eliminating manual coding and reducing development time.
  • Accurate Behavior Replication: Replay understands user intent, ensuring that the generated code behaves exactly as intended.
  • Reduced Errors: Minimize interpretation errors by using video as the single source of truth.
  • Improved Collaboration: Facilitate seamless collaboration between designers and developers by providing a common language: user behavior.

How Replay Works with Fresh.js#

Replay leverages Behavior-Driven Reconstruction to analyze video recordings and generate code. This process involves several key steps:

  1. Video Analysis: Replay analyzes the video to identify UI elements, user interactions, and state changes.
  2. Behavior Understanding: Replay uses Gemini to understand the user's intent and the underlying logic of the interaction.
  3. Code Generation: Replay generates Fresh.js-compatible code, including:
    • Island components with necessary hydration logic.
    • Event handlers to replicate user interactions.
    • State management to maintain UI consistency.
  4. Style Injection: Replay infuses relevant styling, ensuring the generated components visually match the video.
  5. Supabase Integration (Optional): Replay can automatically connect your UI components to your Supabase backend, simplifying data management.

From Video to Code: A Practical Example#

Let's say you have a video recording of a user interacting with a simple counter component built with Fresh.js. The component has two buttons: one to increment the counter and one to decrement it.

Here's how you can use Replay to generate the code for this component:

Step 1: Record the Interaction#

Record a video of yourself interacting with the counter component. Make sure to clearly demonstrate the increment and decrement actions.

Step 2: Upload to Replay#

Upload the video to Replay. Replay will analyze the video and identify the UI elements and user interactions.

Step 3: Review and Refine (If Necessary)#

Review the generated code. Replay provides a user-friendly interface to refine the code if necessary.

Step 4: Integrate into Your Fresh.js Project#

Copy the generated code into your Fresh.js project.

Here's an example of the code Replay might generate:

typescript
// islands/Counter.tsx import { useState } from "preact/hooks"; export default function Counter(props: { start: number }) { const [count, setCount] = useState(props.start); const increment = () => { setCount(count + 1); }; const decrement = () => { setCount(count - 1); }; return ( <div> <button onClick={decrement}>-</button> <span>{count}</span> <button onClick={increment}>+</button> </div> ); }

This code creates a fully functional counter component with increment and decrement buttons. The component uses Preact hooks for state management and is ready to be integrated into your Fresh.js application.

💡 Pro Tip: For complex interactions, break down the video into smaller segments. This will help Replay generate more accurate and concise code.

Replay vs. Traditional Methods#

Let's compare Replay with traditional UI development methods and screenshot-to-code tools:

FeatureTraditional CodingScreenshot-to-CodeReplay
InputMockups, SpecsScreenshotsVideo
Behavior AnalysisManual InterpretationLimited✅ Full Behavioral Analysis
Code AccuracyHigh (depending on developer skill)LowHigh
Development SpeedSlowMediumFast
Fresh.js SupportManualLimited✅ Optimized for Island Architecture
Learning CurveHighMediumLow
MaintenanceHighMediumLow

⚠️ Warning: While Replay significantly accelerates development, it's crucial to review the generated code and ensure it aligns with your project's coding standards and best practices.

Beyond the Basics: Advanced Features#

Replay offers a range of advanced features to further enhance your Fresh.js development workflow:

  • Multi-page Generation: Generate code for entire user flows, not just individual components.
  • Supabase Integration: Automatically connect your UI components to your Supabase backend.
  • Style Injection: Infuse relevant styling, ensuring the generated components visually match the video.
  • Product Flow Maps: Visualize user flows and identify areas for improvement.

Replay in Action: Use Cases#

Here are a few examples of how Replay can be used in real-world Fresh.js projects:

  • Rapid Prototyping: Quickly create interactive prototypes from video recordings.
  • UI Component Generation: Generate reusable UI components from video demonstrations.
  • A/B Testing: Create variations of UI components for A/B testing.
  • Legacy Code Modernization: Reconstruct legacy UI components from video recordings.

📝 Note: Replay is constantly evolving, with new features and improvements being added regularly.

Frequently Asked Questions#

Is Replay free to use?#

Replay offers a free tier with limited features. Paid plans are available for more advanced features and usage. Check out our pricing page for details.

How is Replay different from v0.dev?#

v0.dev and similar tools rely on static screenshots. Replay analyzes video, enabling it to understand user behavior and generate more accurate and functional code. Replay’s Behavior-Driven Reconstruction is a fundamentally different approach.

What frameworks does Replay support?#

Currently, Replay supports React, Next.js, and Fresh.js, with more frameworks planned for the future.

How secure is Replay?#

Replay uses industry-standard security practices to protect your data. All video recordings are stored securely and are only accessible to authorized users.

What kind of videos work best with Replay?#

Clear, well-lit videos with minimal background noise work best. Focus on capturing the user interactions clearly.


Ready to try behavior-driven code generation? Get started with Replay - transform any video into working code in seconds.

Ready to try Replay?

Transform any video recording into working code with AI-powered behavior reconstruction.

Launch Replay Free