Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Deploying with Vercel | Putting Your App Online
Web App from Scratch with Claude

bookDeploying with Vercel

Swipe to show menu

Note
Definition

Vercel takes your code from GitHub and publishes it as a live website. Every time you push an update to GitHub, Vercel automatically redeploys it. You do not need to do anything manually after the first setup.

Your code is on GitHub. This chapter gets it live on the internet with a real URL you can share with anyone.

The steps

1. Create a Vercel account
expand arrow

Go to vercel.com and sign up. Connect your GitHub account when prompted. This is what allows Vercel to see your repositories.

2. Import your project
expand arrow

Once you are on the Vercel dashboard, click Add New and select Project. You should see your GitHub repository listed. Click Import.

3. Add your environment variables
expand arrow

This is the most important step. Your API key is not on GitHub because it was excluded by .gitignore. That means Vercel does not have it either. You need to give it to Vercel directly.

On the project setup page, open the Environment Variables section. You need to add your API key here before deploying.

FieldWhat to enter
KeyANTHROPIC_API_KEY
ValueYour actual API key from .env.local

You can also click Import .env and select your .env.local file directly. Vercel will read the key and value from it automatically. This is the easiest option.

4. Click Deploy
expand arrow

Once the environment variable is added, click Deploy. Vercel will pull all your code files from GitHub and publish them. This takes two to five minutes.

5. Done
expand arrow

When you see the congratulations screen, your app is live! Vercel gives you a URL you can open in any browser and share with anyone.

Why the environment variable step matters

Your app will build and appear to work without the API key. But the moment someone submits an idea, it will fail because the app has no way to call the AI. Adding the key to Vercel is what makes the core feature actually work in production.

Note
Note

Local .env.local file stays on your computer. Vercel environment variables are your .env.local for the live web version.

question mark

What must you do to ensure your deployed app can access the AI API?

Select the correct answer

Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 5. Chapter 2

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

Section 5. Chapter 2
some-alt