This guide will help you deploy the WebScraper application to Vercel successfully.
-
Initialize Git (if not already done):
git init git add . git commit -m "Initial commit: WebScraper Next.js application"
-
Push to GitHub:
git remote add origin https://github.com/your-username/webscraper-nextjs.git git branch -M main git push -u origin main
- Visit vercel.com
- Sign up/login with your GitHub account
- Click "New Project"
- Import your GitHub repository
- Vercel will auto-detect Next.js and configure everything
- Click "Deploy"
-
Install Vercel CLI:
npm i -g vercel
-
Deploy:
vercel
-
Follow the prompts:
- Set up and deploy? Y
- Which scope? (select your account)
- Link to existing project? N
- Project name: webscraper-nextjs
- Directory: ./
- Want to override settings? N
After deployment, you should have:
- ✅ Main app accessible at your Vercel URL
- ✅ Admin panel at
/admin - ✅ Download page at
/download - ✅ API endpoints working
- ✅ Database initialized automatically
While the app works without environment variables, you can add these for production:
-
In Vercel Dashboard:
- Go to your project → Settings → Environment Variables
-
Add variables:
ADMIN_PASSWORD=your-secure-password DATABASE_URL=file:./webscraper.db
- In Vercel Dashboard: Project → Settings → Domains
- Add your custom domain
- Follow DNS configuration instructions
- Visit your deployed URL
- The main page should load with search functionality
- Stats should show zeros (empty database initially)
- Go to
/admin - Login with password:
admin123(or your custom password) - Try adding a test URL like:
https://www.orion.ox.ac.uk/~vgg/data/pets/
- After adding a URL, the crawler should automatically process it
- Check back after a few minutes to see if files appear in search
- Visit
/download - Should show any crawled files
- Test bulk download functionality
-
Build Fails
# Check for TypeScript errors npm run build # Install missing dependencies npm install
-
Python Function Fails
- Ensure
requirements.txtis in root directory - Check function logs in Vercel dashboard
- Ensure
-
Database Issues
- SQLite is automatically created on first run
- Check function logs for database errors
-
CORS Issues
- API routes should handle CORS automatically
- If issues persist, check browser dev tools
-
Check Vercel Function Logs:
- Vercel Dashboard → Your Project → Functions tab
- Click on any function to see logs
-
Local Development:
npm run dev # Test everything locally first -
Check Network Tab:
- Open browser dev tools
- Check API calls in Network tab
-
Database Limits:
- SQLite works well for small to medium datasets
- Consider upgrading to PostgreSQL for larger datasets
-
Function Timeouts:
- Vercel functions have time limits
- Implement queue-based processing for large crawls
-
Rate Limiting:
- Add rate limiting for production use
- Implement proper error handling
-
Caching:
- Implement API response caching
- Use Vercel's edge caching features
-
Database Indexing:
- Indexes are already created for search performance
- Monitor query performance in production
-
Change Default Password:
// In app/api/admin/add-url/route.ts if (password !== process.env.ADMIN_PASSWORD || 'your-secure-password') {
-
Implement Proper Authentication:
- Consider using NextAuth.js
- Add session management
-
Rate Limiting:
- Implement API rate limiting
- Add CAPTCHA for admin access
-
Input Validation:
- Validate all URLs before crawling
- Sanitize search inputs
After successful deployment:
- Add Your First URLs: Start with a few test directory listing URLs
- Monitor Performance: Check Vercel analytics and function logs
- Customize UI: Modify colors, branding, and layout as needed
- Scale Gradually: Start with small datasets and scale up
If you encounter issues:
- Check this guide and the main README
- Review Vercel documentation
- Open an issue on GitHub
- Check community forums
Congratulations on your deployment! 🎉