How to use Vercel CLI for deployment
Tags: webdev, nextjs, javascript, tutorial
Published: 2023-01-19 19:07:25

As someone on the internet rightly stated, Vercel is the Apple of developer tools.


![Vercel similar to Apple](https://paper-attachments.dropboxusercontent.com/s_F23CFA001AFD0FDA876E9E36E18A4E9915CE93FC3A9B26FF304A85463AF64425_1674143921945_image.png)


In this article, you will learn how to use the Vercel command line interface (CLI) to deploy any frontend application right from your terminal instead of pushing your codebase to GitHub first and doing the setup on your Vercel dashboard. With this method, you minimize the use of your mouse, replacing it with typing in the command prompts to instruct, manage, and configure the program.

## What is Vercel?

There are many web hosting services for frontend applications, but one of the most popular ones is Vercel. Vercel is the company behind the popular React framework, Next.js.

Vercel is a collaborative experience that lets you ship your ideas quickly to the web, used by frontend developers that provides the speed and performance to showcase your work when inspiration strikes, thereby providing a live URL you can share. Using Vercel for your needs, it integrates well with GitHub, GitLab, and BitBucket.


## Installation

If this is your first time working with the command line, or the terminal, confirm that you have Node installed on your machine. Run this command:


    node --version

The above command shows you the version number of Node. **Node** is a JavaScript runtime environment as installing it comes with the node package manager (NPM). It would be integral for installing packages or dependencies when working with frameworks like React, Next.js, or Vue, as well as backend technologies like Node.js.

For installation guides, check out the official Node documentation to install it on your respective operating system. The standard recommended version to choose is LTS.

Now confirm the presence of `npm` with this command:


    npm --version

Still in your terminal, run the command below to install the Vercel CLI globally on your machine using the `-g` flag:


    npm install -g vercel

Once again, you need to verify if Vercel is installed correctly with this command:


    vercel --version

PS: More than 20+ available commands are used with the keyword `vercel` in the terminal. To learn more about using [these commands](https://vercel.com/docs/cli#available-commands), check out the Vercel documentation.


## Deploying an app

For this section, use any available frontend application written in React, Next.js, Vue, and so on. All the magic happens from the terminal, so you don’t need to open [vercel.com](https://vercel.com) on your browser. 

**Prerequisites**
Have an account on Vercel. Sign-up is [free](https://vercel.com/signup).

Navigate to the directory of your project and login into your Vercel account with the command:


    vercel login


![vercel login](https://paper-attachments.dropboxusercontent.com/s_F23CFA001AFD0FDA876E9E36E18A4E9915CE93FC3A9B26FF304A85463AF64425_1674151128331_vercel+login.png)


This command allows you to log in to your account through Vercel CLI and provides different login methods to authenticate an account. Some of these options include:

- GitHub OAuth
- GitHub OAuth
- GitLab OAuth
- Bitbucket OAuth
- Email confirmation
- SAML Single Sign-On via your Team's identity provider


![CLI login success page](https://paper-attachments.dropboxusercontent.com/s_F23CFA001AFD0FDA876E9E36E18A4E9915CE93FC3A9B26FF304A85463AF64425_1674150625564_Screenshot+2023-01-19+at+16.52.27.jpg)


Next, to start the setup and deployment of your project, run the command within the project folder:


    vercel

This command will provide you with a list of options for the project. Select the options appropriately, as seen below: 


![deployment options](https://paper-attachments.dropboxusercontent.com/s_F23CFA001AFD0FDA876E9E36E18A4E9915CE93FC3A9B26FF304A85463AF64425_1674151553598_image.png)


The shared screenshot is a live URL to the project; copy and paste the production link into your browser.

Following the above steps systematically, you should have access to your demo app on the browser.


![demo app](https://paper-attachments.dropboxusercontent.com/s_F23CFA001AFD0FDA876E9E36E18A4E9915CE93FC3A9B26FF304A85463AF64425_1674151907754_image.png)



## Conclusion

Sharing your work is essential as a frontend developer instead of leaving them dormant in localhost. Vercel is a tool that helps take your idea to production without paying for hosting and getting a domain to host your side project. The Vercel CLI is all you need to make this work.

Try it today, as this process won’t take more than 5 minutes to set up.

View the demo app [here](https://supa-vacation-rust.vercel.app/).