Back to Blog
January 5, 20268 min readHow to Convert

How to Convert UI Video to Production Next.js App With GraphQL API tested in 2026 for UI apps?

R
Replay Team
Developer Advocates

TL;DR: Learn how to convert UI video recordings into a production-ready Next.js application with a GraphQL API, tested with cutting-edge UI testing frameworks, using Replay's behavior-driven code generation.

The dream of automatically generating code from visual input is finally a reality. But existing screenshot-to-code tools only scratch the surface. They can render static UI elements, but they lack understanding of user intent. What if you could feed a video of a user interacting with an interface and automatically generate a fully functional, production-ready application? That's the power of behavior-driven reconstruction.

This post will guide you through converting a UI video recording into a Next.js application with a GraphQL API, ensuring it's ready for 2026-level UI testing. Forget manual coding from scratch. We're leveraging Replay to handle the heavy lifting.

The Problem: Bridging the Gap Between Design and Code#

Developers spend countless hours translating designs and user flows into code. This process is often manual, error-prone, and time-consuming. Screenshot-to-code tools offer some assistance, but they fail to capture the dynamic nature of user interactions. They can’t understand the why behind the what.

Furthermore, modern applications require robust APIs and comprehensive testing suites. Integrating these elements manually adds significant complexity to the development process. We need a solution that automates not only the UI generation but also the API integration and testing setup.

The Solution: Behavior-Driven Reconstruction with Replay#

Replay offers a novel approach by analyzing video recordings of user interactions. This "behavior-driven reconstruction" allows Replay to understand the underlying user intent, enabling it to generate more accurate and functional code. Unlike screenshot-to-code tools that simply render static elements, Replay reconstructs the application's behavior based on observed user actions.

Here's how Replay stacks up against traditional and other AI-powered UI generation tools:

FeatureScreenshot-to-Codev0.devReplay
Video Input
Behavior AnalysisPartial
Multi-Page GenerationPartial
Supabase Integration
Style Injection
Product Flow Maps
GraphQL API GenerationPartial
Automated Testing Setup

Replay's ability to analyze video input and understand user behavior is a game-changer. It allows for the automatic generation of complex applications with minimal manual intervention.

Building a Next.js App with GraphQL API from Video#

Let's walk through the process of converting a UI video recording into a production-ready Next.js application with a GraphQL API using Replay. This example assumes you have a video recording of a user interacting with a hypothetical e-commerce application. The video showcases browsing products, adding items to the cart, and completing the checkout process.

Step 1: Prepare Your Environment#

Before diving into Replay, ensure you have the necessary tools installed:

  • Node.js: (version 18 or higher) - Download from nodejs.org
  • npm or yarn: (package manager) - Typically comes with Node.js
  • Supabase Account: (for database and authentication) - Sign up at supabase.com
  • Replay Account: (for video analysis and code generation) - Sign up at replay.build

Step 2: Upload Your UI Video to Replay#

  1. Log in to your Replay account.
  2. Create a new project and give it a descriptive name (e.g., "E-commerce App").
  3. Upload the UI video recording you prepared.

💡 Pro Tip: Ensure your video is clear and well-lit for optimal analysis. Focus on showcasing the key user flows you want to reconstruct.

Step 3: Configure Replay Settings#

After uploading the video, configure the following settings within Replay:

  • Framework: Select "Next.js" as the target framework.
  • API: Choose "GraphQL" as the API type.
  • Database: Select "Supabase" and provide your Supabase project URL and API key.
  • UI Testing: Enable UI testing and select the testing framework (e.g., "Playwright" or "Cypress"). For this example, let's assume we choose Playwright.

Step 4: Let Replay Generate the Code#

Click the "Generate Code" button and let Replay work its magic. Replay will analyze the video, identify UI elements, understand user interactions, and generate the corresponding Next.js code, GraphQL API schema, and Playwright tests. This process may take a few minutes, depending on the length and complexity of the video.

Step 5: Review and Refine the Generated Code#

