# Node.js server

> Sending events and errors to Clearlook from a Node.js server.

- **Events:** `POST https://app.clearlook.dev/v1/b?key=pk_…` with JSON `{"sent_at": "<ISO time>", "events": [{"id": "<uuid>", "event": "Invoice paid", "timestamp": "<ISO time>", "user_id": "<the app's user id>", "properties": {"amount": 120}}]}`. Events are batched, sent after the response, and dropped quietly on failure so the app never waits on analytics.
- **Ids:** `user_id` is the same id the browser passes to `identify`, so server and browser events join up. Ids are never generated on the server.
- **Errors:** `@sentry/node` with the project DSN; `release` set to the deploy's commit so errors link to releases.
- **Keys:** the `pk_` key is public; a `pat_` or `svc_` key only belongs in server secrets, for uploads and the API.
