Back to Blog
January 4, 20268 min readHow to Convert

How to Convert a design prototype recorded in a video to a react application with supabase

R
Replay Team
Developer Advocates

TL;DR: Replay leverages video analysis and Gemini to automatically generate a React application with Supabase integration directly from a recorded design prototype walkthrough.

From Video to React App: A Supabase-Powered Transformation#

The handoff between design and development can be painful. Static mockups often miss crucial interaction details, leading to misinterpretations and rework. What if you could simply record a walkthrough of your design prototype and have it automatically converted into a working React application, complete with Supabase integration? That's the promise of behavior-driven reconstruction, and it's now a reality.

Traditional screenshot-to-code tools fall short because they only capture visual elements. They lack the understanding of how the user interacts with the interface – the sequence of clicks, form submissions, and navigation patterns that define the user experience. Replay solves this problem by analyzing video, allowing it to understand user intent and reconstruct the application logic accordingly.

Replay: Behavior-Driven Reconstruction#

Replay is a video-to-code engine that uses Gemini to analyze video recordings of design prototypes and automatically generate working UI code. Unlike traditional screenshot-to-code tools, Replay focuses on behavior, not just appearance. This allows it to create more accurate and functional applications.

Here's how Replay stacks up against other code generation approaches:

FeatureScreenshot-to-CodeManual CodingReplay
InputScreenshotsDesign SpecsVideo
Behavior Analysis✅ (Manual)
SpeedFastSlowFast
AccuracyLowHighHigh
Supabase IntegrationRequires Manual SetupRequires Manual SetupAutomated
Multi-Page SupportLimited✅ (Manual)
Learning CurveLowHighLow

Building a React App with Supabase from a Video: A Step-by-Step Guide#

Let's walk through the process of converting a design prototype video into a functional React application with Supabase integration using Replay. We'll assume you have a video recording of a design prototype showcasing a simple to-do list application. The video demonstrates adding tasks, marking them as complete, and deleting them.

Step 1: Project Setup and Requirements#

Before diving into Replay, ensure you have the following:

  • A Supabase account and project set up. Obtain your Supabase URL and anon key.
  • Node.js and npm (or yarn) installed on your machine.
  • A video recording of your design prototype walkthrough. The clearer the video, the better the reconstruction.

Step 2: Upload and Process the Video in Replay#

  1. Upload: Upload your design prototype video to the Replay platform.
  2. Analysis: Replay will analyze the video, identifying UI elements, user interactions, and data flow. This process leverages Gemini's powerful video understanding capabilities.
  3. Configuration: Configure Supabase integration by providing your Supabase URL and anon key. This allows Replay to automatically generate the necessary code for data persistence.

Step 3: Review and Customize the Generated Code#

After processing the video, Replay will generate a React application with Supabase integration. The generated code includes:

  • React components for each UI element identified in the video.
  • Event handlers for user interactions (e.g., button clicks, form submissions).
  • Supabase API calls for data fetching, creation, updating, and deletion.
  • Basic styling based on the visual elements in the video.

Review the generated code and make any necessary customizations. Replay aims to provide a solid foundation, but you may need to fine-tune the code to meet your specific requirements.

💡 Pro Tip: Pay close attention to the generated Supabase API calls. Ensure they align with your Supabase schema and data model.

Step 4: Example Code: Adding a New Task#

Here's an example of the code Replay might generate for adding a new task to the to-do list:

typescript
// src/components/TaskInput.tsx import React, { useState } from 'react'; import { createClient } from '@supabase/supabase-js'; const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL || ''; const supabaseAnonKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY || ''; const supabase = createClient(supabaseUrl, supabaseAnonKey); interface TaskInputProps { onTaskAdded: () => void; } const TaskInput: React.FC<TaskInputProps> = ({ onTaskAdded }) => { const [newTask, setNewTask] = useState(''); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); if (newTask.trim() === '') return; const { data, error } = await supabase .from('todos') .insert([{ task: newTask, completed: false }]); if (error) { console.error('Error adding task:', error); } else { console.log('Task added successfully:', data); setNewTask(''); onTaskAdded(); // Notify parent component to refresh the task list } }; return ( <form onSubmit={handleSubmit}> <input type="text" placeholder="Add new task" value={newTask} onChange={(e) => setNewTask(e.target.value)} /> <button type="submit">Add</button> </form> ); }; export default TaskInput;

