# Install Vercel CLI
npm i -g vercel
# Deploy from project root
vercel
# Follow the prompts:
# - Set up and deploy? Y
# - Which scope? (select your account)
# - Link to existing project? N
# - Project name: transformers-api (or your preferred name)
# - In which directory is your code located? ./
# - Want to override settings? N- Push your code to GitHub/GitLab/Bitbucket
- Go to vercel.com
- Click "New Project"
- Import your repository
- Vercel will automatically detect the configuration
Set these in your Vercel dashboard:
NODE_ENV=production
PORT=3009 (optional, Vercel will override)
API_VERSION=v1
CORS_ORIGIN=* (or specific domains)
RATE_LIMIT_WINDOW_MS=900000
RATE_LIMIT_MAX=100
LOG_LEVEL=info
vercel.json- Main deployment configuration.vercelignore- Files to exclude from deploymentsrc/index.ts- Modified to export Express app for serverless
After deployment, your API will be available at:
https://your-project-name.vercel.app/
https://your-project-name.vercel.app/api/v1/health
https://your-project-name.vercel.app/api/v1/random?count=3
https://your-project-name.vercel.app/api/v1/search?q=optimus
https://your-project-name.vercel.app/api/v1/all
https://your-project-name.vercel.app/api/v1/stats
- The entire Express app runs as a single serverless function
- Cold starts may occur with infrequent usage
- Maximum execution time is 30 seconds (configurable)
- All routes are handled by the main Express application