# Node.js

> Track events from API servers, CLIs, scripts and cron jobs.

Source: https://shipabase.dev/docs/node

## Install

`Terminal`

```bash
npm i @shipabase/js
```

## Use the Node entry

`server.ts`

```ts
import { init, trackEvent, flush } from "@shipabase/js/node";

init(process.env.SHIPABASE_KEY!, { appVersion: "2.3.0" });

trackEvent("report_generated", { pages: 12, format: "pdf" });

// Short-lived process? Flush before exit.
await flush();
```

- Uses the global `fetch` (Node 18+).
- Reads the OS from `process.platform` and `os.release()`, and the locale from `Intl`.
- Its timer never keeps your process alive. In short-lived processes, `await flush()` before exit.
