This guide explains how to test Vercel deployments locally before pushing to production.
- Vercel CLI installed (already done via
npm install -g vercel) - Vercel account (sign up at https://vercel.com)
Before testing locally, authenticate with Vercel:
vercel loginThis will open your browser and prompt you to log in.
We've added three new make targets for Vercel testing:
Runs a local development server that simulates the Vercel deployment environment:
make vercelThis will:
- Install frontend dependencies if needed
- Start Vercel dev server (usually at http://localhost:3000)
- Simulate serverless functions and routing exactly as they would run on Vercel
Use this for: Testing your app locally before deploying
Tests the Vercel build process locally without deploying:
make vercel-buildThis will:
- Install frontend dependencies if needed
- Run the complete Vercel build process
- Validate your
vercel.jsonconfiguration - Build both frontend and API functions
Use this for: Catching build errors before deployment
Deploys to Vercel production:
make vercel-deployUse this for: Deploying to production after local testing
The vercel.json file configures the deployment:
- Dev Command:
cd frontend && npm run dev- Runs Vite dev server on port 5173 - Build Command:
cd frontend && npm run build- Builds the frontend - Install Command:
cd frontend && npm install- Installs frontend dependencies - Framework: Set to
nullto disable auto-detection (prevents Next.js detection) - Frontend Build: Uses
@vercel/static-buildwith thevercel-buildscript fromfrontend/package.json - API Functions: Python serverless functions using
@vercel/pythonwith Python 3.12 runtime - Routes: API routes go to
/api/*, all other routes serve the frontend
Note: When running vercel dev:
- The frontend Vite dev server runs (port 5173) through Vercel's proxy (usually port 3000)
- API functions are automatically started and available at
/api/*routes - The Vite proxy is automatically disabled (Vercel handles API routing to serverless functions)
- No need to separately start the Python backend - Vercel runs it as serverless functions
✅ Removed excludeFiles property - This property is not valid in the Vercel schema and was causing deployment failures.
✅ Removed conflicting functions property - The functions and builds properties cannot be used together. Removed functions property and kept the builds configuration with @vercel/python builder.
✅ Fixed Vercel dev command - Added devCommand, buildCommand, and installCommand to prevent Vercel from incorrectly detecting the project as Next.js. Set framework: null to disable auto-detection.
✅ Fixed API routing in Vercel dev - Modified vite.config.js to conditionally disable the proxy when running in Vercel environment. This allows Vercel dev to properly route /api/* requests to the Python serverless functions instead of trying to proxy to localhost:8000.
You have two ways to develop locally:
Option 1: Local Development (Recommended for active development)
make run- Runs Python backend on http://127.0.0.1:8000
- Runs Vite frontend on http://localhost:5173
- Fast hot-reload for both frontend and backend
- Uses Vite proxy to connect frontend to backend
Option 2: Vercel Development (Test deployment environment)
make vercel- Simulates the exact Vercel production environment
- Runs Python code as serverless functions (like production)
- Frontend served through Vercel dev proxy (port 3000)
- Good for testing before deploying
- Make your code changes
- Test with
make runfor fast iteration - Test with
make vercelto verify Vercel compatibility (optional but recommended) - Verify build works with
make vercel-build - Commit and push to your branch
- Vercel will automatically deploy from GitHub
- OR manually deploy with
make vercel-deploy
Run vercel login to authenticate.
Check that all dependencies are installed:
make installThe Vercel dev server typically uses port 3000. Stop any processes using that port:
lsof -ti:3000 | xargs kill -9