Once the code generation is complete, review the generated code in Replay's code editor. You can make manual adjustments to fine-tune the UI, API, and tests.

📝 Note: Replay provides a high-quality starting point, but manual review and refinement are often necessary to ensure the code meets your specific requirements.

Step 6: Download the Project#

Download the generated project as a ZIP file. This file contains the complete Next.js application, including the UI components, GraphQL API, and Playwright tests.

Step 7: Set Up Your Local Environment#

  1. Extract the downloaded ZIP file to your local machine.
  2. Open a terminal and navigate to the project directory.
  3. Install the project dependencies using npm or yarn:
bash
npm install # or yarn install

Step 8: Configure Supabase#

  1. In your Supabase project, create the necessary database tables to store product information, cart data, and user accounts. Replay will generate the GraphQL schema based on these tables.
  2. Update the
    text
    .env
    file in your Next.js project with your Supabase project URL and API key.

Step 9: Run the Application#

Start the Next.js development server:

bash
npm run dev # or yarn dev

Open your browser and navigate to

text
http://localhost:3000
to view the application.

Step 10: Run the Playwright Tests#

Execute the Playwright tests to ensure the application functions as expected:

bash
npm run test:e2e # or yarn test:e2e

Replay generates Playwright tests that simulate the user interactions captured in the video. These tests provide a solid foundation for ensuring the application's functionality and preventing regressions.

Here's an example of a generated Playwright test:

typescript
// playwright/e2e/example.spec.ts import { test, expect } from '@playwright/test'; test('add item to cart', async ({ page }) => { await page.goto('http://localhost:3000'); await page.getByRole('button', { name: 'Add to Cart' }).first().click(); await page.getByRole('link', { name: 'View Cart' }).click(); await expect(page.getByText('Item in Cart')).toBeVisible(); });

This test simulates adding an item to the cart and verifying that the item is displayed in the cart view.

Step 11: Customize and Extend the Application#

With the core application generated by Replay, you can now customize and extend it to meet your specific requirements. You can add new features, modify the UI, and refine the API.

Benefits of Using Replay#

  • Faster Development: Automate UI generation and API integration, significantly reducing development time.
  • Improved Accuracy: Behavior-driven reconstruction ensures the generated code accurately reflects user intent.
  • Reduced Errors: Automated testing setup helps identify and prevent errors early in the development process.
  • Enhanced Collaboration: Replay provides a visual representation of the application's behavior, facilitating collaboration between designers, developers, and testers.
  • Future-Proofing: The generated code adheres to modern best practices and utilizes cutting-edge technologies, ensuring the application is ready for the future.

Code Example: Generated GraphQL Schema#

Here's an example of a GraphQL schema generated by Replay based on the e-commerce application video:

graphql
type Product { id: ID! name: String! description: String price: Float! imageUrl: String } type Query { products: [Product!]! product(id: ID!): Product } type Mutation { createProduct( name: String! description: String price: Float! imageUrl: String ): Product updateProduct( id: ID! name: String description: String price: Float imageUrl: String ): Product deleteProduct(id: ID!): Boolean }

This schema defines the data types and operations for interacting with the product data in the e-commerce application.

⚠️ Warning: Always review and validate the generated GraphQL schema to ensure it accurately reflects your data model and API requirements.

Frequently Asked Questions#

Is Replay free to use?#

Replay offers a free tier with limited features. Paid plans are available for accessing advanced features and increased usage limits.

How is Replay different from v0.dev?#

Replay analyzes video recordings to understand user behavior, while v0.dev primarily uses text prompts. Replay's behavior-driven approach allows for more accurate and functional code generation, especially for complex applications with dynamic user interactions. Replay also offers automated testing setup and Supabase integration out of the box.

What kind of videos work best with Replay?#

Clear, well-lit videos that showcase key user flows and interactions work best with Replay. Avoid videos with excessive noise or distractions.

What if Replay generates incorrect code?#

Replay provides a code editor where you can review and refine the generated code. You can also provide feedback to Replay to help improve its accuracy.


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