Vercel
Two common layouts.
A. Static only
- Import the repo (or a deploy of the
apibranch). - Set Output Directory to
api. - Serve JSON directly from the CDN.
B. Static + router
json
{
"buildCommand": "bun run build:api -- --from .work/export || true",
"outputDirectory": "api",
"rewrites": [
{ "source": "/v1/(.*)", "destination": "/api/router.ts" }
]
}Practical approach:
- Attach the
apiartifacts (download in build from theapibranch or object storage). - Run
@wca/routerwithSTATIC_ROOT=./apiorSTATIC_BASE_URL=.... - Expose
/v1/*from the Node/Bun runtime and keep raw JSON under/static/*if desired.
Environment variables are the same as Caching and:
| Variable | Meaning |
|---|---|
STATIC_ROOT | local directory of generated JSON |
STATIC_BASE_URL | remote static origin (raw/jsDelivr/nginx) |
PERSON_SHARDED | true if built with --person-shard |