-
Notifications
You must be signed in to change notification settings - Fork 3
Depoloyment Guide
This guide will walk you through deploying your Next.js Portfolio to production using [Vercel](https://vercel.com), the native platform for Next.js applications.
Before deploying, ensure you have:
- A [GitHub](https://github.com/) account with your repository pushed.
- A [Vercel](https://vercel.com/) account (you can sign up using your GitHub account).
- Navigate to [Vercel's Import Project page](https://vercel.com/import/git).
- Select "Import Git Repository".
- Authenticate with GitHub if prompted and select your
next.js_portfoliorepository.
Vercel will automatically detect your project settings. Ensure the following:
-
Framework Preset:
Next.js -
Build Command:
npm run buildoryarn build -
Output Directory:
.next
You can leave other settings at their default values.
If your project uses environment variables:
- In the Vercel dashboard, go to your project settings.
- Navigate to the "Environment Variables" section.
- Add the necessary variables as defined in your
.env.examplefile.
Click "Deploy". Vercel will build and deploy your project. Once completed, you'll receive a live URL (e.g., https://your-project.vercel.app).
With Vercel's Git integration:
- Every push to the
mainbranch will trigger a new deployment. - For feature branches, Vercel provides preview deployments, allowing you to test changes before merging.
For every pull request or commit to a non-production branch:
- Vercel creates a unique preview URL.
- This allows you to test and share changes without affecting the live site.
While Vercel is the recommended platform for Next.js, you can also deploy using:
- Node.js Server: Deploy to platforms like Heroku or DigitalOcean.
- Docker: Containerize your application for deployment.
-
Static Export: Export your site as static files using
next export(note: this has limitations and may not support all Next.js features).
For detailed instructions on these methods, refer to the [Next.js Deployment Documentation](https://nextjs.org/docs/pages/building-your-application/deploying).
- Test all pages and links.
- Verify responsiveness on different devices.
- Ensure environment variables are correctly set.
- Set up custom domains if desired.
- Monitor performance and analytics via Vercel's dashboard.