tree: 637681f6d4f638aeace887b0139407583e16f259
  1. api/
  2. app/
  3. README.md
  4. requirements.txt
examples/deployment/vercel/README.md

Deploy Burr in Vercel

Vercel - serverless platform for frontend frameworks and serverless functions.

Here we have an example of how to deploy a Burr application as a Vercel Serverless Function.

Prerequisites

  • Node.js: Required for Vercel CLI (v14 or higher)
  • Vercel Account: Sign up at vercel.com (free tier available)

Step-by-Step Guide

1. Install Vercel CLI:

npm install -g vercel

2. Local tests:

Start the local development server:

vercel dev

Send test request to check if the function executes correctly:

curl -X POST "http://localhost:3000/api/counter" \
  -H "Content-Type: application/json" \
  -d '{"number": 5}'

Expected response:

{"counter": 5, "counter_limit": 5, "__SEQUENCE_ID": 5, "__PRIOR_STEP": "result"}

3. Login to Vercel:

vercel login

This will open your browser to authenticate with your Vercel account.

4. Deploy to Vercel (Preview):

Deploy to a preview environment for testing:

vercel

5. Test Preview Deployment:

Vercel will provide a preview URL. Test it:

curl -X POST "https://your-project-xxx.vercel.app/api/counter" \
  -H "Content-Type: application/json" \
  -d '{"number": 5}'

6. Deploy to Production:

Once preview testing is successful, deploy to production:

vercel --prod

Your production URL will be:

https://your-project.vercel.app

7. Test Production Deployment:

curl -X POST "https://your-project.vercel.app/api/counter" \
  -H "Content-Type: application/json" \
  -d '{"number": 5}'

Alternative: Deploy via Git Integration (Recommended)

Import project in Vercel Dashboard:

Troubleshooting

If deployment fails:

View detailed logs:

vercel logs --follow

If function returns 404:

Ensure your handler file is in the api/ directory with correct format.

If you see deployment URL instead of production URL:

The production URL is always in the format: https://your-project.vercel.app

Check your Vercel Dashboard → Domains section for the correct URL.

Resources