Skip to content
Dashboard

Run multiple frameworks in one project with Vercel Services

vercel.json
{
"services": {
"my_frontend": {
"root": "frontend/",
"framework": "nextjs"
},
"my_backend": {
"root": "backend/",
"entrypoint": "main:app"
}
},
// my_backend has no public route
// it is only reachable from my_frontend internally
"rewrites": [
{
"source": "/(.*)",
"destination": { "service": "my_frontend" }
}
]
}

Vercel handles routing, builds, and environment variables automatically.

A visualization of Services Graph in the Deployment UIA visualization of Services Graph in the Deployment UI
A visualization of Services Graph in the Deployment UI

Link to headingService bindings

vercel.json
{
"services": {
"my_frontend": {
"root": "frontend/",
"framework": "nextjs",
"bindings": [
{
"type": "service",
"service": "my_backend",
"format": "url",
"env": "BACKEND_INTERNAL_URL"
}
]
},
"my_backend": { ... }
},
"rewrites": [ ... ]
}

The binding exposes my_backend to my_frontend as an environment variable.

app/api/users/route.ts
export async function GET() {
const url = new URL("/users", process.env.BACKEND_INTERNAL_URL);
const res = await fetch(url);
const users = await res.json();
return Response.json(users);
}

The route fetches from my_backend using that variable and returns the response.

Link to headingFramework-defined infrastructure

Ready to deploy?