Better I18NBetter I18N

Introduction

Headless CMS client for Better i18n content

The Better i18n Content SDK (@better-i18n/sdk) is a lightweight TypeScript client for fetching content models and entries from your Better i18n project. It connects to the REST API using an API key and returns fully typed responses.

Why use the SDK?

  • Zero dependencies — Uses native fetch(), works in any JavaScript runtime
  • Type-safe — Full TypeScript types with generic custom fields support
  • Language-aware — Fetch localized content by language code with automatic fallback
  • Pagination — Built-in pagination with total count and hasMore indicator
  • Chainable API — Supabase-style from() query builder with filtering & sorting

Quick Example

import { createClient } from "@better-i18n/sdk";

const client = createClient({
  project: "acme/web-app",
  apiKey: process.env.BETTER_I18N_API_KEY!,
});

// List content models
const models = await client.getModels();

// Get published blog posts
const { data: posts, total } = await client 
  .from("blog-posts") 
  .eq("status", "published") 
  .order("publishedAt", { ascending: false }) 
  .limit(10); 

// Get a single entry in French
const { data: post } = await client 
  .from("blog-posts") 
  .language("fr") 
  .single("hello-world"); 

console.log(post.title, post.body);

Next Steps

For AI-powered content management (create, edit, publish), see the MCP Content Server instead.

On this page