Getting started with the TypeScript SDK

How to install, configure, and query your SCHMA content using the official @schmadev/client TypeScript SDK with type-safe models, filtering, and pagination.

Developer Guides & Integrations6 min read·Updated October 2026

Getting started with the TypeScript SDK

How to install, configure, and query your SCHMA content using the official @schmadev/client TypeScript SDK with type-safe models, filtering, and pagination.

Before you begin

  • Node.js 18+ and a TypeScript or JavaScript project
  • A Delivery or Management API key from SCHMA Studio
  • Your workspace slug

The official @schmadev/client package provides a type-safe, lightweight client for interacting with SCHMA's Delivery and Management APIs. It is designed to run seamlessly in Node.js, Next.js (Server Components and Route Handlers), Astro, Remix, and edge runtimes.

Installing the client package

Install the package using your preferred package manager:

Terminal
npm install @schmadev/client

Initializing the SchmaClient

Create a centralized API client instance in your application (e.g., lib/schma.ts). Configure it with your Delivery API key and workspace tenant slug:

lib/schma.ts
import { createClient } from "@schmadev/client";

export const schma = createClient({
  apiKey: process.env.SCHMA_API_KEY!,
  tenantSlug: process.env.SCHMA_TENANT_SLUG!,
  baseUrl: process.env.SCHMA_API_URL || "https://api.schma.dev",
  environment: "production", // optional: "production" | "staging"
});

Fetching a list of entries with filters

Query published content using client.delivery.listEntries. You can filter by content type slug, specify pagination limits and offsets, order by creation or update dates, and search text fields:

app/blog/page.tsx (Next.js Server Component)
import { schma } from "@/lib/schma";

interface BlogPost {
  id: string;
  title: string;
  slug: string;
  excerpt: string;
  publishedAt: string;
}

export default async function BlogIndexPage() {
  const response = await schma.delivery.listEntries<BlogPost>({
    typeSlug: "blog_post",
    limit: 10,
    offset: 0,
    sortBy: "createdAt",
    order: "desc",
  });

  const posts = response.entries;

  return (
    <main className="max-w-4xl mx-auto py-12">
      <h1 className="text-3xl font-bold mb-8">Latest Articles</h1>
      <div className="space-y-6">
        {posts.map((post) => (
          <article key={post.id} className="border-b pb-6">
            <h2 className="text-xl font-semibold">{post.title}</h2>
            <p className="text-zinc-600 mt-2">{post.excerpt}</p>
          </article>
        ))}
      </div>
    </main>
  );
}

Fetching a single entry by ID

To retrieve a specific entry by its unique identifier:

Fetching a Single Entry
const entry = await schma.delivery.getEntry<BlogPost>({
  id: "entry_uuid_123",
  locale: "en-US", // optional locale
});

Using TypeScript generics for schema typing

All SDK retrieval methods accept a TypeScript generic parameter listEntries<T>() or getEntry<T>(). Passing your interface guarantees type safety, autocompletion, and compile-time validation across all your React components and page templates.