All posts
Product design

From v0 to Production: Cleaning Up Generated Next.js Components

Taking v0 to production: a step-by-step cleanup pass for generated Next.js components covering tokens, accessibility, data fetching and file structure.

By Mehdi Hassan9 min read

The short answer

Taking v0 to production means running a cleanup pass on the generated components before they ship: move the code into a repo you own, replace hardcoded styles with your design tokens, fix accessibility, move data fetching to the server, split oversized client components and organize files so a team can maintain them.

Key takeaways

  • v0 output is a strong first draft of a component, not a finished part of your codebase.
  • Swap hardcoded colors and spacing for your tokens first, or every later fix multiplies.
  • Check keyboard use, labels, focus and contrast, because generated UI often looks right and fails these.
  • Push data fetching into Server Components and keep "use client" to the parts that need it.
  • Clean one component at a time and ship it, instead of cleaning everything in one big branch.

Part of Full-Stack Product Engineering for Startups: From Figma to Production

What does taking v0 to production involve?

Taking v0 to production involves turning generated React and Next.js components into code that fits your app: your tokens, your data layer, your file structure and your accessibility standard. v0 gives you a fast, good-looking draft. The cleanup pass makes it maintainable, testable and safe to change next month.

This guide is about components, not whole apps. If v0 or another AI builder produced your entire product and it's breaking under real users, that's a different job, covered in our guide to vibe code cleanup services. Here we assume you have a working Next.js app and want to bring v0 screens and components into it properly. It's one part of the wider practice in our guide to full-stack product development for startups.

What does v0 generated code usually look like?

v0 generated code is usually React with TypeScript, styled with Tailwind CSS and built on shadcn/ui components. That's a sensible base, because it's the same stack many teams already use. The patterns that need attention come from v0 optimizing for a complete-looking preview rather than for your codebase.

Pattern in generated code

Why it's fine in a preview

Why it hurts in production

Arbitrary Tailwind values and raw hex colors

Matches the prompt exactly

Drifts from your design system and breaks theming

One large file per screen

Easy to read in one place

Hard to reuse, test or review

"use client" at the top of everything

Interactivity just works

Ships more JavaScript and blocks server data fetching

Mock data inlined in the component

Preview shows realistic content

Real data shape differs and types lie

Divs with click handlers

Looks like a button

Not reachable by keyboard or screen readers

Duplicated shadcn/ui primitives

Self-contained output

Two slightly different Button components in one repo

How do you clean up v0 output step by step?

Clean up v0 output in a fixed order: get the code into your repo, align it with your existing components, apply tokens, fix accessibility, rework data fetching, then restructure files. Doing tokens and shared components first means every later fix happens once.

  1. Move the code into a repo you own

    Bring the component into your Next.js project through v0's GitHub integration or the install command v0 offers for a generation. v0's export options have changed over time, so check the current v0 docs for the route available on your plan.

  2. Reconcile with your shared components

    Delete any shadcn/ui primitives v0 copied that you already have, and import yours instead. One Button, one Input, one Dialog.

  3. Replace hardcoded styles with tokens

    Swap raw hex values and arbitrary sizes for your theme's color, spacing, radius and type tokens.

  4. Fix accessibility

    Use real buttons and links, label every input, check focus order and states, and test contrast.

  5. Rework data fetching

    Remove mock data, define types from your real API or database, and fetch on the server where you can.

  6. Split and organize files

    Break the screen into named components, push shared pieces into your component folder and keep route files thin.

  7. Ship it behind review

    Open a small pull request per component, with screenshots, and merge it before starting the next.

How do you replace hardcoded styles with design tokens?

Replace hardcoded styles by mapping every raw color, size and radius in the v0 output to an existing token in your Tailwind theme, and adding a token only when the design genuinely needs a new value. The goal is that the component changes when your theme changes, including dark mode.

Search the file for hex codes, arbitrary values in square brackets and color utilities that aren't part of your palette. Most will map cleanly: a near-black heading color becomes your foreground token, a gray border becomes your border token. When v0 picked a value nothing in your system matches, decide whether it's a real new need or noise from the prompt. It's usually noise.

If your tokens start life in Figma, keep that pipeline as the source of truth. Our guide to syncing Figma variables to Tailwind covers the export and transform. Prompting v0 with your token names and component list up front reduces this step, and the comparison in our guide to Figma-to-code AI tools covers how other generators handle design context.

How do you fix accessibility in v0 components?

Fix accessibility in v0 components by checking the four things generated UI most often gets wrong: semantic elements, labels, focus and contrast. shadcn/ui primitives are built on accessible foundations, but custom markup v0 writes around them isn't automatically accessible.

  • Semantic elements. Anything clickable that navigates is a link; anything that acts is a button. Replace divs and spans with click handlers.
  • Labels. Every input needs a visible label or an accessible name. Icon-only buttons need an aria-label that says what they do.
  • Focus. Tab through the component with no mouse. Focus should move in reading order, stay visible and return to a sensible place after a dialog closes.
  • Contrast. WCAG 2.2 sets a minimum contrast ratio of 4.5:1 for normal text and 3:1 for large text and for UI components such as input borders. Muted gray text on tinted cards is where generated designs most often fall short.
  • States. Loading, empty, error and disabled states are often missing from a preview. Add them, and make sure each one is announced or visible.

