# Task Runners and Scaffolding

> How npm scripts give each job a short name. How one command can write all the first files of a new project for you.

**Course:** [Code Editors and Package Managers](https://learn.benibix.com/learn/development-tools)  
**Time:** 11 min

**After this lesson you can:**

- Run a project's jobs with npm run
- Add a task to package.json
- Start a new project from a scaffold

## How a project names its jobs and starts its first files

A task runner runs a project's jobs by short names, such as build, test or dev. In a JavaScript project the tasks live in the scripts part of package.json, and npm is the runner. npm run build runs the longer real command behind it. A new Vite project starts with 4 of them: dev, build, lint and preview.

Each task is just a name and a command. The name dev might run a local server, build might pack the site for release, and test might run the tests. npm test and npm start are so common that they work without the word run.

The point is that nobody has to remember the real commands. They sit in the project, next to the code, and they change with it. A new teammate reads the scripts and knows how to work the project in a minute.

Scaffolding writes a new project's first files for you. You run one command and answer a few questions, such as the name and the framework. It then writes the folders, the settings and a small page that already runs. You start from working code, not an empty folder.

A common one for web projects is npm create vite@latest. Vite is a fast build tool and local server for web pages. Its scaffold asks for a name and a framework. Then it writes a folder with a project file, a settings file and a starter page.

After the scaffold, three commands get you to a page that runs. Go into the folder, install the packages, and run the dev task. The page then reloads each time you save a file.

The common mistake is keeping each starter file without reading it. You end up with settings you do not know and sample code that ships by mistake. Read each file once, and delete what you do not need.

```json
"scripts": {
  "dev": "vite",
  "build": "vite build",
  "test": "vitest"
}
```
Three named tasks in package.json. npm run build runs vite build behind the scenes.

```console
$ npm create vite@latest my-app -- --template react
$ cd my-app
$ npm install
$ npm run dev
```
Make a React starter project with Vite. Then install its packages and start the local server.

![A single command on the left, npm create vite@latest, asks two questions: the project name, my-app, and the framework, React. An arrow marked writes leads to a new my-app folder on the right, holding index.html, package.json, vite.config.js, a public folder, and a src folder with main.jsx and App.jsx.](https://learn.benibix.com/diagrams/dev5-scaffold.svg)

### Example: Lucy joins a new team

On her first day, Lucy opens the project file and finds 6 scripts. They are dev, build, test, lint, format and preview.

She runs npm install, then npm run dev, and the site is up on her laptop in 3 minutes. Nobody had to send her a list of commands.

**Words in this lesson:** [Task Runner](https://learn.benibix.com/term/development/task-runner), [Scaffolding (Software)](https://learn.benibix.com/term/development/scaffolding-software), [Vite](https://learn.benibix.com/term/development/vite)

**Question:** Where do npm run tasks come from?

**Answer:** They are the scripts part of the project's package.json. Each task is a name and a command in the scripts part of package.json. npm run and the name runs that command.

---

Source: https://learn.benibix.com/learn/development-tools/task-runners-and-scaffolding
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-19
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
