# Traces and logs for TanStack Start apps

> By where the app runs: your own Node.js server, your own Cloudflare account, or Lovable hosting.

What works for traces and logs depends on where your TanStack Start app runs. Errors work everywhere with [`@belvador/tanstack-start`](https://belvador.dev/en/docs/sdk/tanstack-start).

| Where it runs | Traces and logs |
|---|---|
| Your own Node.js server (`node .output/server/index.mjs` or similar) | The [Node.js recipe](https://belvador.dev/en/docs/otel/node) |
| Your own Cloudflare account | [Cloudflare's built-in export](https://belvador.dev/en/docs/otel/cloudflare-workers) |
| Lovable hosting | Not available yet — see below |

## On your own Node.js server

The built server is an ES module, so use the ES modules launch line — both the loader hook and the register file:

```bash
export OTEL_SEMCONV_STABILITY_OPT_IN=http
export OTEL_NODE_RESOURCE_DETECTORS=env,host,os
node --experimental-loader=@opentelemetry/instrumentation/hook.mjs --import @opentelemetry/auto-instrumentations-node/register app.mjs
```

Replace `app.mjs` with your server entry. The auto-instrumentations create a server span for each request and client spans for outgoing `fetch` and database calls; server functions show up as requests to their `/_serverFn/…` URLs, not as named spans. For named spans around your own code, use `@opentelemetry/api` (`tracer.startActiveSpan`).

Pass the same API to the Belvador SDK's `otel` option so server errors carry the active span's ids — see [Link requests](https://belvador.dev/en/docs/sdk/tracing#with-opentelemetry).

## On your own Cloudflare account

Add the two destinations and the `observability` block from [Cloudflare Workers](https://belvador.dev/en/docs/otel/cloudflare-workers) to the app's `wrangler.jsonc`. Cloudflare then traces every request, `fetch` and binding call with no code.

## On Lovable hosting

Lovable publishes your app to Cloudflare under its own account, so you cannot add Cloudflare export destinations, and starting a Node.js SDK in a Worker is not possible. Use the Belvador SDK for errors and its [trace headers](https://belvador.dev/en/docs/sdk/tracing) to link browser and server errors. In-app OpenTelemetry for Workers exists in community libraries, but Belvador has not tested any.

## Status

The Node.js launch line is the certified Node.js recipe; Belvador has not run it on a TanStack Start build specifically. The Cloudflare route follows Cloudflare's documentation and is untested.
