Page 3: Deploying Next.js App to Vercel

3. Deploying Next.js App to Vercel

Vercel is optimized for Next.js, making deployment straightforward. Assuming your Next.js project is in nextjs-frontend/:

3.1. Connect Your Git Repository

Go to the Vercel dashboard, click "New Project", and connect your Git repository (GitHub, GitLab, Bitbucket). Vercel will usually auto-detect your Next.js project.

3.2. Configure Project Settings

When importing your project, Vercel will ask for configuration. If your Next.js app is in a subdirectory (e.g., nextjs-frontend/), you'll need to specify the Root Directory.

Click "Deploy". Vercel will then build and deploy your Next.js application.

3.3. Environment Variables (if needed)

If your Next.js app uses environment variables (e.g., .env.local), you can add them in Vercel's project settings under "Environment Variables".

For example, if your Next.js app needs to know the API endpoint, you might add a variable:

Remember to restart your Vercel deployment after adding environment variables.