Deploy to Vercel
This guide explains how to deploy ReResell to Vercel.
Prerequisites
- A Vercel account
- Your code pushed to GitHub
- A Neon PostgreSQL database
Step 1: Import Project
- Log in to Vercel Dashboard
- Click "Add New..." → "Project"
- Import the
recycle-resellrepository
Step 2: Configure Project
Vercel auto-detects Next.js settings. The defaults should work:
| Setting | Value |
|---|---|
| Framework Preset | Next.js |
| Root Directory | ./ |
| Build Command | npm run build |
| Output Directory | .next |
Step 3: Add Environment Variables
Add these environment variables before deploying:
Required
| Variable | Value |
|---|---|
DATABASE_URL | Your Neon connection string |
NEXTAUTH_SECRET | Generate with openssl rand -base64 32 |
NEXTAUTH_URL | https://your-project.vercel.app |
Optional
| Variable | Description |
|---|---|
GOOGLE_CLIENT_ID | Google OAuth client ID |
GOOGLE_CLIENT_SECRET | Google OAuth client secret |
BLOB_READ_WRITE_TOKEN | Vercel Blob token |
PUSHER_* | Pusher credentials for real-time chat |
Step 4: Deploy
Click "Deploy" and wait for the build to complete.
Step 5: Set Up Vercel Blob (Optional)
For image uploads:
- Go to your project in Vercel
- Navigate to Storage tab
- Click "Create" → "Blob"
- Copy the token to
BLOB_READ_WRITE_TOKEN - Redeploy
Custom Domain
- Go to Settings → Domains
- Add your custom domain
- Configure DNS records
- Update
NEXTAUTH_URLto the custom domain
Preview Deployments
Vercel automatically creates preview deployments for pull requests. Note that:
- Each preview has a unique URL
- Preview URLs won't work with NextAuth unless configured
- Database changes affect production
Production Checklist
- [ ] Environment variables are set
- [ ]
NEXTAUTH_URLmatches production URL - [ ] Database is seeded
- [ ] Google OAuth URLs are configured
- [ ] Custom domain is set up (optional)
Troubleshooting
Function Timeout
If serverless functions timeout:
- Check database connection
- Optimize slow queries
- Consider increasing timeout in
vercel.json
Image Upload Fails
Verify:
- Blob storage is created
BLOB_READ_WRITE_TOKENis set- Token has read/write permissions
Build Errors
Common fixes: