Back to Blog
January 4, 20267 min readHow to Convert

How to Convert a Video Mockup into a Production Ready Angular App With NgRx

R
Replay Team
Developer Advocates

TL;DR: Learn how to use Replay to convert a video recording of an Angular application mockup into a production-ready app with NgRx state management.

The traditional design-to-development workflow is broken. Static mockups and lengthy design specs often lead to misinterpretations and time-consuming rework. What if you could simply record a video of your desired application behavior and automatically generate the code? Replay makes this a reality. This guide demonstrates how to convert a video mockup into a production-ready Angular app, leveraging the power of Replay and NgRx.

From Video to Angular: A Paradigm Shift#

The typical approach involves designers creating static mockups in tools like Figma or Adobe XD, followed by developers painstakingly translating these designs into code. This process is prone to errors and requires constant back-and-forth communication. Replay revolutionizes this workflow by using behavior-driven reconstruction. Instead of relying on static images, Replay analyzes video recordings to understand the intended user experience and generates corresponding code.

FeatureScreenshot-to-CodeReplay
InputStatic ScreenshotsVideo Recordings
Behavior AnalysisLimitedComprehensive
Multi-Page SupportLimited
State Management IntegrationManualAutomated (NgRx, Redux)
AccuracyLowerHigher

Replay understands what the user is trying to accomplish, not just what they see on the screen. This nuanced understanding allows for more accurate and functional code generation.

Building an Angular App with NgRx from a Video: A Step-by-Step Guide#

This tutorial walks you through the process of using Replay to generate an Angular application with NgRx state management, starting from a simple video mockup. We'll assume you have a video recording of your desired application flow.

Step 1: Project Setup and Replay Integration#

First, create a new Angular project using the Angular CLI:

bash
ng new my-angular-app --style=scss --routing=true cd my-angular-app

Next, install NgRx packages:

bash
npm install @ngrx/store @ngrx/effects @ngrx/entity @ngrx/store-devtools --save

💡 Pro Tip: Install the Redux DevTools extension in your browser for easy debugging of your NgRx store.

Step 2: Uploading the Video to Replay#

Upload your video mockup to the Replay platform. Replay will analyze the video and reconstruct the UI elements, user interactions, and application flow.

Step 3: Configuring NgRx in Replay#

During the code generation process in Replay, specify that you want to use NgRx for state management. Replay will automatically generate the necessary actions, reducers, effects, and selectors based on the observed user interactions in the video.

Step 4: Code Generation and Review#

Replay will generate an Angular project with NgRx integrated. Download the generated code and open it in your IDE.

Step 5: Understanding the Generated Code#

Let's examine a snippet of the generated code, focusing on the NgRx implementation. Suppose your video mockup involves adding items to a shopping cart. Replay might generate code similar to this:

typescript
// src/app/store/actions/cart.actions.ts import { createAction, props } from '@ngrx/store'; export const addItem = createAction( '[Cart] Add Item', props<{ itemId: string }>() ); export const removeItem = createAction( '[Cart] Remove Item', props<{ itemId: string }>() );
typescript
// src/app/store/reducers/cart.reducer.ts import { createReducer, on } from '@ngrx/store'; import { addItem, removeItem } from '../actions/cart.actions'; export interface CartState { itemIds: string[]; } export const initialState: CartState = { itemIds: [] }; export const cartReducer = createReducer( initialState, on(addItem, (state, { itemId }) => ({ ...state, itemIds: [...state.itemIds, itemId] })), on(removeItem, (state, { itemId }) => ({ ...state, itemIds: state.itemIds.filter(id => id !== itemId) }) );
typescript
// src/app/store/effects/cart.effects.ts import { Injectable } from '@angular/core'; import { Actions, createEffect, ofType } from '@ngrx/effects'; import { addItem, removeItem } from '../actions/cart.actions'; import { tap } from 'rxjs/operators'; @Injectable() export class CartEffects { addItem$ = createEffect(() => this.actions$.pipe( ofType(addItem), tap(() => console.log('Item added to cart!')) ), { dispatch: false }); constructor(private actions$: Actions) {} }

This code snippet demonstrates how Replay automatically generates NgRx actions, reducers, and effects based on the video analysis.

Step 6: Integrating with Supabase (Optional)#

Replay seamlessly integrates with Supabase, allowing you to persist your application's state in a real-time database. To enable Supabase integration, configure your Supabase credentials in the Replay platform. Replay will automatically generate the necessary code to synchronize your NgRx store with your Supabase database.

📝 Note: You'll need to install the

text
@supabase/supabase-js
package in your Angular project.

Step 7: Style Injection and Refinement#

Replay offers style injection capabilities, allowing you to apply custom styles to your generated application. You can either provide CSS files or define styles directly within the Replay platform. After generating the code, you may need to refine the styles and UI elements to match your desired aesthetic.

Step 8: Testing and Deployment#

Thoroughly test your generated application to ensure that it functions as expected. Use Angular's testing framework (Jest or Karma) to write unit and integration tests. Once you're satisfied with the results, deploy your application to your preferred hosting platform (e.g., Netlify, Vercel, Firebase Hosting).

Benefits of Using Replay for Angular Development#

  • Accelerated Development: Dramatically reduce development time by automating code generation.
  • Improved Accuracy: Minimize errors and misinterpretations by using video as the source of truth.
  • Enhanced Collaboration: Facilitate seamless collaboration between designers and developers.
  • Reduced Rework: Eliminate the need for constant back-and-forth communication and rework.
  • Behavior-Driven Development: Focus on user behavior and application flow, rather than static designs.

⚠️ Warning: While Replay significantly accelerates development, it's important to review and refine the generated code to ensure quality and maintainability.

Replay vs. Traditional Development#

AspectTraditional DevelopmentReplay-Driven Development
Source of TruthStatic Mockups, Design SpecsVideo Recordings
Development TimeLongerShorter
Error RateHigherLower
CollaborationMore ComplexSimpler
FocusVisual DesignUser Behavior

Frequently Asked Questions#

Is Replay free to use?#

Replay offers a free tier with limited features. Paid plans are available for users who require more advanced functionality and higher usage limits. Check the pricing page on the Replay website for the most up-to-date information.

How is Replay different from v0.dev?#

While both Replay and v0.dev aim to accelerate UI development, they differ significantly in their approach. v0.dev primarily relies on AI-powered code generation based on text prompts. Replay, on the other hand, uses video analysis to understand user behavior and reconstruct the UI accordingly. This behavior-driven approach allows Replay to generate more accurate and functional code, especially for complex applications with intricate user flows. Replay understands the intent behind the UI interactions, not just the visual appearance. Replay also offers tighter integrations with state management libraries like NgRx and backend services like Supabase.

What kind of videos work best with Replay?#

The best videos for Replay are clear, well-lit recordings that accurately demonstrate the desired application behavior. Avoid videos with excessive background noise or distractions. Ensure that all UI elements and user interactions are clearly visible.

Can Replay handle complex animations and transitions?#

Replay can handle many animations and transitions, but the accuracy depends on the complexity and clarity of the video recording. For highly complex animations, you may need to manually refine the generated code.

What frameworks and libraries are supported by Replay?#

Replay currently supports Angular, React, Vue.js, and other popular front-end frameworks. It also integrates with various state management libraries, including NgRx, Redux, and Vuex. Support for additional frameworks and libraries is constantly being added.


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