# rstacruz/nprogress architecture

> Architecture diagram of the GitHub repository rstacruz/nprogress, 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/rstacruz/nprogress
- Repository: https://github.com/rstacruz/nprogress

## Overview

NProgress is a small browser-side progress-bar library. Applications (including Ajax, Turbolinks, and Pjax integrations) call its API to configure and advance progress; the library renders and animates the bar in the DOM, then removes it when complete. Its runtime is concentrated in nprogress.js; the README documents supported controls and integration patterns. The source excerpt is partial, so internal links reflect only calls visible there or explicit README statements.

Main entry points: [`nprogress.js`](https://github.com/rstacruz/nprogress/blob/master/nprogress.js) (Progress controls), [`nprogress.css`](https://github.com/rstacruz/nprogress/blob/master/nprogress.css) (Bar styles)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Progress API"]
  node_controls["Progress controls<br/>[nprogress.js]"]
  node_configuration["Settings<br/>[nprogress.js]"]
  node_promise["Promise tracking<br/>[nprogress.js]"]
end

subgraph group_runtime["Rendering Runtime"]
  node_rendering["DOM rendering<br/>[nprogress.js]"]
  node_queue["Animation queue<br/>[nprogress.js]"]
end

subgraph group_presentation["Presentation"]
  node_stylesheet["Bar styles<br/>[nprogress.css]"]
end

node_app(("Application"))
node_integrations(("Ajax / navigation events"))
node_dom["Browser DOM"]
node_visual["Progress display"]

node_app -->|"calls"| node_controls
node_integrations -->|"starts / completes"| node_controls
node_app -->|"configures"| node_configuration
node_app -->|"tracks promises"| node_promise
node_controls -->|"renders"| node_rendering
node_promise -->|"starts / increments"| node_controls
node_controls -->|"queues animation"| node_queue
node_rendering -->|"inserts / removes"| node_dom
node_rendering -->|"creates bar"| node_visual
node_stylesheet -->|"styles"| node_visual

click node_controls "https://github.com/rstacruz/nprogress/blob/master/nprogress.js"
click node_configuration "https://github.com/rstacruz/nprogress/blob/master/nprogress.js"
click node_promise "https://github.com/rstacruz/nprogress/blob/master/nprogress.js"
click node_rendering "https://github.com/rstacruz/nprogress/blob/master/nprogress.js"
click node_queue "https://github.com/rstacruz/nprogress/blob/master/nprogress.js"
click node_stylesheet "https://github.com/rstacruz/nprogress/blob/master/nprogress.css"

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_controls,node_configuration,node_promise,node_dom toneBlue
class node_rendering,node_queue toneAmber
class node_stylesheet toneMint
class node_app,node_integrations,node_visual toneIndigo
```

## Components

### Progress API

- [Progress controls](https://github.com/rstacruz/nprogress/blob/master/nprogress.js): `nprogress.js`
- [Settings](https://github.com/rstacruz/nprogress/blob/master/nprogress.js): `nprogress.js`
- [Promise tracking](https://github.com/rstacruz/nprogress/blob/master/nprogress.js): `nprogress.js`

### Rendering Runtime

- [DOM rendering](https://github.com/rstacruz/nprogress/blob/master/nprogress.js): `nprogress.js`
- [Animation queue](https://github.com/rstacruz/nprogress/blob/master/nprogress.js): `nprogress.js`

### Presentation

- [Bar styles](https://github.com/rstacruz/nprogress/blob/master/nprogress.css): `nprogress.css`

### Other components

- **Application**
- **Ajax / navigation events**
- **Browser DOM**
- **Progress display**

## Connections

- Application → Progress controls: calls (evidence: `Readme.md`)
- Ajax / navigation events → Progress controls: starts / completes (evidence: `Readme.md`)
- Application → Settings: configures (evidence: `Readme.md`)
- Application → Promise tracking: tracks promises (evidence: `nprogress.js`)
- Progress controls → DOM rendering: renders (evidence: `nprogress.js`)
- Promise tracking → Progress controls: starts / increments (evidence: `nprogress.js`)
- Progress controls → Animation queue: queues animation (evidence: `nprogress.js`)
- DOM rendering → Browser DOM: inserts / removes (evidence: `nprogress.js`)
- DOM rendering → Progress display: creates bar (evidence: `nprogress.js`)
- Bar styles → Progress display: styles (evidence: `Readme.md`)
