Run commands concurrently
concurrently is a widely-adopted CLI tool and Node.js library that executes multiple shell commands simultaneously in a single terminal session. With over 11 million weekly downloads, it has become the de facto standard for running parallel processes during JavaScript development. The package solves the common problem of needing to run multiple long-running processes—like a development server, file watchers, and background jobs—without juggling multiple terminal windows.
The tool distinguishes itself by adding colored prefixes to each process's output, making it trivial to identify which command produced which log line. Unlike simple shell operators like & or &&, concurrently provides programmatic control over process lifecycles, including automatic restarts, conditional killing of related processes, and inter-process communication. It works with any shell command, not just npm scripts, making it versatile across different technology stacks.
Developers typically install concurrently as a dev dependency and use it in their package.json scripts to streamline local development workflows. It's particularly valuable in monorepo setups, full-stack applications where frontend and backend need to run together, or any project requiring multiple watch processes. The package works seamlessly with npm, yarn, pnpm, and Bun, and supports both CLI usage and a programmatic Node.js API for more complex orchestration needs.
// package.json scripts using concurrently CLI
{
"scripts": {
"dev": "concurrently \"npm:dev:*\" --names \"API,UI,CSS\" --prefix-colors \"blue,green,yellow\"",
"dev:server": "nodemon server.js",
"dev:client": "vite",
"dev:css": "sass --watch src/styles:public/css"
},
"devDependencies": {
"concurrently": "^9.2.1"
}
}
// Programmatic API usage in Node.js
import concurrently from 'concurrently';
const { result } = concurrently(
[
{ command: 'node server.js', name: 'api', prefixColor: 'blue' },
{ command: 'vite', name: 'frontend', prefixColor: 'green', cwd: './client' },
{ command: 'redis-server', name: 'cache', prefixColor: 'red' }
],
{
prefix: 'name',
killOthers: ['failure', 'success'],
restartTries: 3,
restartDelay: 500
}
);
result.then(
() => console.log('All processes completed successfully'),
(error) => console.error('One or more processes failed:', error)
);Full-stack development: Run a Node.js API server (Express, Fastify) alongside a frontend dev server (Vite, Webpack) and a database watcher in one command, ensuring all services start together and logs remain visible in a single terminal.
File watching workflows: Execute multiple watchers simultaneously—TypeScript compilation, Sass preprocessing, and test runners—each monitoring different file patterns and rebuilding on changes without manual coordination.
Microservices local development: Start multiple service instances on different ports, along with their respective database migrations and message queue consumers, providing a complete local environment with one command.
Laravel/PHP integration: Combine PHP Artisan commands (serve, queue:listen, schedule:work) with npm-based asset compilation, a common pattern in modern PHP applications that mix server-side and JavaScript tooling.
Monorepo package development: Run build watchers across multiple packages simultaneously, with each package's output clearly labeled, enabling efficient development of interdependent workspace packages.
npm install concurrentlypnpm add concurrentlybun add concurrently