Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

Multi Project Runner

A simple Bash script that starts multiple Node.js projects from a single command.

This repository is useful when working with several related applications, such as microfrontends, that need to run at the same time during local development.

Features

  • Runs multiple projects with a single script.
  • Supports absolute or relative project paths.
  • Allows projects to be enabled or disabled easily.
  • Optionally runs npm install before starting each project.
  • Starts every project in the background.
  • Skips invalid project paths without stopping the entire script.

Requirements

Before running the script, make sure you have the following tools installed:

On Windows, the script can be executed using Git Bash.

Project Structure

multi-project-runner/
├── run-projects.sh
└── README.md

Configuration

Open run-projects.sh and update the base path where your projects are located:

path="/c/Projects/"

Use forward slashes (/), even when running the script on Windows through Git Bash.

Then configure the projects you want to start:

projects=(
  "${path}ref-common-mf"
  "${path}ref-store-mf"
  "${path}ref-search-code-mf"
)

To disable a project temporarily, comment out its line:

projects=(
  #"${path}ref-host-mf"
  "${path}ref-common-mf"
)

Dependency Installation

The INSTALL_DEPS variable controls whether npm install is executed before npm start.

INSTALL_DEPS=false

Available values:

  • true: runs npm install before npm start.
  • false: runs only npm start.

For daily development, keeping this option set to false is usually faster.

Usage

Give the script execution permission:

chmod +x run-projects.sh

Run the script:

./run-projects.sh

You can also execute it directly with Bash:

bash run-projects.sh

How It Works

The script iterates through the configured project list.

For each project, it:

  1. Verifies that the project directory exists.
  2. Changes the current directory to the project folder.
  3. Optionally runs npm install.
  4. Runs npm start as a background process.
  5. Continues with the next configured project.

The script uses the & operator to start each application in the background:

npm start &

At the end, the wait command keeps the script active until all background processes have finished.

Example Output

📁 Project: /c/Project/ref-common-mf
▶️ Running npm start...

📁 Project: /c/Project/ref-store-mf
▶️ Running npm start...

🔥 All npm start commands have been launched.

If a configured directory does not exist, the script displays a warning and continues:

⚠️ Path does not exist: /c/Project/example-project

Stopping the Projects

Press:

Ctrl + C

Depending on the terminal and operating system, some background Node.js processes may remain active. If necessary, stop them manually from the operating system's process manager.

Notes

  • Every project must contain a valid package.json.
  • Every project must define a start script.
  • Projects may use different ports.
  • Make sure the configured applications do not attempt to use the same port.
  • The script uses npm, but it can be adapted to work with pnpm or Yarn.

License

This project is intended for internal development and automation purposes. Add the license that best matches your repository requirements. :::

About

A simple Bash script that starts multiple Node.js projects from a single command.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages