# TypeScript and Node

> NodeBuild compiles TypeScript with tsc and tests it with Node, laying out node_modules itself.

**NodeBuild compiles TypeScript with `tsc`, tests it with Node's own test runner, and lays out `node_modules` itself from what your group pins.**

Build system: `NodeBuild`
Start one: `plinto create node-service HelloNode` (or `node-lib`)
Ships as: a package, or an archive with its own Node

## The project {#project}

Code and tests are in `src/`, tests as `*.test.ts` files next to the code. A library starts at `src/index.ts`, and a program at the file its `main` names; a project can be both. plinto writes `package.json` and `tsconfig.json` for the build, so you don't.

```conf file=plinto.conf
{
  name = HelloNode
  version = 1.0
  build = NodeBuild
  # main = src/main.ts   a program: what `plinto run` starts

  build-dependencies: {
    NodeBuild = 1.0
    Node = 24
    TypeScript = 7
    TypesNode = 24
  }
  dependencies: {
    Picocolors = 1.1.1   # from npm
  }
}
```

## Settings {#settings}

A program's `main` and `args` are in `plinto.conf`, as in [every language](../reference/plinto-conf.md#program). NodeBuild's settings are sections of it:

| Section | What it does |
|---|---|
| `run: { node-options = [...] }` | what `plinto run` passes to Node |
| `typescript: { target, lib, jsx, compiler-options }` | what `tsc` compiles for |

## Libraries {#libraries}

npm packages come in through an import. Their install scripts never run, and each one is checked against the registry's integrity hash.

```sh
$ plinto import npm picocolors@1.1.1
```

## What it releases {#releases}

A package, `HelloNode-1.0.tgz`, and for a program an archive with the app and its platform's Node.

- [Web apps](web.md): Vite, for the browser
- [Packages](../concepts/packages.md#imports): imports, for every language
- [Projects](../concepts/projects.md): one project per package
