Back to Blog
January 4, 20267 min readReplay AI: Building

Replay AI: Building a Multilingual E-commerce site from Video with Next.js

R
Replay Team
Developer Advocates

TL;DR: Replay AI enables rapid development of a multilingual e-commerce site with Next.js directly from a video demonstration, leveraging behavior-driven reconstruction to generate functional code.

From Screencast to Storefront: Building a Multilingual E-commerce Site with Replay AI and Next.js#

E-commerce development often involves tedious manual coding, especially when dealing with complex features like multilingual support and dynamic UI elements. Traditional approaches, even with modern frameworks, require significant time and effort. What if you could simply show your desired functionality and have the code generated for you?

Replay AI makes this a reality. By analyzing a video demonstration of your ideal e-commerce site, Replay reconstructs the UI and underlying logic, delivering a fully functional Next.js codebase. This is especially powerful for complex scenarios like building a multilingual e-commerce platform.

The Problem: Traditional E-commerce Development Bottlenecks#

Building a robust e-commerce site, particularly one that caters to a global audience, presents several challenges:

  • Complex UI/UX: E-commerce sites demand intuitive navigation, product displays, shopping carts, and checkout flows.
  • Multilingual Support: Implementing i18n (internationalization) involves managing translations, routing, and locale-specific formatting.
  • Dynamic Content: Product catalogs, pricing, and promotions often change frequently, requiring dynamic data fetching and rendering.
  • Backend Integration: Connecting to payment gateways, inventory management systems, and other backend services can be complex.

Traditional methods often involve:

  1. Manual Coding: Writing HTML, CSS, and JavaScript from scratch or using UI libraries.
  2. Framework Configuration: Setting up routing, state management, and other framework-specific features.
  3. API Integration: Building and consuming APIs for data fetching and backend interactions.
  4. Testing and Debugging: Ensuring the site functions correctly across different browsers and devices.

This process is time-consuming, error-prone, and requires specialized skills.

The Replay AI Solution: Behavior-Driven Reconstruction#

Replay AI offers a radically different approach. Instead of manually coding each component, you simply record a video demonstration of your desired e-commerce site. Replay then analyzes the video, understands the user behavior and intent, and reconstructs the UI and underlying logic as functional code. This "Behavior-Driven Reconstruction" approach significantly accelerates development and reduces the need for manual coding.

FeatureTraditional DevelopmentScreenshot-to-CodeReplay AI
InputManual CodeScreenshotsVideo
Behavior AnalysisManual ImplementationLimited
Code GenerationManualAutomatedAutomated
Multi-Page SupportManualLimited
Backend IntegrationManualLimited✅ (Supabase)

Building a Multilingual E-commerce Site with Replay AI and Next.js: A Step-by-Step Guide#

Here's how you can use Replay AI to build a multilingual e-commerce site with Next.js:

Step 1: Video Recording#

Record a video demonstrating the desired functionality of your e-commerce site. This includes:

  1. Homepage Navigation: Show how users can browse product categories and search for specific items.
  2. Product Details Page: Demonstrate how users can view product information, images, and reviews.
  3. Shopping Cart: Show how users can add items to their cart, adjust quantities, and proceed to checkout.
  4. Checkout Flow: Demonstrate the checkout process, including entering shipping information, selecting payment methods, and confirming the order.
  5. Language Switching: Crucially, show how users can switch between different languages. This should be a clear visual demonstration within the video.

💡 Pro Tip: Speak clearly and deliberately while recording the video. Emphasize key interactions and transitions to help Replay accurately understand your intent.

Step 2: Uploading the Video to Replay AI#

Upload the recorded video to the Replay AI platform. Replay will begin analyzing the video and reconstructing the UI and underlying logic.

Step 3: Reviewing and Refining the Generated Code#

Once Replay has finished processing the video, you'll be presented with a Next.js codebase that represents your e-commerce site. Review the generated code to ensure it accurately reflects your desired functionality.

📝 Note: While Replay AI strives for accuracy, some manual adjustments may be necessary. This is especially true for complex or nuanced interactions.

