# gulpjs/gulp architecture

> Architecture diagram of the GitHub repository gulpjs/gulp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/gulpjs/gulp
- Repository: https://github.com/gulpjs/gulp

## Overview

Gulp is a small streaming build toolkit: developers define tasks that read files, optionally transform streams with plugins, and write results; tasks can be composed in series or parallel and rerun when watched files change. The package itself is a thin façade over task scheduling, file streams, and glob watching, with CommonJS and ESM entry points plus a CLI launcher. The README documents the broader task workflow; sampled source shows the façade’s dependencies, but not their internal implementations.

Main entry points: [`index.js`](https://github.com/gulpjs/gulp/blob/master/index.js) (Gulp Instance), [`index.mjs`](https://github.com/gulpjs/gulp/blob/master/index.mjs) (ESM Exports), [`bin/gulp.js`](https://github.com/gulpjs/gulp/blob/master/bin/gulp.js) (CLI Launcher)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Public API"]
  node_gulp["Gulp Instance<br/>[index.js]"]
  node_esm["ESM Exports<br/>[index.mjs]"]
  node_cli["CLI Launcher<br/>[gulp.js]"]
end

subgraph group_runtime["Task Runtime"]
  node_undertaker["Task Scheduler"]
end

subgraph group_io["File and Watch I/O"]
  node_vinyl["File Streams"]
  node_watcher["Glob Watcher"]
end

node_developer(("Task Author"))
node_gulp_cli["gulp-cli"]
node_plugins["Transform Plugins"]
node_files["Project Files"]

node_developer -->|"defines tasks"| node_gulp
node_gulp -->|"inherits task API"| node_undertaker
node_gulp -->|"delegates file streams"| node_vinyl
node_gulp -->|"registers watches"| node_watcher
node_esm -->|"exports instance"| node_gulp
node_cli -->|"invokes CLI"| node_gulp_cli
node_gulp_cli -.->|"loads task interface"| node_gulp
node_files -.->|"provides source files"| node_vinyl
node_vinyl -.->|"streams through"| node_plugins
node_plugins -.->|"transforms streams"| node_vinyl
node_vinyl -.->|"writes destinations"| node_files
node_watcher -.->|"triggers tasks"| node_undertaker

click node_gulp "https://github.com/gulpjs/gulp/blob/master/index.js"
click node_esm "https://github.com/gulpjs/gulp/blob/master/index.mjs"
click node_cli "https://github.com/gulpjs/gulp/blob/master/bin/gulp.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_gulp,node_esm,node_cli toneBlue
class node_undertaker toneAmber
class node_vinyl,node_watcher toneMint
class node_developer toneRose
class node_gulp_cli,node_plugins,node_files toneIndigo
```

## Components

### Public API

- [Gulp Instance](https://github.com/gulpjs/gulp/blob/master/index.js): `index.js`
- [ESM Exports](https://github.com/gulpjs/gulp/blob/master/index.mjs): `index.mjs`
- [CLI Launcher](https://github.com/gulpjs/gulp/blob/master/bin/gulp.js): `bin/gulp.js`

### Task Runtime

- **Task Scheduler**

### File and Watch I/O

- **File Streams**
- **Glob Watcher**

### Other components

- **Task Author**
- **gulp-cli**
- **Transform Plugins**
- **Project Files**

## Connections

- Task Author → Gulp Instance: defines tasks (evidence: `README.md`)
- Gulp Instance → Task Scheduler: inherits task API (evidence: `index.js`)
- Gulp Instance → File Streams: delegates file streams (evidence: `index.js`)
- Gulp Instance → Glob Watcher: registers watches (evidence: `index.js`)
- ESM Exports → Gulp Instance: exports instance (evidence: `index.mjs`)
- CLI Launcher → gulp-cli: invokes CLI (evidence: `bin/gulp.js`)
- gulp-cli → Gulp Instance: loads task interface
- Project Files → File Streams: provides source files
- File Streams → Transform Plugins: streams through (evidence: `README.md`)
- Transform Plugins → File Streams: transforms streams (evidence: `README.md`)
- File Streams → Project Files: writes destinations (evidence: `README.md`)
- Glob Watcher → Task Scheduler: triggers tasks (evidence: `README.md`)
