## Install on Vercel

Vercel Deployment: Deploy LogoAIpro to Vercel for easy, fast, and scalable hosting. Vercel provides automatic deployments, SSL certificates, and global CDN distribution.
Prerequisite: Make sure you've completed the
How to push to GitHub guide before proceeding with Vercel deployment.

## Step 1: Create Vercel Account

1. Go to vercel.com
2. Click "Sign Up" and sign in with GitHub
3. Authorize Vercel to access your GitHub account
4. Complete the onboarding process

## Step 2: Import Project

1. In Vercel Dashboard, click "New Project" or "Add New..." → "Project"
2. Click "Import" next to your logo-ai-pro repository
3. Vercel will detect it's a Next.js project automatically

## Step 3: Configure Project Settings

1. Framework Preset: Next.js (auto-detected)
2. Root Directory: `./` (root of repository)
3. Build Command: `npm run build` (default, keep as is)
4. Output Directory: `.next` (default, keep as is)
5. Install Command: `npm install` (default, keep as is)

## Step 4: Configure Environment Variables

Add all environment variables from the
Environment Variables page. Click "Environment Variables" in the project settings and add:

Required Environment Variables:

- `NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY` - Clerk public key
- `CLERK_SECRET_KEY` - Clerk secret key
- `CLERK_WEBHOOK_SECRET` - Clerk webhook secret
- `DATABASE_URL` - MongoDB connection string
- `NEBIUS_API_KEY` - Nebius AI API key
- `NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY` - Stripe public key
- `STRIPE_SECRET_KEY` - Stripe secret key
- `STRIPE_WEBHOOK_SECRET` - Stripe webhook secret
- `UPSTASH_REDIS_REST_URL` - Upstash Redis URL
- `UPSTASH_REDIS_REST_TOKEN` - Upstash Redis token
- `NEXT_PUBLIC_APP_URL` - Your Vercel deployment URL (e.g., `https://logo-ai-pro.vercel.app`)

Important: Set `NEXT_PUBLIC_APP_URL` after the first deployment, using your actual Vercel domain URL.

## Step 5: Deploy

1. Click "Deploy"
2. Wait for build to complete (takes 2-5 minutes)
3. Once deployed, Vercel will provide your production URL (e.g., `https://logo-ai-pro.vercel.app`)

## Step 6: Post-Deployment Configuration

### Update Environment Variables

1. Go to Project Settings → Environment Variables
2. Update `NEXT_PUBLIC_APP_URL` with your production domain
3. Redeploy to apply changes

### Configure Webhooks

Update webhook URLs in external services:

- Clerk: Update webhook URL to `https://yourdomain.vercel.app/api/webhooks/clerk`
- Stripe: Update webhook URL to `https://yourdomain.vercel.app/api/webhooks/stripe`

### Configure Custom Domain (Optional)

1. Go to Project Settings → Domains
2. Add your custom domain (e.g., `logo-ai-pro.com`)
3. Follow DNS configuration instructions
4. Update `NEXT_PUBLIC_APP_URL` with your custom domain

## Important Notes

Vercel-Specific Considerations:

- Function Timeout: Vercel has a 10-second function timeout on the Hobby plan. Some AI operations may exceed this limit. Consider AWS EC2 for longer-running operations.
- File Size Limits: Vercel has a 50MB function size limit. Ensure your build stays under this limit.
- Automatic Deployments: Every push to main branch triggers a new deployment automatically.
- Preview Deployments: Pull requests get preview deployments automatically.
- SSL Certificates: Vercel provides free SSL certificates automatically.

Limitations:

- AI logo generation may exceed Vercel's 10-second timeout on some operations
- For production with high traffic, consider AWS EC2 deployment instead
- Monitor function execution time in Vercel Analytics

## Monitoring & Analytics

- Deployments: View all deployments in the Deployments tab
- Analytics: Enable Vercel Analytics for performance monitoring
- Logs: Check function logs in the Deployments → Functions tab

## Troubleshooting

### Build Fails

- Check build logs for errors
- Verify all environment variables are set
- Ensure `package.json` has correct scripts

### Runtime Errors

- Check function logs for runtime errors
- Verify API keys are correct
- Check MongoDB connection string

### Timeout Errors

- AI operations may exceed 10-second limit
- Consider upgrading to Vercel Pro plan for longer timeouts
- Or deploy to AWS EC2 for unlimited execution time

## Next Steps

After Deployment:

- Configure Stripe webhooks
- Configure Clerk webhooks
- Test the application
- Consider AWS EC2 for production (if you need longer execution times)

Alternative Deployment: For production use with heavy AI processing, consider deploying to AWS EC2 which offers better performance and no function timeout limitations.