Welcome to Nebutra Sailor Docs šŸŽ‰
ChangelogIntroductionLicensing
Help Center (External) ↗

Node.js Quickstart

Call your project's gateway API from an external Node.js service.

There is no hosted Nebutra API and no @nebutra/sdk package. If you need another Node.js service — outside apps/web — to talk to your scaffolded project's gateway, call it over HTTP like any other internal service.

Service-to-service authentication

Internal calls use a short-lived HS256 JWT (x-service-token), signed and verified with @nebutra/auth's signServiceToken / verifyServiceToken, backed by the shared SERVICE_SECRET. This is not an end-user session token — it authenticates a trusted internal caller.

import { signServiceToken } from "@nebutra/auth";

const token = signServiceToken({ service: "my-node-worker" });

const res = await fetch("https://your-gateway-host/api/v1/ai/models", {
  headers: { "x-service-token": token },
});

If your Node service lives outside the monorepo and can't import @nebutra/auth directly, sign an HS256 JWT with the same SERVICE_SECRET and claim shape by hand — the gateway's verifyServiceToken accepts any correctly signed token, not just ones minted by the package.

Calling the gateway as an end user

For requests made on behalf of a signed-in user (not a trusted internal service), forward the Better Auth session cookie or bearer token the same way apps/web does — there is no separate API-key scheme for this.

Related

Gateway API

The REST endpoints your project ships with.

Authentication

Session cookies vs. service-to-service tokens.

How is this guide?

Edit on GitHub

Last updated on

On this page

Service-to-service authentication
Calling the gateway as an end user
Related