Run an automated checker, then do a manual keyboard pass. Only a person catches a focus order that makes no sense.

How should data fetching work in cleaned-up v0 components?

In a cleaned-up v0 component, data should be fetched on the server in a Server Component and passed down as props, with "use client" kept for the small interactive pieces. That's the default model of the Next.js App Router, and v0 output often works against it by making the whole screen a Client Component.

Start by deleting the inlined mock data and writing a type for the real data. Then move the fetch into the route's page or a server-side data function, and pass results into presentational components. Interactive parts such as a filter menu or a chart tooltip become small Client Components that receive data rather than fetch it. Mutations go through Server Actions or your API routes, with validation on the server.

This is also where generated code can hide real risk: a fetch to a third-party API from the browser can expose a key. Keep secrets in server-only code and environment variables. The architecture choices behind this are covered in our guide to building a SaaS app with Next.js.

Hypothetical example: cleaning a v0 dashboard card

For example, suppose v0 produced a 300-line revenue dashboard as one Client Component with a hardcoded array of twelve months, three raw hex colors and a div used as a date-range button.

The cleanup splits it into a server-rendered page that fetches the real figures, a typed RevenueCard that only displays them, and a small client-side DateRangePicker built on the existing shadcn/ui Popover. The hex values become chart and foreground tokens, the div becomes a button with a label, and the mock array is replaced by a type matching the database query. The result is more files, but each one is short and testable.

How should you structure files after a v0 Next.js cleanup?

After a v0 Next.js cleanup, route files should stay thin, shared components should live in one components folder, and feature-specific pieces should sit next to the route that uses them. The exact layout matters less than one rule applied everywhere, so the next developer finds things where they expect.

Where

What goes there

app/(route)/page.tsx

Data fetching and layout for that route only

app/(route)/_components

Pieces used only by that route

components/ui

Your shadcn/ui primitives, one copy each

components/

Shared composed components used across routes

lib/

Data access, validation schemas and helpers

Name components after what they are in the product (InvoiceTable), not what v0 called them in a generation. Delete unused imports and exports v0 left behind, and keep the generated prompt in the pull request description if it helps reviewers understand intent. Teams that do this work continuously often give it to a design engineer, who can judge both the design and the code.

What should you check before a v0 Vercel deploy?

Before a v0 Vercel deploy, check that the build passes type checking and linting, environment variables are set per environment, the component works with real data, and nothing secret reaches the browser. Deploying a v0 generation straight from the editor is fine for a preview; production should deploy from your repo through review.

  1. Types and lint pass with no new suppressions added to make the build green.
  2. Environment variables exist in preview and production, and only public values use the NEXT_PUBLIC_ prefix.
  3. Real data renders, including empty and error states, and long text doesn't break the layout.
  4. Mobile and keyboard checks are done on the deployed preview, not just the local machine.
  5. Images use next/image with sizes set, and fonts load through next/font, so the page stays fast.
  6. A preview deployment gets a quick review from someone who didn't write the prompt.

If cleanup turns into the main job rather than a step, that's a sign you need dedicated help. Our Next.js development service and design retainer both cover this, and our guide to hiring Next.js developers covers what to look for if you build the team yourself.

Frequently asked questions

Is v0 code good enough to ship without changes?
Sometimes, for a simple marketing section or an internal tool with a few users. For a product interface, it usually needs a cleanup pass first: tokens instead of hardcoded styles, accessible markup, real data types and server-side fetching. Shipping it unchanged tends to create a second design system inside your codebase, which is slower to fix later than to clean up now.
Does v0 use shadcn/ui?
v0 output is typically built on shadcn/ui components with Tailwind CSS, which is why it drops into many Next.js projects easily. The catch is duplication: a generation may include its own copies of primitives you already have. During cleanup, delete the duplicates and import your existing components so the app keeps one version of each.
Should a designer or a developer clean up v0 output?
Ideally one person who can do both, or a designer and developer working on the same pull request. Token mapping, spacing and states are design decisions, while data fetching, types and file structure are engineering ones. Splitting them into separate handoffs recreates the slow loop v0 was meant to remove.
Can I keep using v0 after the cleanup?
Yes. Many teams keep using it for first drafts of new screens. Give it your token names, component list and an example of a cleaned component in the prompt, so its output starts closer to your codebase. Treat every new generation as a draft that goes through the same pull request review as hand-written code.
How do I stop v0 components from making my app slow?
Keep "use client" off whole screens, so data and markup render on the server and less JavaScript reaches the browser. Use next/image for images, next/font for fonts, and remove unused imports and icon libraries the generation pulled in. Then check the deployed page's Core Web Vitals rather than trusting the editor preview.

· CEO & Design Director

Copywriter, designer and developer, and founder of Designify Studio. Over five years, 60+ projects across 14+ industries, for startups that have raised $300M+.

Want this done for you? Monthly retainer, $6,000.

Your ongoing design and development team, for products that keep shipping. $6,000, per month, flat fee. Book a free 30-minute call to see if it fits.

Schedule Call