# JavaScript / Node.js for Automation

> If you already know JavaScript, Node.js is a practical automation language with strong SDKs and a huge package ecosystem. Free notes, key concepts, resources...

Canonical: https://www.internhack.in/roadmaps/tracks/devops/node-automation
Last updated: 2026-11-28

If you already know JavaScript, Node.js is a practical automation language with strong SDKs and a huge package ecosystem.

Beginner · about 20 hours · difficulty 2/5

If you come from web development, **Node.js** lets you reuse what you know. AWS CDK, Pulumi, GitHub Actions custom actions and many CLIs are written in TypeScript or JavaScript, so this is a legitimate path.

### What to learn

- Async programming with `async`/`await` and Promises, and handling rejections.
- `node:fs/promises`, `node:path`, `node:child_process` and reading `process.env`.
- The built-in `fetch` API for HTTP calls, with timeouts via `AbortSignal.timeout`.
- Packaging CLIs with a `bin` entry in `package.json`, and locking dependencies with a lockfile.
- TypeScript basics, since infra tools like CDK and Pulumi work best with types.

### Pitfalls

Unhandled promise rejections that exit silently, pulling in heavy dependencies for trivial tasks, and scripts that depend on a specific global Node version. Pin the version with `.nvmrc` or `engines`.

**Good enough to move on:** you can write a Node script that reads config, calls an API with retries, and exits with a meaningful status code.

## Key concepts

- **async / await and Promises**
- **fs, path and child_process**
- **fetch and timeouts**
- **npm scripts and lockfiles**
- **TypeScript basics**

## Other options for this step

- [Python for Automation](https://www.internhack.in/roadmaps/tracks/devops/python-automation): Python is the most common glue language in operations work: readable, batteries-included and supported by every cloud SDK.
- [Go for Tooling](https://www.internhack.in/roadmaps/tracks/devops/go-for-devops): Go compiles to a single static binary and is the language most cloud-native tools (Docker, Kubernetes, Terraform) are written in.
- [Bash as Your First Language](https://www.internhack.in/roadmaps/tracks/devops/bash-first): Going deep on Bash first gets you productive on servers quickly, as long as you know when to switch to a real language.

## Mini project

Write a Node script that lists the open pull requests of a GitHub repo via the REST API and posts a summary to a webhook, failing clearly if the token is missing.

## Check yourself

What happens to a Node process when a Promise rejects and nothing handles it?

## Free resources

- [Learn Node.js](https://nodejs.org/en/learn) (nodejs.org)
- [Node.js API docs](https://nodejs.org/docs/latest/api/) (nodejs.org)

Previous: [Bash as Your First Language](https://www.internhack.in/roadmaps/tracks/devops/bash-first) · Next: [Linux Command Line and Packages](https://www.internhack.in/roadmaps/tracks/devops/linux-basics)

## More in Mindset and an Automation Language

- [What DevOps Really Means](https://www.internhack.in/roadmaps/tracks/devops/devops-culture)
- [Python for Automation](https://www.internhack.in/roadmaps/tracks/devops/python-automation)
- [Go for Tooling](https://www.internhack.in/roadmaps/tracks/devops/go-for-devops)
- [Bash as Your First Language](https://www.internhack.in/roadmaps/tracks/devops/bash-first)
- [JavaScript / Node.js for Automation](https://www.internhack.in/roadmaps/tracks/devops/node-automation)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [DevOps Engineer Roadmap](https://www.internhack.in/roadmaps/tracks/devops)
