vercel-services
Vercel Services — deploy multiple services within a single Vercel project. Use for monorepo layouts or when combining a backend (Python, Go) with a frontend (Next.js, Vite) in one deployment.
- License 许可
- MIT
- 最近更新
- 2026-09-22
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- vercel-services
- metadata
- { "docs": [ "https://vercel.com/docs/services" ], "sitemap": "https://vercel.com/sitemap/docs.xml", "priority": 7, "bashPatterns": [ "\\bvercel\\s+dev\\b.*-L", "\\bpip\\s+install\\b.*fastapi", "\\buv\\s+(sync|pip|run)\\b", "\\bgo\\s+(run|build|mod)\\b", "\\bpython\\s+-m\\s+uvicorn\\b", "\\buvicorn\\b" ], "pathPatterns": [ "backend/**", "backend/main.py", "backend/main.go", "backend/go.mod", "backend/pyproject.toml", "backend/requirements.txt", "frontend/**", "apps/*/backend/**", "apps/*/frontend/**", "services/*/vercel.json", "*/pyproject.toml", "*/go.mod" ], "promptSignals": { "allOf": [ [ "backend", "frontend" ], [ "python", "vercel" ], [ "go", "vercel" ], [ "backend", "deploy" ], [ "service", "monorepo" ], [ "fastapi", "deploy" ] ], "anyOf": [ "backend", "monorepo", "service", "python", "golang" ], "noneOf": [ "turborepo cache", "turbo.json", "aws lambda", "docker compose" ], "phrases": [ "services api", "vercel services", "multi-service", "python backend", "go backend", "fastapi", "deploy backend", "backend and frontend", "multiple services" ], "minScore": 6 }, "importPatterns": [ "fastapi" ] }
- description
- Vercel Services — deploy multiple services within a single Vercel project. Use for monorepo layouts or when combining a backend (Python, Go) with a frontend (Next.js, Vite) in one deployment.
02 资源文件 5
03 SKILL.md 正文
Deploy multi-service projects with Vercel
Services let you deploy multiple independently-built units within a single Vercel project. The typical use case is combining different runtimes (e.g. Python + JavaScript) in one deployment with shared routing and environment variables, but services work for any combination — multiple services of the same runtime, different frameworks, or a mix.
This skill covers project structure and configuration. For the actual deployment, defer to the deployments-cicd skill.
How It Works
A service is an independently built unit within your project, deployed to the same domain under a unique subpath. At build time, Vercel builds each service separately. At request time, Vercel routes incoming requests to the correct service based on the URL path prefix (longest prefix wins).
- Services are enabled via the
experimentalServicesfield invercel.json(see reference project). vercel dev -Lauto-detects frameworks and runs all services locally as one application, handling routing automatically. The-Lflag (short for--local) runs without authenticating with Vercel Cloud.- Only
vercel.jsonlives at the root. Each service manages its own dependencies independently.
Configuration
Define services in vercel.json:
{
"experimentalServices": {
"web": {
"entrypoint": "apps/web",
"routePrefix": "/"
},
"api": {
"entrypoint": "backend/main.py",
"routePrefix": "/server"
}
}
}
The project's Framework Preset must be set to Services in the Vercel dashboard.
Configuration fields
| Field | Required | Description |
|---|---|---|
entrypoint |
Yes | Path to the service entrypoint file or directory. |
routePrefix |
Yes | URL path prefix for routing (e.g. /, /api, /svc/go). |
framework |
No | Framework slug. Pins detection; auto-detected if unset. |
memory |
No | Max available RAM in MB (128–10,240). |
maxDuration |
No | Execution timeout in seconds (1–900). |
includeFiles |
No | Glob patterns for files to include in the deployment. |
excludeFiles |
No | Glob patterns for files to exclude from the deployment. |
Do not add unknown fields — they will cause the build to fail.
Supported runtimes and frameworks
Services is in beta. Python and Go are tested and production-ready. Other runtimes may work but are not yet validated.
Python
Works with FastAPI, Flask, Django, or any ASGI/WSGI application. Framework is auto-detected. Set entrypoint to the application file (e.g. "backend/main.py"). Dependencies go in pyproject.toml in the service directory.
Go
Set entrypoint to the service directory (e.g. "backend"), not a file. Must set "framework": "go" explicitly in vercel.json — auto-detection does not work for Go services. Dependencies in go.mod in the service directory.
Other runtimes (untested)
Vercel supports Node.js, Bun, Rust, Ruby, Wasm, and Edge runtimes for functions. These can theoretically be used as services but are not yet validated.
Routing
Vercel evaluates route prefixes from longest to shortest (most specific first), with the primary service (/) as the catch-all. Vercel automatically mounts services at their routePrefix, so service handlers should not include the prefix in their routes.
For frontend frameworks mounted on a subpath (not /), configure the framework's own base path (e.g. basePath in next.config.js) to match routePrefix.
Environment variables
Vercel auto-generates URL variables so services can find each other:
| Variable | Example value | Availability | Use case |
|---|---|---|---|
{SERVICENAME}_URL |
https://your-deploy.vercel.app/svc/api |
Server-side | Server-to-server requests |
NEXT_PUBLIC_{SERVICENAME}_URL |
/svc/api |
Client-side | Browser requests (relative, no CORS) |
SERVICENAME is the key name from experimentalServices, uppercased. If you define an env var with the same name in project settings, your value takes precedence.
Usage
- Read
references/fastapi-vite/for the canonical project layout. - Adapt the structure to the user's chosen runtimes — services can use any supported runtime, not just the ones in the reference.
- Define service routes without the route prefix — Vercel strips the prefix before forwarding.
- Validate that each service in
vercel.jsonhasentrypointandroutePrefix. Only setframeworkwhen auto-detection fails (required for Go).
Output
After scaffolding, present the created file structure to the user. After deployment, present the deployment URL (refer to the deployments-cicd skill for details).
Troubleshooting
404 on routes after deployment
The project needs the Services framework preset:
- Go to Project Settings → Build & Deployment → Framework Preset
- Select Services from the dropdown
- Redeploy
Routes return unexpected results
- Ensure all services are picked up by
vercel dev— check logs. If a service is missing, verifyvercel.json. Try settingframeworkexplicitly. - Validate route prefix behavior: handlers declare routes without
routePrefix(e.g./health), but requests from other services use the full prefix (e.g./api/health). - For frontend services on a subpath, confirm the framework's base path config matches
routePrefix.
04 同仓库更多 Skills
skill-installer
Install Codex skills into $CODEX_HOME/skills from a curated list or a GitHub repo path. Use when a user asks to list installable skills, install a curated skill, or install a skill from another repo (including private repos).
skill-creator
Create or update a Codex skill with appropriately scoped instructions and any needed supporting resources.
review-agent
Perform a read-only, defect-first review of a specified code change and return every actionable finding. Use when another agent delegates review of uncommitted changes, a base-branch diff, a commit, or custom review instructions.
plugin-creator
Create and scaffold plugin directories for Codex with a required `.codex-plugin/plugin.json`, optional plugin folders/files, valid manifest defaults, and personal-marketplace entries by default. Use when Codex needs to create a new personal plugin, add optional plugin structure, generate or update marketplace entries for plugin ordering and availability metadata, or update an existing local plugin during development with the CLI-driven cachebuster and reinstall flow.
openai-docs
Use for Codex models/pricing, scheduled tasks, skills, settings, setup, troubleshooting, customization, automations, and self-knowledge—including 'you,' 'your,' 'this app,' or 'this coding agent' when they refer to Codex—and for OpenAI APIs/products and ChatGPT Work. Also use for model choice/migration, prompting, SDKs, Responses, Realtime, agents, evals, and Chat/Work/Codex comparisons. Do not use for generic app/software tasks that merely mention Codex.
imagegen
Generate or edit raster images when the task benefits from AI-created bitmap visuals such as photos, illustrations, textures, sprites, mockups, or transparent-background cutouts. Use when Codex should create a brand-new image, transform an existing image, or derive visual variants from references, and the output should be a bitmap asset rather than repo-native code or vector. Do not use when the task is better handled by editing existing SVG/vector/code-native assets, extending an established icon or logo system, or building the visual directly in HTML/CSS/canvas.