#Vercel Deployment
The vercel build target generates a Vercel-compatible output with serverless function entry point and routing configuration.
#Build
alepha build --target=vercel
This forces the node runtime. You cannot combine --target=vercel with --runtime=bun or --runtime=workerd.
#Environment Variables
Required for deployment:
| Variable | Description |
|---|---|
VERCEL_TOKEN |
Vercel API token |
VERCEL_ORG_ID |
Vercel organization/team ID |
VERCEL_PROJECT_ID |
Vercel project ID |
#Deploy
alepha deploy detects the vercel.json in dist/ and runs the Vercel CLI:
alepha build --target=vercel
alepha deploy
For production deployment:
alepha deploy --mode production
If the Vercel CLI is not installed, the deploy command installs it automatically as a dev dependency.
#Generated Output
The build produces:
dist/vercel.json-- Route rewrites and build configurationdist/api/index.js-- Serverless function entry pointdist/public/-- Static client assets (if React frontend exists)dist/.vercel/project.json-- Project linking (ifVERCEL_ORG_IDandVERCEL_PROJECT_IDare set)
The vercel.json rewrites all routes to the serverless function:
1{2 "rewrites": [{ "source": "/(.*)", "destination": "/api/index.js" }],3 "buildCommand": "",4 "installCommand": "",5 "outputDirectory": "public"6}
#Configuration
1import { defineConfig } from "alepha/cli"; 2 3export default defineConfig({ 4 build: { 5 target: "vercel", 6 vercel: { 7 projectName: "my-app", 8 orgId: "team_abc123", 9 projectId: "prj_abc123",10 config: {11 crons: [12 { path: "/api/cron", schedule: "0 * * * *" },13 ],14 },15 },16 },17});
The orgId and projectId can also be set via environment variables (VERCEL_ORG_ID, VERCEL_PROJECT_ID), which take precedence over config values.
#Limitations
Vercel serverless functions have constraints that affect some Alepha features:
- Queue (
$queue) is not supported - Cron (
$scheduler) has limited support -- must be configured manually via thevercelconfigcronsoption - Cold starts -- serverless functions have startup latency on the first request
- Execution time limits -- Vercel imposes per-request timeouts depending on your plan
#Recommendation
If serverless is a goal, prefer Cloudflare Workers with --target=cloudflare. Cloudflare Workers have:
- Lower cold start latency
- Native cron trigger support via
$scheduler - D1 database integration
- Lower cost at scale
Use Vercel when you have existing infrastructure on the platform or need specific Vercel features (preview deployments, analytics, etc.).