> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tracelit.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Get Tracelit running on a frontend site or a backend service in minutes. Framework snippets, OpenTelemetry in code, and the environment rules that matter.

<img src="https://mintcdn.com/tracelit/Mdr8MXu5ncxQ7PIu/images/setup.png?fit=max&auto=format&n=Mdr8MXu5ncxQ7PIu&q=85&s=02c00fe4a41922edd0367d9012ae0ccb" alt="Tracelit dashboard spanning frontend sites and backend services" className="rounded-lg" width="2764" height="1750" data-path="images/setup.png" />

*Pick a path. Frontend = **Sites**. Backend = **Services**. Same workspace either way.*

<Warning>
  **Environment is not optional.** Wrong values get dropped or mis-tagged.

  | Surface                      | Field                    | Allowed values                       |
  | ---------------------------- | ------------------------ | ------------------------------------ |
  | **Sites** (tracker)          | `environment`            | `development`, `production`          |
  | **Services** (OpenTelemetry) | `deployment.environment` | `local`, `development`, `production` |

  Sites default to `development` if omitted. Services must set `deployment.environment` explicitly in the resource attributes.
</Warning>

***

## Frontend

Same choice as in the Tracelit app when you add a site: **I'm an engineer** (paste code) or **I'm a vibe coder** (paste a prompt into your AI).

