Set up Relia

Two commands in your app. The setup signs you in, asks what to watch, writes one file, and Relia starts learning from the first request. About five minutes.

Before you start

  • A free Relia account. Create one, or create it from the terminal during setup.
  • Node.js 18 or later for JavaScript apps, Python 3 for Python apps.
  • A terminal open in your app's folder.

Node.js APIs

Express, Fastify, NestJS, Koa, Hapi and anything else on Node.

  1. Install and run the setup

    Terminal
    npm install relia-sdk
    npx relia init
  2. Choose what to watch

    Pick Log & API trace monitoring, then your project and a service. The setup writes relia.tracing.js, loads it first in your entry file and, for Express, adds the middleware that records errors with their stack traces.

    relia.tracing.js
    // Generated by relia-sdk. Re-run `npx relia init` to change.
    require('relia-sdk/node').start({
      serviceName: "backend",
      projectId: "your-project-id",
      projectName: "my-app",
      otlpEndpoint: "https://devotel.tryrelia.com/v1/traces",
      key: "relia_live_…",
    });
  3. Restart and check

    Restart your app and hit an endpoint; requests appear under your project. Fastify, BullMQ, NestJS, Koa, Kafka, GraphQL, outgoing HTTP calls and database clients are instrumented with no extra code.

Next.js

The same two commands; the setup knows it is a Next.js app.

  1. Install and run the setup

    Terminal
    npm install relia-sdk
    npx relia init
  2. It writes instrumentation.ts

    In src/ when your app lives there. It starts Relia in the Node.js runtime. An instrumentation file you already have is never overwritten; the setup prints the lines to add instead.

  3. Next.js 13 and 14 only

    Turn on experimental.instrumentationHook in next.config. Next.js 15 and later need nothing more.

Browser sessions

Clicks, inputs, navigation and errors from real visitors.

  1. Run the setup in your web app

    Terminal
    npm install relia-sdk
    npx relia init
  2. Choose Session & User journey monitoring

    The setup finds your entry file, writes src/relia.ts and imports it.

    src/relia.ts
    // Generated by relia-sdk. Re-run `npx relia init` to change.
    import { Relia } from "relia-sdk"
    
    Relia.init({
      endpoint: "https://devreliaapi.tryrelia.com/api/v1",
      project_id: "your-project-id",
      key: "relia_live_…",
      project_name: "my-app",
      service_name: "web",
      captureText: false,
      replay: false,
    })
  3. Private by default

    The text people type or see is not captured unless you set captureText, and screen replay stays off unless you choose it during setup.

Python

FastAPI, Django, Flask, Celery, requests and httpx.

  1. Install and run the setup

    Terminal
    pip install relia-sdk
    python -m relia
  2. Start tracing first

    The setup detects your framework and writes relia_tracing.py. Call init_tracing() at the top of your entry file, before you import your web framework.

  3. Hook in your framework

    main.py
    from relia_tracing import init_tracing, setup_fastapi
    init_tracing()
    
    from fastapi import FastAPI
    app = FastAPI()
    setup_fastapi(app)  # for Flask: setup_flask(app)

AI agents

Each model call is recorded as an agent run, linked to the request it ran in.

Next.js with the Vercel AI SDK

Installing relia-sdk is the whole setup. It patches next.config, and every streamText and generateText call is recorded.

Other Node apps

Run npx relia init and choose Agent monitoring. It writes relia.agent.js; call reportRun(…) from it after each model call.

Already using OpenTelemetry

Relia adds itself to the tracer provider you already run instead of starting a second one. If it can't (Node), it prints the OTLP endpoint and project id to add to your own exporter.

Turning an instrumentation off

List the ones to skip in an environment variable, separated by commas.

.env
RELIA_DISABLE_INSTRUMENTATIONS=fastify,bullmq

What happens next

The parts of your product appear on Relia's Home as they send their first requests, and Relia starts learning what normal looks like for your app from about four weeks of its own traffic.