Next.js + FastAPI + Bindings
// vercel.json
{
"services": {
"frontend": {
"root": "frontend/",
"framework": "nextjs",
"bindings": [
{
"type": "service",
"service": "backend",
"format": "url",
"env": "BACKEND_URL"
}
]
},
"backend": {
"root": "backend/",
"entrypoint": "main:app"
}
},
"rewrites": [
{ "source": "/(.*)", "destination": { "service": "frontend" } }
]
}Next.js API Route
Calls /api/hello, a route handler running on the Next.js frontend service.
FastAPI Backend Route
Calls /api/backend/status, a Next.js proxy route that uses BACKEND_URL to reach the internal FastAPI service.
FastAPI Sample Data
Open the backend sample data proxied at /api/backend/items.