DevForth

Start your dev servers automatically when you open a project in VS Code

A small .vscode/tasks.json that starts your frontend, backend and other dev commands in split terminals as soon as the project folder opens.

Ivan Borshchov
Ivan Borshchov
CEO & System Architect @ DevForth
Start your dev servers automatically when you open a project in VS Code
Start your dev servers automatically when you open a project in VS Code

Every morning goes the same way. Open the project, open a terminal, cd frontend, npm run dev, open another terminal, cd backend, start that one too. It's small and boring, and you do it every day. Let VS Code do it for you.

Create .vscode/tasks.json in the project:

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "frontend",
      "type": "shell",
      "command": "npm run dev",
      "options": { "cwd": "${workspaceFolder}/frontend" },
      "presentation": { "panel": "new", "group": "dev" },
      "runOptions": { "runOn": "folderOpen" }
    },
    {
      "label": "backend",
      "type": "shell",
      "command": "npm run dev",
      "options": { "cwd": "${workspaceFolder}/backend" },
      "presentation": { "panel": "new", "group": "dev" },
      "runOptions": { "runOn": "folderOpen" }
    }
  ]
}

What each piece does:

  • Each task is one command running in its own terminal.
  • cwd is the folder the command runs in, so you don't need cd.
  • group: "dev" places the terminals side by side in one split panel.
  • runOn: "folderOpen" starts the task when you open the folder.

The first time, VS Code asks whether to allow automatic tasks. Choose Allow. You can change this later with the "Tasks: Manage Automatic Tasks" command. Automatic tasks never run in a workspace you haven't marked as trusted, which is a good safety net for code you just cloned.

Need a third command, like a queue worker or a database in Docker? Copy one task and change the label, command and folder.

Commit the file, and everyone on the team gets the same zero-click start.

In short: put your start commands in .vscode/tasks.json and add runOn: "folderOpen" to each one.

Get your project quote

Free result within 48-72 hours

Related insights