<Tabs>
  <Tab title="I'm an engineer">
    <img src="https://mintcdn.com/tracelit/Mdr8MXu5ncxQ7PIu/images/engineer.svg?fit=max&auto=format&n=Mdr8MXu5ncxQ7PIu&q=85&s=de7af3c705da5508bbd4cedee9e1c48b" alt="Install as an engineer — copy-paste snippets" style={{ width: '120px', marginBottom: '12px' }} width="1000" height="1000" data-path="images/engineer.svg" />

    Install `@tracelit/tracker` (or the script tag), pass your **site token**, and always set `environment` to `development` or `production`.

    ```bash theme={null}
    npm install @tracelit/tracker
    ```

    <Tabs>
      <Tab title="HTML5">
        <img src="https://mintcdn.com/tracelit/yOAHPOHDFCUOtcaa/images/html5.svg?fit=max&auto=format&n=yOAHPOHDFCUOtcaa&q=85&s=527b27f122ef2cc577491f7e73ebeca3" alt="HTML5" style={{ width: '28px', marginBottom: '8px' }} width="512" height="512" data-path="images/html5.svg" />

        Paste in `<head>` — no npm required:

        ```html theme={null}
        <script>
          !function(w,d){
            var t=w.__tl={
              _q:[],
              token:'YOUR_SITE_TOKEN',
              environment:'production' // or "development"
            };
            ['init','identify','reset','startReplay','stopReplay','optOut','optIn','destroy']
              .forEach(function(m){t[m]=function(){t._q.push([m,[].slice.call(arguments)])}});
            var s=d.createElement('script');s.async=!0;
            s.src='https://cdn.tracelit.app/t.js';d.head.appendChild(s);
          }(window,document);
        </script>
        ```

        Full guide: [Script tag](/installation/script-tag)
      </Tab>

      <Tab title="React">
        ```tsx theme={null}
        // src/main.tsx or src/App.tsx
        import { init } from '@tracelit/tracker'

        init({
          token: 'YOUR_SITE_TOKEN',
          environment: 'production', // or "development"
        })
        ```

        Full guide: [React](/installation/react)
      </Tab>

      <Tab title="Next.js App">
        ```tsx theme={null}
        // components/Tracelit.tsx
        'use client'
        import { useEffect } from 'react'
        import { init } from '@tracelit/tracker'

        export function Tracelit() {
          useEffect(() => {
            init({
              token: 'YOUR_SITE_TOKEN',
              environment: 'production', // or "development"
            })
          }, [])
          return null
        }
        ```

        Mount `<Tracelit />` in `app/layout.tsx`.

        Full guide: [Next.js App Router](/installation/nextjs-app-router)
      </Tab>

      <Tab title="Next.js Pages">
        ```tsx theme={null}
        // pages/_app.tsx
        import { useEffect } from 'react'
        import { init } from '@tracelit/tracker'
        import type { AppProps } from 'next/app'

        export default function App({ Component, pageProps }: AppProps) {
          useEffect(() => {
            init({
              token: 'YOUR_SITE_TOKEN',
              environment: 'production', // or "development"
            })
          }, [])
          return <Component {...pageProps} />
        }
        ```

        Full guide: [Next.js Pages Router](/installation/nextjs-pages-router)
      </Tab>

      <Tab title="Vue">
        ```ts theme={null}
        // src/main.ts
        import { createApp } from 'vue'
        import { init } from '@tracelit/tracker'
        import App from './App.vue'

        init({
          token: 'YOUR_SITE_TOKEN',
          environment: 'production', // or "development"
        })
        createApp(App).mount('#app')
        ```

        Full guide: [Vue 3](/installation/vue)
      </Tab>

      <Tab title="Svelte">
        ```svelte theme={null}
        <!-- src/routes/+layout.svelte -->
        <script>
          import { onMount } from 'svelte'
          import { init } from '@tracelit/tracker'

          onMount(() =>
            init({
              token: 'YOUR_SITE_TOKEN',
              environment: 'production', // or "development"
            })
          )
        </script>

        <slot />
        ```

        Full guide: [Svelte / SvelteKit](/installation/svelte)
      </Tab>

      <Tab title="Angular">
        ```ts theme={null}
        // src/app/app.component.ts
        import { Component, OnInit } from '@angular/core'
        import { init } from '@tracelit/tracker'

        @Component({
          selector: 'app-root',
          templateUrl: './app.component.html',
        })
        export class AppComponent implements OnInit {
          ngOnInit() {
            init({
              token: 'YOUR_SITE_TOKEN',
              environment: 'production', // or "development"
            })
          }
        }
        ```

        Full guide: [Angular](/installation/angular)
      </Tab>
    </Tabs>
  </Tab>

  <Tab title="I'm a vibe coder">
    <img src="https://mintcdn.com/tracelit/Mdr8MXu5ncxQ7PIu/images/vibe.svg?fit=max&auto=format&n=Mdr8MXu5ncxQ7PIu&q=85&s=8776328decd60e2c21d4f9b005a100d1" alt="Install as a vibe coder — paste a prompt into your AI" style={{ width: '120px', marginBottom: '12px' }} width="1000" height="1000" data-path="images/vibe.svg" />

    Paste this into Cursor, Claude, ChatGPT, Bolt, Lovable, or Replit. Replace the token first.

    ```text theme={null}
    Install Tracelit in my project.

    Framework: <react | next-app-router | next-pages-router | vue | sveltekit | angular | plain-html>
    Site token: YOUR_SITE_TOKEN
    Environment: production

    Rules:
    1) If this is a JS framework, install @tracelit/tracker and call init({ token, environment }) in the app root/entry (or Client Component for Next App Router).
    2) environment must be exactly "production" or "development".
    3) If plain HTML / HTML5, add the Tracelit script in <head> with token and environment on __tl (cdn.tracelit.app/t.js).
    4) Keep changes minimal. Show changed files and a 30-second verify checklist.
    ```

    Prefer the in-app path? Add a site in Tracelit and choose **I'm a vibe coder** — you'll get the same style of prompt with your token filled in.
  </Tab>
</Tabs>

### Verify (frontend)

Open the site, click around, then check the Tracelit app:

* Live visitor under the site
* A new session in **Sessions**
* Page views / clicks appearing

***

## Backend

Same choice when you add a service in the app: **I'm an engineer** (recipe in code) or **I'm a vibe coder** (AI prompt).

<Warning>
  Protocol must be `http/protobuf`. gRPC exporters will fail silently against Tracelit ingest.

  Set `deployment.environment` to exactly one of: `local`, `development`, `production`.
