# sindresorhus/is-root architecture

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

- Interactive diagram: https://gitdiagram.com/sindresorhus/is-root
- Repository: https://github.com/sindresorhus/is-root

## Overview

is-root is a tiny Node.js utility that answers whether the current process is running as the root user. Its workflow is a caller invoking the exported function, which checks whether process.getuid exists and, when available, whether it returns 0. The type declaration describes that boolean result. The implementation and README support this narrow scope; no broader product subsystems are indicated.

Main entry points: [`index.js`](https://github.com/sindresorhus/is-root/blob/main/index.js) (Root check)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime check"]
  node_isroot["Root check<br/>[index.js]"]
  node_uid["Process UID"]
  node_types["Type declaration<br/>[index.d.ts]"]
end

node_caller(("Calling process"))

node_caller -->|"calls"| node_isroot
node_isroot -->|"checks UID"| node_uid
node_isroot -->|"returns boolean"| node_caller

click node_isroot "https://github.com/sindresorhus/is-root/blob/main/index.js"
click node_types "https://github.com/sindresorhus/is-root/blob/main/index.d.ts"

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_isroot,node_uid,node_types toneBlue
class node_caller toneIndigo
```

## Components

### Runtime check

- [Root check](https://github.com/sindresorhus/is-root/blob/main/index.js): `index.js`
- **Process UID**
- [Type declaration](https://github.com/sindresorhus/is-root/blob/main/index.d.ts): `index.d.ts`

### Other components

- **Calling process**

## Connections

- Calling process → Root check: calls (evidence: `readme.md`)
- Root check → Process UID: checks UID (evidence: `index.js`)
- Root check → Calling process: returns boolean (evidence: `index.js`)
