v0 tutorial: build and deploy a full-stack app

By

Updated

Tagged: AI

Use v0 to build a full-stack feedback board, connect a database, manage environment variables, sync with GitHub, and deploy to Vercel.

v0 is Vercel’s AI application builder, a vibe coding tool that turns a prompt into a running app. You describe what you want in a chat, and v0 plans the work, writes the code, shows a live preview, and deploys the result to Vercel.

It works best with React and Next.js, though it handles other frameworks too. You can start with a text prompt, a screenshot, or a sketch of the interface you have in mind.

In this tutorial we’ll build a small feedback board where visitors can submit ideas and the app saves them to a database. We’ll do it in small, testable steps instead of trying to get everything out of one giant prompt.

The screenshots below come from a SaaS landing page I built while preparing the AI Workshop. The project is different, but the v0 interface and workflow are the same.

Create a v0 account

Open v0 and sign in. Your v0 account is also your Vercel account.

Once you’re in, you’ll see a large prompt box where you can describe what you want to create:

The v0 home screen with the prompt box for starting a new project

The + button lets you attach screenshots and other files, which is handy when you already have a visual reference.

Start with a clear first prompt

Start a new chat and use this prompt:

Build a customer feedback board with Next.js and TypeScript.

The home page should:
- show a short introduction
- list feedback items
- have a form with name, email, and feedback fields
- show a success message after submission

Use a simple black and white design.
Do not add authentication yet.
Use temporary in-memory data until we connect a database.

This prompt covers the product, stack, page, fields, and visual direction, and it also spells out what we don’t want yet. That last part matters: if you ask for every feature at once, it’s much harder to tell what v0 changed.

Check the first version

Once v0 finishes, try the preview first instead of reading every generated file right away.

The v0 interface puts the chat on the left and the running app on the right:

The v0 chat beside the live preview of the generated application

Use the icons above the preview to switch between Preview and Code. From the same toolbar you can move between pages, test different screen sizes, refresh the app, open it in a new window, and open the console.

Try these:

  1. Submit the form with empty fields
  2. Submit a real feedback message
  3. Reload the page
  4. Check the page on a narrow screen

The data will probably vanish after a reload. That’s expected since we asked for temporary data.

Now switch to the code view and locate the form submission handler and the component that renders the list. You don’t need to read every line, only confirm that the app uses Next.js and TypeScript and that the structure matches the preview.

Don’t worry if your result looks different from mine. AI generation isn’t deterministic, so the same prompt can produce a different design and different code.

Ask for one change at a time

Say the form works, but the UI feels cluttered. Give v0 a focused instruction instead of asking it to redesign the whole app:

Remove rounded corners, shadows, gradients, and colored backgrounds.
Use one-pixel black borders and keep the layout responsive.
Do not change the form behavior.

That last sentence keeps v0 from breaking working behavior while it changes the design.

Check the preview again. If the result isn’t right, tell v0 what changed and what you expected instead:

The mobile form now overflows the page.
Keep the current desktop layout and make every form control fit at 320px.

Concrete feedback like that gets much better results than “fix the design.”

Connect a database

Right now our feedback disappears on reload because it only lives in memory.

The left toolbar gives you access to GitHub, integrations, environment variables, and project settings:

The Git, environment variables, and settings buttons in the v0 project toolbar

Open the project menu, choose Integrations, and connect a Postgres provider from the Vercel Marketplace. v0 and the connected Vercel project share the integration, and the provider adds the required database environment variables for you.

Now ask v0 to wire it up:

Persist feedback in the connected Postgres database.

Create the smallest schema needed for:
- id
- name
- email
- message
- createdAt

Validate the form on the server.
List newest feedback first.
Keep the current design.

v0 should update the schema, submission code, and query. Run the same test again:

  1. Submit feedback
  2. Reload the page
  3. Confirm the feedback stays on the page

Inspect generated database changes

Read AI-generated database code carefully, because a working preview won’t catch security bugs.

Check that:

If anything is off, ask v0 to fix one concrete issue at a time:

The feedback list must never send the email column to the browser.
Update the query and its TypeScript type.

Then check the diff in the code view before moving on.

Add an environment variable

Integrations create their own environment variables, and you can add your own too.

Open Project menu → Environment Variables and create this variable:

FEEDBACK_TITLE=Product feedback

Enable it for Development, Preview, and Production, then tell v0 to use it:

Use the FEEDBACK_TITLE environment variable as the page heading.
Fall back to "Feedback" when it is missing.

The generated code should look something like this:

const title = process.env.FEEDBACK_TITLE ?? 'Feedback'

The v0 preview reads Development variables, while the published site reads Production variables.

Be careful with secrets: never put a private key in a variable starting with NEXT_PUBLIC_, because Next.js exposes those values to the browser.

Use design mode for small visual edits

Chat works well for behavior and larger layout changes. For small spacing or typography tweaks, v0’s design mode is faster: click an element in the preview and adjust it visually.

Click Design at the bottom of the chat panel to turn it on:

Design mode open in v0 with the design controls beside the application preview

From there, click any element to edit its typography, colors, background, spacing, and layout:

A card header selected in v0 design mode with its typography controls visible

Design mode is great for tweaks like:

Stick to chat when a change touches data, state, or behavior. Design mode updates the underlying code directly, and you can save the edits or reset them if they don’t look right.

Connect the project to GitHub

Don’t leave the app living only inside a chat. Open the project menu, choose GitHub, and either create a new repository or connect an existing one.

You can also open the Git panel from the left toolbar and click Connect:

The Git panel in v0 before connecting a GitHub repository

v0 creates a branch for the chat and commits changes automatically, so you can open a pull request when a feature is ready.

Once the repo is connected, the Git panel shows the branch, target branch, status, pull request, and recent activity:

A connected GitHub repository in v0 with the Open PR button

You end up with a normal Git history:

main
  └── v0/feedback-board-...

Review the pull request like any other code change. For agent-written code I use this pull request workflow.

Pay attention to:

My advice is to keep GitHub connected even when you’re working alone. It gives you an independent copy of the code and makes every change easy to review.

Publish the app

Click Publish, then choose Publish to Production. The first publish creates a connected Vercel project, and later publishes update the same production URL.

To inspect it, open the project settings, select the connected Vercel project, and choose View on Vercel:

The connected Vercel project settings in v0 with the View on Vercel option

Vercel shows the generated production domain and every deployment. Before sharing the link, open the Vercel project and verify:

We left this feedback board public on purpose, so anyone with the URL can submit data. Before using this setup for private or sensitive feedback, add authentication, authorization, rate limits, and spam protection.

You can attach a custom domain from the Vercel project settings. For Git deploys, preview URLs, env vars, Functions, domains, logs, and rollbacks, see my Vercel tutorial or the Vercel deployment documentation.

Continue after publishing

Once it’s published, a v0 project is just a regular app in GitHub. From here you can:

If you make a large change locally, start a new v0 chat from the updated repository so you aren’t prompting a thread with stale assumptions about the code.

Want me to talk about your product? You can sponsor this site.

Related posts about ai: