Debug Multiple Services in One VS Code Session with Compound Launch Configurations
Use .vscode/launch.json compound configurations to start backend, frontend, and workers together, then verify adapter stop behavior before committing.
08 Nov 2025, 01:02 UTC

The problem: starting two debuggers just to test one feature
You change an API endpoint, then switch terminals to restart the backend, switch again to refresh the frontend, and watch two separate Debug Consoles. If the frontend call fails, you cannot tell whether the server received the request or the client sent it. VS Code can start multiple programs in a single debug session using a compound launch configuration, so one F5 starts backend, frontend, and workers together.
Useful takeaway: a compound configuration groups existing launch configurations by name. It is best for client-server or full-stack local debugging, but it couples process lifecycles and can break on teammates' machines if it contains absolute paths.
How compound launch configurations work
VS Code reads debug configurations from .vscode/launch.json in the workspace. A configuration tells a debug adapter how to start or attach to a program. A compound configuration has type compound and lists other configurations by name in its configurations array. Every referenced name must exist in the same file.
When you press F5 and select the compound entry, VS Code starts each inner configuration in one debug session. The Debug Console shows output from every adapter, usually interleaved. The Debug sidebar lists each target separately so you can inspect variables and set breakpoints per program.
Worked example: backend plus frontend
Open the Command Palette, run Debug: Open Configurations, and edit .vscode/launch.json. You need write permission to the workspace folder; no administrator rights are required.
{
"version": "0.2.0",
"configurations": [
{
"name": "Backend API",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/server/index.js",
"env": { "PORT": "3001" },
"console": "integratedTerminal"
},
{
"name": "Frontend Dev Server",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/frontend/dev-server.js",
"env": { "PORT": "5173" },
"console": "integratedTerminal"
},
{
"name": "Full Stack",
"type": "compound",
"configurations": ["Backend API", "Frontend Dev Server"],
"stopAll": true
}
]
}
Placeholders: replace server/index.js and frontend/dev-server.js with your actual entry points. ${workspaceFolder} resolves to the folder opened in VS Code, so the configuration works if a teammate clones the repository to a different directory. Do not use absolute paths such as /Users/you/project/server/index.js.
Expected check: save the file, press F5, choose Full Stack, and confirm both entries appear in the Debug sidebar. Stop one target and observe whether the other stops. That result depends on the debug adapter and VS Code version; stopAll: true is honored by some adapters but not all.
Rollback: if the compound session behaves unexpectedly, remove the compound entry from launch.json or revert the file to the previous commit. The workspace returns to single-target debugging immediately.
Limitations and team decisions
- Interleaved logs. Output from all adapters appears in the same Debug Console. Look at the source label on each line to attribute logs to the backend or frontend.
- Coupled lifecycles. If the backend crashes, the frontend may keep running. Compound launch does not automatically restart failed workers.
- Portability. Committed
launch.jsoncan bake in ports, environment variables, or workspace-relative assumptions that fail on another machine or in CI. - Adapter differences. Attach behavior, simultaneous debugging, and
stopAllsupport vary by language extension and VS Code version.
Verify before you commit
- Clone the workspace to a different directory.
- Open it in VS Code and run Debug: Open Configurations.
- Start the compound configuration and confirm both targets appear without path errors.
- Inspect the Debug Console to verify which adapter produced each log line.
- Stop one target to check whether the other stops, then decide if that behavior matches your team's expectations.
If the configuration works across directories and the stop behavior is acceptable, commit .vscode/launch.json so the team can review it. If a teammate needs different ports or entry points, they can override the file locally rather than editing the committed copy.
Closing
A compound launch configuration removes the friction of starting multiple debuggers by hand, but it is not a substitute for distributed tracing or separate service logs. Use it for local full-stack debugging, verify adapter behavior on each machine, and keep paths relative before sharing it with your team.