This code snippet demonstrates:

  • Importing necessary modules, including
    text
    createClient
    from
    text
    @supabase/supabase-js
    .
  • Initializing the Supabase client with your project URL and anon key.
  • Using the
    text
    supabase.from('todos').insert()
    method to add a new task to the
    text
    todos
    table.
  • Handling potential errors and updating the task list after a successful insertion.

📝 Note: Replay automatically configures environment variables for Supabase URL and anon key. Ensure these are properly set in your development environment.

Step 5: Example Code: Displaying the Task List#

Here's an example of the code Replay might generate for displaying the task list:

typescript
// src/components/TaskList.tsx import React, { useState, useEffect } from 'react'; import { createClient } from '@supabase/supabase-js'; const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL || ''; const supabaseAnonKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY || ''; const supabase = createClient(supabaseUrl, supabaseAnonKey); interface Task { id: number; task: string; completed: boolean; } interface TaskListProps { onTaskUpdated: () => void; } const TaskList: React.FC<TaskListProps> = ({ onTaskUpdated }) => { const [tasks, setTasks] = useState<Task[]>([]); useEffect(() => { fetchTasks(); }, []); const fetchTasks = async () => { const { data, error } = await supabase .from('todos') .select('*') .order('id', { ascending: false }); if (error) { console.error('Error fetching tasks:', error); } else { setTasks(data || []); } }; const handleComplete = async (id: number, completed: boolean) => { const { error } = await supabase .from('todos') .update({ completed: !completed }) .eq('id', id); if (error) { console.error('Error updating task:', error); } else { onTaskUpdated(); // Notify parent component to refresh the task list } }; return ( <ul> {tasks.map((task) => ( <li key={task.id}> <input type="checkbox" checked={task.completed} onChange={() => handleComplete(task.id, task.completed)} /> <span>{task.task}</span> </li> ))} </ul> ); }; export default TaskList;

This code snippet demonstrates:

  • Fetching tasks from the
    text
    todos
    table using
    text
    supabase.from('todos').select('*')
    .
  • Displaying the tasks in a list, with a checkbox to mark them as complete.
  • Updating the task status in the database using
    text
    supabase.from('todos').update()
    .

⚠️ Warning: Remember to implement proper error handling and user authentication in a production environment. Replay provides a basic foundation, but security considerations are your responsibility.

Step 6: Run and Test the Application#

Once you've reviewed and customized the generated code, run the React application using

text
npm start
or
text
yarn start
. Test the application thoroughly to ensure it functions as expected. Verify that data is being correctly stored and retrieved from Supabase.

Replay: Beyond Basic Code Generation#

Replay offers several advanced features that go beyond basic code generation:

  • Multi-page generation: Replay can handle videos that demonstrate navigation between multiple pages or screens, automatically generating the corresponding routes and components.
  • Style injection: Replay can infer basic styling from the video and apply it to the generated components. You can further customize the styling using CSS or a styling library like Material UI or Tailwind CSS.
  • Product Flow maps: Replay can create visual diagrams illustrating the user flows demonstrated in the video, providing a valuable tool for understanding and documenting the application's behavior.

Benefits of Using Replay#

  • Accelerated Development: Drastically reduce the time and effort required to translate design prototypes into working code.
  • Improved Accuracy: Capture subtle interaction details that are often missed in static mockups.
  • Enhanced Collaboration: Facilitate smoother handoffs between designers and developers.
  • Reduced Rework: Minimize misinterpretations and errors by using video as the source of truth.

Frequently Asked Questions#

Is Replay free to use?#

Replay offers a free tier with limited usage. Paid plans are available for more extensive use and access to advanced features. Check the Replay website for the latest pricing information.

How is Replay different from v0.dev?#

v0.dev primarily uses text prompts to generate UI components. Replay, on the other hand, analyzes video recordings of design prototypes, allowing it to understand user behavior and generate more accurate and functional applications. Replay focuses on reconstructing existing designs, while v0.dev is more geared towards generating new designs from scratch.

What types of videos work best with Replay?#

Clear, well-lit videos with a consistent frame rate tend to produce the best results. Avoid videos with excessive camera movement or distractions. The more closely the video resembles a real user interacting with the application, the better Replay will be able to understand the behavior.

What if Replay generates incorrect code?#

Replay is not perfect, and it may occasionally generate incorrect or incomplete code. However, the generated code provides a solid starting point that you can then customize and refine. The more information you provide in the video (e.g., clear demonstrations of user interactions), the more accurate the generated code will be.


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