Step 4: Implementing Multilingual Support with Next.js i18n#

Replay's generated code will likely include placeholders or basic implementations for multilingual support. You can enhance this by leveraging Next.js's built-in i18n features.

  1. Configure
    text
    next.config.js
    :
    Add the
    text
    i18n
    configuration to your
    text
    next.config.js
    file:
javascript
// next.config.js module.exports = { i18n: { locales: ['en', 'es', 'fr'], // Add your supported locales defaultLocale: 'en', }, };
  1. Create Locale Files: Create separate JSON files for each locale, containing the translated text:
json
// public/locales/en/common.json { "home": "Home", "products": "Products", "addToCart": "Add to Cart" } // public/locales/es/common.json { "home": "Inicio", "products": "Productos", "addToCart": "Añadir al carrito" }
  1. Use
    text
    next-i18next
    or
    text
    useTranslation
    Hook:
    Integrate a library like
    text
    next-i18next
    or the
    text
    useTranslation
    hook from
    text
    react-i18next
    to access the translated text in your components:
typescript
// components/Navbar.tsx import { useTranslation } from 'react-i18next'; const Navbar = () => { const { t } = useTranslation('common'); return ( <nav> <a href="/">{t('home')}</a> <a href="/products">{t('products')}</a> </nav> ); }; export default Navbar;
  1. Implement Locale Switching: Add a language selector to your site that allows users to switch between different locales. This can be a simple dropdown menu or a more sophisticated UI element. Ensure the language selector mirrors the visual demonstration in your Replay video.
typescript
// components/LanguageSwitcher.tsx import { useRouter } from 'next/router'; const LanguageSwitcher = () => { const router = useRouter(); const { locales, locale } = router; const handleLocaleChange = (newLocale: string) => { router.push(router.pathname, router.pathname, { locale: newLocale }); }; return ( <select value={locale} onChange={(e) => handleLocaleChange(e.target.value)}> {locales?.map((loc) => ( <option key={loc} value={loc}> {loc} </option> ))} </select> ); }; export default LanguageSwitcher;

⚠️ Warning: Ensure your locale files are properly structured and contain accurate translations. Incorrect translations can negatively impact the user experience.

Step 5: Integrating with Supabase (Optional)#

Replay AI seamlessly integrates with Supabase, allowing you to quickly set up a backend for your e-commerce site. You can use Supabase to store product data, user information, and order details. Replay can generate the necessary API endpoints and data models based on your video demonstration.

Step 6: Testing and Deployment#

Thoroughly test your multilingual e-commerce site to ensure it functions correctly across different browsers, devices, and locales. Once you're satisfied with the results, deploy your site to a hosting platform like Vercel or Netlify.

Benefits of Using Replay AI for E-commerce Development#

  • Faster Development: Significantly reduces the time and effort required to build an e-commerce site.
  • Reduced Coding: Minimizes the need for manual coding, freeing up developers to focus on more strategic tasks.
  • Improved Accuracy: Ensures the generated code accurately reflects the desired functionality.
  • Enhanced Collaboration: Facilitates collaboration between designers, developers, and stakeholders.
  • Streamlined Multilingual Implementation: Simplifies the process of adding multilingual support to your e-commerce site.
  • Video as Source of Truth: The video serves as a single source of truth, ensuring consistency between the design and implementation.

Frequently Asked Questions#

Is Replay AI free to use?#

Replay AI offers a free tier with limited functionality. Paid plans are available for users who require more advanced features and higher usage limits.

How is Replay AI different from v0.dev?#

While both Replay AI and v0.dev aim to automate code generation, they differ in their approach. Replay AI uses video input and behavior analysis to reconstruct UI and logic, while v0.dev primarily relies on text prompts and pre-defined templates. Replay's video-first approach allows for more nuanced and complex interactions to be captured and translated into code. Replay truly understands what the user is trying to accomplish.

Can Replay AI handle complex e-commerce features like payment gateway integration?#

Replay AI can generate the basic structure and UI for payment gateway integration. However, you may need to manually configure the specific payment gateway settings and API keys.


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