Lesson 2. Deploying a React Vite App to Vercel from Vercel CLI

Setup and Deploy

Vercel provides an easy way to deploy front-end applications like those built with Vite. Here's how to do it:

1. Prepare Your Vite React App

  • Ensure it builds correctly: In your project's root directory, run:

    npm run build
    npm run preview
    • This will create an optimized production build of your app in a dist folder.

2. Set Up a Vercel Account (if you don't have one)

  • Go to Vercel and sign up using your Git provider (GitHub, GitLab, or Bitbucket) or email.

3. Install Vercel CLI (Optional but Recommended)

  • Vercel CLI (https://vercel.com/docs/cli) allows you to deploy from your terminal. Install it using npm (Note: Use PowerShell terminal on Windows):

    //on Windows
    npm install -g vercel
    //on Linux
    sudo npm install -g vercel

  • Verify the version of Vercel CLI currently being used (in PowerShell terminal on Windows)

  1. create GitHub repository

Respoitory Name: Book Search App

Repository URL :

  1. At your app project directory in VSC terminal, this initialized empty Git repository in /Users/user/yourproject/.git/.

6. Deploy via Vercel CLI[Optional]

  • Log in to Vercel: In your terminal, run:

    • This will open a browser window to authenticate with your Vercel account.

  • Initialize Vercel(if not initialized): In your project's root directory, run:

    • This command will walk you through a few steps.

    • Success! Initialized "vite" example in E:\Your-folder\Courses\Projects\react-app\bible-flashcard-app\vite.

      • To deploy, cd vite and run vercel.

  • Deploy: From your App project's root directory(NOT vite directory), simply run:

    • Vercel will detect that it's a Vite project and deploy it correctly.

    • You'll see the deployment progress in your terminal.

  • Once deployed, Vercel will provide you with a URL where your app is live.

Last updated