Back to Blog
January 5, 20266 min readHow to convert

How to convert a UI video into a Vue.js app with TypeScript and Pinia

R
Replay Team
Developer Advocates

TL;DR: Convert UI screen recordings into a fully functional Vue.js application with TypeScript and Pinia using Replay's behavior-driven reconstruction engine.

The promise of AI-powered code generation has been around for years, but the reality often falls short. Screenshot-to-code tools offer a static representation, missing the crucial element: user behavior. What if you could capture the intent behind the UI, turning a simple screen recording into a dynamic, data-driven application? That's the power of behavior-driven reconstruction.

From Video to Vue: A Revolutionary Workflow#

Traditional approaches to UI development rely on manual coding, design mockups, and iterative feedback loops. This process is time-consuming and prone to misinterpretations. Replay changes the game by leveraging video analysis to understand user flows and interactions, generating working code directly from screen recordings. This is especially powerful for rapidly prototyping, reverse engineering existing UIs, or onboarding new developers to a project.

Why Vue.js, TypeScript, and Pinia?#

Vue.js offers a progressive framework for building user interfaces, known for its simplicity and flexibility. TypeScript adds static typing, enhancing code maintainability and reducing errors. Pinia provides a type-safe, intuitive state management solution that seamlessly integrates with Vue.js. This combination provides a robust and scalable foundation for modern web applications.

Replay in Action: Building a To-Do App#

Let's walk through converting a video of a simple To-Do app UI into a fully functional Vue.js application with TypeScript and Pinia, using Replay.

Step 1: Capture the UI Flow#

Record a video demonstrating the key interactions with the To-Do app:

  1. Adding a new task
  2. Marking a task as complete
  3. Deleting a task

Ensure the video is clear and captures the entire screen, including any relevant data sources (e.g., a local storage view).

Step 2: Upload and Analyze with Replay#

Upload the video to Replay. The engine will analyze the video, identifying UI elements, user interactions, and data flow. This process leverages Gemini's advanced video understanding capabilities to interpret the behavior demonstrated in the recording.

Step 3: Configure the Output#

Specify the desired output stack: Vue.js, TypeScript, and Pinia. Replay will then generate the corresponding code, including:

  • Vue.js components for each UI element
  • TypeScript interfaces for data models
  • Pinia stores for managing application state

Step 4: Review and Refine the Code#

Replay provides a code preview, allowing you to review and refine the generated code. You can adjust styling, modify data bindings, and add custom logic as needed.

typescript
// Example generated component - TodoItem.vue <template> <div class="todo-item"> <input type="checkbox" :checked="todo.completed" @change="toggleTodo(todo.id)"> <span :class="{ completed: todo.completed }">{{ todo.text }}</span> <button @click="deleteTodo(todo.id)">Delete</button> </div> </template> <script setup lang="ts"> import { defineProps, defineEmits } from 'vue'; import { Todo } from './types'; const props = defineProps<{ todo: Todo; }>(); const emit = defineEmits(['toggle', 'delete']); const toggleTodo = (id: number) => { emit('toggle', id); }; const deleteTodo = (id: number) => { emit('delete', id); }; </script> <style scoped> .todo-item { display: flex; align-items: center; padding: 8px; border-bottom: 1px solid #eee; } .completed { text-decoration: line-through; color: #888; } </style>
typescript
// Example Pinia store - useTodos.ts import { defineStore } from 'pinia'; import { Todo } from './types'; interface State { todos: Todo[]; } export const useTodos = defineStore('todos', { state: (): State => ({ todos: [], }), actions: { addTodo(text: string) { const newTodo: Todo = { id: Date.now(), text, completed: false, }; this.todos.push(newTodo); }, toggleTodo(id: number) { const todo = this.todos.find((todo) => todo.id === id); if (todo) { todo.completed = !todo.completed; } }, deleteTodo(id: number) { this.todos = this.todos.filter((todo) => todo.id !== id); }, }, });

Step 5: Integrate with Supabase (Optional)#

Replay supports seamless integration with Supabase. You can configure the generated code to persist data to a Supabase database, enabling real-time collaboration and data synchronization.

Step 6: Style Injection#

Replay allows you to inject custom CSS styles to refine the look and feel of the generated UI. You can either provide a CSS file or use Replay's built-in style editor.

Replay vs. Traditional Methods#

FeatureScreenshot-to-CodeManual CodingReplay
Input SourceStatic ImagesHuman InputVideo Recordings
Behavior Analysis✅ (Manual)✅ (Automated)
Code GenerationBasic UI ElementsFull ControlBehavior-Driven
Data BindingLimitedFull ControlAutomated
Time to PrototypeFast (Initial)SlowVery Fast
Learning CurveLowHighLow
Accuracy of IntentLowHighHigh
Supabase IntegrationRequires Manual SetupRequires Manual Setup✅ Built-in
Style InjectionLimitedFull Control

Benefits of Behavior-Driven Reconstruction#

  • Rapid Prototyping: Generate working UI prototypes in minutes, not days.
  • Improved Accuracy: Capture user intent and translate it into functional code.
  • Reduced Development Time: Automate repetitive coding tasks and focus on complex logic.
  • Enhanced Collaboration: Share video recordings and generated code with team members for faster feedback and iteration.
  • Reverse Engineering: Quickly understand and recreate existing UIs by recording their behavior.
  • Onboarding: Use video recordings to demonstrate UI workflows and generate code examples for new developers.
  • Multi-page generation: Replay can generate multi-page applications, understanding the navigation flow from the video.
  • Product Flow Maps: Replay automatically generates flow maps from the video, visualizing user journeys.

💡 Pro Tip: For best results, ensure your video recordings are clear, well-lit, and capture the entire screen. Speak clearly while demonstrating the UI interactions to further aid Replay's analysis.

📝 Note: Replay's code generation is not intended to replace human developers entirely. It's a powerful tool to accelerate the development process and free up developers to focus on more complex tasks.

⚠️ Warning: While Replay strives for accuracy, always review and test the generated code thoroughly before deploying it to production.

Frequently Asked Questions#

Is Replay free to use?#

Replay offers a free tier with limited features. Paid plans are available for more advanced functionality and higher usage limits. Check the Replay pricing page for more details.

How is Replay different from v0.dev?#

v0.dev focuses on generating UI components based on text prompts. Replay, on the other hand, analyzes video recordings to understand user behavior and generates complete applications, including data binding and state management. Replay focuses on what the user is doing, not just what the UI looks like.

Can I use Replay with other frameworks besides Vue.js?#

Replay currently supports Vue.js, React, and Angular. Support for other frameworks is planned for future releases.

What kind of videos can Replay process?#

Replay can process screen recordings in various formats, including MP4, MOV, and WebM. The video should be clear and capture the entire screen.

How does Replay handle dynamic data?#

Replay analyzes the video to identify data sources and generates code to fetch and display dynamic data. You can configure the data sources and bindings in the code preview.


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