# Capture your first TrafficWar event with Node.js.

> Install @trafficwar/node, configure a server API key, capture an event, and close the client during graceful shutdown.

The official Node.js server SDK is the recommended path. It batches events, compresses requests, retries delivery, and waits for durable server acknowledgement.

## Install the SDK



```
npm install @trafficwar/node
```

## Create a client and capture an event



```typescript
import { TrafficWar } from "@trafficwar/node";

const trafficwar = new TrafficWar({
  apiKey: process.env.TRAFFICWAR_API_KEY!,
});

trafficwar.capture({
  event: "http",
  label: "Checkout",
  path: "/v1/checkout",
  http_method: "POST",
  source: "checkout-api",
  operation_type: "route.handler",
  latency_ms: 84.2,
  status_code: 200,
});

await trafficwar.close();
```

## Keep the key on the server

Create a service and API key in the panel. Store the token in a server-side secret such as TRAFFICWAR_API_KEY; never put a server key into browser code or a public repository.

The Python client is implemented in the SDK repository but is not published yet. Use the Node.js package or the HTTP ingest API until a Python release is announced.

## Related

- [Use stable event identities that stay useful at scale.](https://trafficwar.tech/docs/event-schema.md)
- [Send events over the TrafficWar ingest API.](https://trafficwar.tech/docs/ingest-api.md)
- [Connect spans with one trace ID and route label.](https://trafficwar.tech/docs/traces.md)