</Warning>

You still need your **ingest key** from the service's **Utilities → Environment**. Export **traces and logs** — traces-only never passes the connection check.

| Setting      | Value                                    |
| ------------ | ---------------------------------------- |
| Endpoint     | `https://ingest.tracelit.app`            |
| Protocol     | `http/protobuf`                          |
| Auth header  | `Authorization=Bearer <INGEST_KEY>`      |
| Service name | your service name (e.g. `payments-api`)  |
| Environment  | `local` \| `development` \| `production` |

<Tabs>
  <Tab title="I'm an engineer">
    <img src="https://mintcdn.com/tracelit/Mdr8MXu5ncxQ7PIu/images/engineer.svg?fit=max&auto=format&n=Mdr8MXu5ncxQ7PIu&q=85&s=de7af3c705da5508bbd4cedee9e1c48b" alt="Install as an engineer — OpenTelemetry in code" style={{ width: '120px', marginBottom: '12px' }} width="1000" height="1000" data-path="images/engineer.svg" />

    Point OpenTelemetry at Tracelit **in code** — no shell `OTEL_*` vars required for a quickstart.

    <Tabs>
      <Tab title="Node.js">
        ```bash theme={null}
        npm install @opentelemetry/sdk-node @opentelemetry/api \
          @opentelemetry/auto-instrumentations-node \
          @opentelemetry/exporter-trace-otlp-proto \
          @opentelemetry/exporter-logs-otlp-proto \
          @opentelemetry/sdk-logs @opentelemetry/resources
        ```

        ```js theme={null}
        // tracelit-otel.cjs — load before your app
        const { NodeSDK } = require('@opentelemetry/sdk-node')
        const { resourceFromAttributes } = require('@opentelemetry/resources')
        const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-proto')
        const { OTLPLogExporter } = require('@opentelemetry/exporter-logs-otlp-proto')
        const { BatchLogRecordProcessor } = require('@opentelemetry/sdk-logs')
        const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node')

        const endpoint = 'https://ingest.tracelit.app'
        const headers = { Authorization: 'Bearer <INGEST_KEY>' }

        const sdk = new NodeSDK({
          resource: resourceFromAttributes({
            'service.name': 'payments-api',
            'deployment.environment': 'production', // local | development | production
          }),
          traceExporter: new OTLPTraceExporter({ url: `${endpoint}/v1/traces`, headers }),
          logRecordProcessor: new BatchLogRecordProcessor(
            new OTLPLogExporter({ url: `${endpoint}/v1/logs`, headers })
          ),
          instrumentations: [getNodeAutoInstrumentations()],
        })

        sdk.start()
        ```

        Start with: `NODE_OPTIONS="--require ./tracelit-otel.cjs" node server.js`

        Full guide: [Node.js OpenTelemetry](/otel/node)
      </Tab>

      <Tab title="Go">
        ```bash theme={null}
        go get go.opentelemetry.io/otel@latest
        go get go.opentelemetry.io/otel/sdk@latest
        go get go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp@latest
        go get go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp@latest
        go get go.opentelemetry.io/otel/sdk/log@latest
        go get go.opentelemetry.io/otel/sdk/resource@latest
        ```

        In `main`, build resource + OTLP HTTP exporters in code:

        ```go theme={null}
        res, _ := resource.Merge(
          resource.Default(),
          resource.NewWithAttributes(
            semconv.SchemaURL,
            semconv.ServiceName("payments-api"),
            semconv.DeploymentEnvironmentName("production"), // local | development | production
          ),
        )

        traceExp, _ := otlptracehttp.New(ctx,
          otlptracehttp.WithEndpoint("ingest.tracelit.app"),
          otlptracehttp.WithURLPath("/v1/traces"),
          otlptracehttp.WithHeaders(map[string]string{
            "Authorization": "Bearer <INGEST_KEY>",
          }),
        )

        logExp, _ := otlploghttp.New(ctx,
          otlploghttp.WithEndpoint("ingest.tracelit.app"),
          otlploghttp.WithURLPath("/v1/logs"),
          otlploghttp.WithHeaders(map[string]string{
            "Authorization": "Bearer <INGEST_KEY>",
          }),
        )
        // Wire TracerProvider + LoggerProvider with res, then bridge slog/zap/logrus
        ```

        Full guide: [Go OpenTelemetry](/otel/go)
      </Tab>

      <Tab title="Python">
        ```bash theme={null}
        python -m pip install opentelemetry-sdk opentelemetry-exporter-otlp-proto-http \
          opentelemetry-instrumentation
        ```

        ```python theme={null}
        from opentelemetry import trace
        from opentelemetry.sdk.resources import Resource
        from opentelemetry.sdk.trace import TracerProvider
        from opentelemetry.sdk.trace.export import BatchSpanProcessor
        from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
        from opentelemetry.sdk._logs import LoggerProvider, LoggingHandler
        from opentelemetry.sdk._logs.export import BatchLogRecordProcessor
        from opentelemetry.exporter.otlp.proto.http._log_exporter import OTLPLogExporter
        from opentelemetry._logs import set_logger_provider
        import logging

        resource = Resource.create({
            "service.name": "payments-api",
            "deployment.environment": "production",  # local | development | production
        })
        headers = {"Authorization": "Bearer <INGEST_KEY>"}
        endpoint = "https://ingest.tracelit.app"

        tp = TracerProvider(resource=resource)
        tp.add_span_processor(BatchSpanProcessor(OTLPSpanExporter(
            endpoint=f"{endpoint}/v1/traces", headers=headers
        )))
        trace.set_tracer_provider(tp)

        lp = LoggerProvider(resource=resource)
        lp.add_log_record_processor(BatchLogRecordProcessor(OTLPLogExporter(
            endpoint=f"{endpoint}/v1/logs", headers=headers
        )))
        set_logger_provider(lp)
        logging.getLogger().addHandler(LoggingHandler(logger_provider=lp))
        ```

        Full guide: [Python OpenTelemetry](/otel/python)
      </Tab>

      <Tab title="Java">
        ```bash theme={null}
        curl -sSL -o opentelemetry-javaagent.jar \
          https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/latest/download/opentelemetry-javaagent.jar

        java \
          -javaagent:./opentelemetry-javaagent.jar \
          -Dotel.service.name=payments-api \
          -Dotel.resource.attributes=deployment.environment=production \
          -Dotel.exporter.otlp.endpoint=https://ingest.tracelit.app \
          -Dotel.exporter.otlp.protocol=http/protobuf \
          -Dotel.exporter.otlp.headers=Authorization=Bearer\ <INGEST_KEY> \
          -jar your-app.jar
        ```

        Full guide: [Java OpenTelemetry](/otel/java)
      </Tab>

      <Tab title=".NET">
        ```bash theme={null}
        dotnet add package OpenTelemetry.Extensions.Hosting
        dotnet add package OpenTelemetry.Exporter.OpenTelemetryProtocol
        dotnet add package OpenTelemetry.Instrumentation.AspNetCore
        dotnet add package OpenTelemetry.Instrumentation.Http
        ```

        ```csharp theme={null}
        builder.Services.AddOpenTelemetry()
            .ConfigureResource(r => r
                .AddService("payments-api")
                .AddAttributes(new Dictionary<string, object>
                {
                    ["deployment.environment"] = "production" // local | development | production
                }))
            .WithTracing(t => t
                .AddAspNetCoreInstrumentation()
                .AddHttpClientInstrumentation()
                .AddOtlpExporter(o =>
                {
                    o.Endpoint = new Uri("https://ingest.tracelit.app/v1/traces");
                    o.Protocol = OtlpExportProtocol.HttpProtobuf;
                    o.Headers = "Authorization=Bearer <INGEST_KEY>";
                }))
            .WithLogging(l => l.AddOtlpExporter(o =>
            {
                o.Endpoint = new Uri("https://ingest.tracelit.app/v1/logs");
                o.Protocol = OtlpExportProtocol.HttpProtobuf;
                o.Headers = "Authorization=Bearer <INGEST_KEY>";
            }));
        ```

        Full guide: [.NET OpenTelemetry](/otel/dotnet)
      </Tab>

      <Tab title="Ruby">
        ```bash theme={null}
        bundle add opentelemetry-sdk opentelemetry-exporter-otlp opentelemetry-instrumentation-all
        ```

        ```ruby theme={null}
        OpenTelemetry::SDK.configure do |c|
          c.service_name = "payments-api"
          c.resource = OpenTelemetry::SDK::Resources::Resource.create(
            "deployment.environment" => "production" # local | development | production
          )
          c.add_span_processor(
            OpenTelemetry::SDK::Trace::Export::BatchSpanProcessor.new(
              OpenTelemetry::Exporter::OTLP::Exporter.new(
                endpoint: "https://ingest.tracelit.app/v1/traces",
                headers: { "Authorization" => "Bearer <INGEST_KEY>" }
              )
            )
          )
          c.use_all
        end
        ```

        Full guide: [Ruby OpenTelemetry](/otel/ruby)
      </Tab>

      <Tab title="Rust">
        Configure the OTLP HTTP exporter with:

        * endpoint `https://ingest.tracelit.app`
        * protocol `http/protobuf`
        * header `Authorization: Bearer <INGEST_KEY>`
        * resource attrs `service.name` + `deployment.environment` (`local` | `development` | `production`)

        Full guide: [Rust OpenTelemetry](/otel/rust)
      </Tab>
    </Tabs>
  </Tab>

  <Tab title="I'm a vibe coder">
    <img src="https://mintcdn.com/tracelit/Mdr8MXu5ncxQ7PIu/images/vibe.svg?fit=max&auto=format&n=Mdr8MXu5ncxQ7PIu&q=85&s=8776328decd60e2c21d4f9b005a100d1" alt="Install as a vibe coder — paste an OpenTelemetry prompt into your AI" style={{ width: '120px', marginBottom: '12px' }} width="1000" height="1000" data-path="images/vibe.svg" />

    Paste this into your coding agent. Replace the ingest key and language.

    ```text theme={null}
    Point OpenTelemetry at Tracelit for my backend service.

    Language: <node | go | python | java | dotnet | ruby | rust>
    Ingest key: <INGEST_KEY>
    Service name: payments-api
    Environment: production

    Rules:
    1) Use OTLP HTTP (http/protobuf) to https://ingest.tracelit.app — not gRPC.
    2) Set Authorization: Bearer <INGEST_KEY> on exporters.
    3) Set deployment.environment to exactly one of: local, development, production.
    4) Export both traces AND logs (LoggerProvider / log bridge required).
    5) Prefer in-code config over shell OTEL_* env vars.
    6) Keep changes minimal. Show files changed and how to emit one INFO + one ERROR to verify.
    ```

    Prefer the in-app path? Add a service and choose **I'm a vibe coder** — Tracelit generates the language-specific prompt with your key filled in.
  </Tab>
</Tabs>

### Verify (backend)

Emit **one INFO log** and **one ERROR log**, then use **Check connection** in onboarding (or open **Logs** on the service). Continue only when both appear.

***

## What's next?

| Topic                          | Guide                                         |
| ------------------------------ | --------------------------------------------- |
| Frontend install deep-dives    | [Platform → Frontend](/installation/overview) |
| OpenTelemetry language recipes | [Platform → Backend](/otel/overview)          |
| Identify users                 | [Identify users](/tracking/identify-users)    |
| Incidents → AI PR              | [Incidents](/agentic/incidents)               |
| Tracker config reference       | [Configuration](/configuration/reference)     |
