Localess
Node.js

Getting Started

Use Localess without a frontend framework — a type-safe TypeScript client for fetching content, translations, and assets from any Node.js server or script.

Package: @localess/client

The @localess/client package is the core JavaScript/TypeScript SDK for the Localess headless CMS platform. It provides a type-safe API client for fetching content, translations, and assets, along with Visual Editor integration utilities.

⚠️ Security Notice: @localess/client is server-side only, regardless of token type — never import it in a browser bundle, a React Client Component, or any other client-side code, even with a public token. Call localessClient() only from code that's never bundled into the browser (a Node script, a server-only module, a Server Component, an API route), and use a secret token there.

Production apps should generally use a public token (read-only, published content and translations only) for anything that reaches end users, and keep the secret token for build-time/server-only access — but the public-token case is implemented through a framework SDK's own client-side primitives (@localess/react's localessInit, @localess/angular's provideLocaless), never by importing @localess/client directly. If you need browser-safe Localess access, use one of the framework SDKs (@localess/angular, @localess/react, @localess/astro) instead of this package.

Playgrounds: @localess/client underlies every framework integration, so the closest thing to a reference implementation for it is any framework playground — see the Next.js, Angular, or Astro guides, or browse playgrounds/ directly.

Requirements

  • Node.js >= 24.0.0

Installation

# npm
npm install @localess/client@latest

# yarn
yarn add @localess/client@latest

# pnpm
pnpm add @localess/client@latest

Getting Started

Initializing the Client

import { localessClient } from "@localess/client";

const client = localessClient({
  origin: 'https://my-localess.web.app', // Fully qualified domain with protocol
  spaceId: 'YOUR_SPACE_ID',              // Found in Localess Space settings
  token: 'YOUR_API_TOKEN',               // Found in Localess Space settings (keep secret!)
});

Client Options

OptionTypeRequiredDefaultDescription
originstringYesFully qualified domain with protocol (e.g., https://my-localess.web.app)
spaceIdstringYesLocaless Space ID, found in Space settings
tokenstringYesLocaless API token, found in Space settings
version'draft' | stringNo'published'Default content version to fetch
debugbooleanNofalseEnable debug logging
cacheTTLnumber | falseNo300Cache TTL in seconds (5 minutes). Set false to disable caching entirely

AI Coding Agents

This package ships a SKILL.md file that provides AI coding agents (GitHub Copilot, Claude Code, Cursor, and others) with accurate, up-to-date APIs, patterns, and best practices.

Reference it from your project's AGENTS.md:

## Localess

@node_modules/@localess/client/SKILL.md

License

MIT

On this page