Skip to content

vercel.json #3

Closed
0 of 1 issue completed
Closed

Description

@zskbot

Configure this repository to deploy on Vercel as a project with multiple services.

Here is a suggested vercel.json to add to the repo root directory, auto-detected from the repository layout. Treat it as a starting point, not a finished answer:

{
  "$schema": "https://openapi.vercel.sh/vercel.json",
  "services": {
    "app": {
      "root": ".",
      "framework": "jekyll"
    },
    "cloud-agent": {
      "root": "apps/cloud-agent",
      "framework": "nextjs"
    },
    "core": {
      "root": "framework/packages/core",
      "runtime": "node"
    }
  },
  "rewrites": [
    {
      "source": "/(.*)",
      "destination": {
        "service": "app"
      }
    }
  ]
}

How Vercel services work

Services let one repository deploy multiple backends and frontends as a single Vercel project, with shared routing, environment variables, and one domain. Each service is built independently, and at request time Vercel routes to a service based on the top-level rewrites.

  • Define each service under the top-level services key. A service's root is its directory relative to the directory containing vercel.json; framework, runtime, entrypoint, and buildCommand are set per service.
  • A service is internal by default and receives no public traffic. It is only reachable from the internet if a top-level rewrite targets it, using the object form: { "source": "/api/(.*)", "destination": { "service": "my_backend" } }.
  • Order rewrites from the most specific path to the least; a catch-all /(.*) should come last.
  • In services mode, build and runtime keys (functions, installCommand, buildCommand, devCommand, ignoreCommand, outputDirectory, framework) are not valid at the top level and must move into the service they belong to. Public routing keys stay at the top level.
  • vercel dev runs all services together locally and injects binding variables. Use this command for testing.

Docs: https://vercel.com/docs/services

What I need you to do

  1. Add bindings for internal services. Any service that calls another service should use a binding, declared on the calling service. A binding injects the target's internal URL into the calling service — it does not make the target public. Each entry looks like:

    "bindings": [
      { "type": "service", "service": "inventory", "format": "url", "env": "INVENTORY_URL" }
    ]

    All four fields are required: type is always "service", service is the target's name in services, format is always "url", and env is the variable Vercel injects the target's base URL into. Do not set that variable yourself.

  2. Update the application code to match the routing and bindings. Read the code to find where services currently call each other — hardcoded hostnames, localhost ports, internal base URLs, service-discovery config, docker-compose hostnames — and change them to read the bound variable, e.g. await fetch(new URL('items/123', process.env.INVENTORY_URL)). Also reconcile the code with the public paths: if a service is mounted under a path prefix, make sure its routes and any client-side URLs agree with it. Bindings resolve at runtime in functions only — not during builds, and not in middleware.

  3. Confirm the details with me before you finish. The service names, the public rewrites, and the bindings in the snippet above are inferred and may be wrong. Show me the final vercel.json and explicitly ask me to confirm:

    • the name of each service,
    • which services should be public and on what path, and which should stay internal,
    • the bindings you added, i.e. which service calls which.

    Ask about anything you had to guess rather than assuming it.

Activity

  1. github-actions commented on Oct 26, 2026

    @github-actions
    Contributor

    Message that will be displayed on users' first issue

  2. self-assigned this
    on Oct 26, 2026
  3. added
    accessibilityBarrier affecting people with disabilities
    bugSomething isn't working
    documentationImprovements or additions to documentation
    enhancementNew feature or request
    wontfixThis will not be worked on
    on Oct 26, 2026
  4. added theissue type on Oct 26, 2026
  5. linked a pull request that will close this issueInstall Vercel Web Analytics #6on Oct 26, 2026
  6. linked a pull request that will close this issueInstall Vercel Web Analytics #4on Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

accessibilityBarrier affecting people with disabilitiesbugSomething isn't workingdocumentationImprovements or additions to documentationenhancementNew feature or requestgood first issueGood for newcomerswontfixThis will not be worked on

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions