TentoCMS
Sdk

Overview

Documentation hub for the @tentocms/client TypeScript SDK.

Comprehensive documentation for the @tentocms/client TypeScript SDK.

Documentation Structure

Main Documentation

  • Generated API Reference - Canonical, always-in-sync API surface (every class, method, option & type). Generated from the SDK source with TypeDoc and kept fresh by CI — start here for exact signatures and return types.
  • Public Documentation Hub - Top-level index for the REST API reference, admin guides, and framework integration docs.

Framework-Specific Guides

Type Generation Guides

Type generation is a separate package, @tentocms/typegen, documented under Typegen — it generates the interfaces this client consumes.

What's Included

Framework Guides

Nuxt Integration (nuxt.md)

  • Server-side-only setup (server/utils/tento.ts) — deliberately not a universal plugin, since one would run client-side and crash on the private API key
  • Server-side data fetching with useFetch / useAsyncData against thin server/api/cms/* routes
  • Preview mode implementation
  • Reusable composables (useTentoPage, useTentoCollection, useTentoPagePreview)
  • Type-safe content patterns
  • Error handling and SSG configuration
  • Best practices and caching strategies

Next.js Integration (nextjs.md)

  • App Router implementation (recommended)
  • Pages Router implementation (legacy)
  • Static page generation with generateStaticParams
  • Preview mode with Draft Mode API
  • Dynamic routes and collections
  • Time-based and on-demand revalidation
  • TypeScript patterns
  • ISR (Incremental Static Regeneration)
  • Error handling with typed errors

Astro Integration (astro.md)

  • Static site generation
  • Dynamic routes with getStaticPaths
  • Preview mode with on-demand (server) rendering
  • Blog posts with categories and tags
  • Component-based architecture
  • Image optimization with Astro Image
  • Pagination implementation
  • SSR mode configuration
  • Content Collections integration

Preview Mode Documentation

All framework guides include complete preview mode implementation:

Key Concepts Covered

  1. Getting Preview Keys - Admin UI walkthrough
  2. Configuration - Environment variables and client setup
  3. Preview Routes - Dedicated routes for draft content
  4. Security - Secret validation and cookie handling
  5. Visual Indicators - Preview banners and exit buttons
  6. Best Practices - Protecting routes, environment separation

Preview Mode Behavior

  • Pages: Returns draft_content (or published_content fallback)
  • Collections: Returns draft_content (or published_content fallback)
  • Blog Posts: Includes all statuses (draft + published)

Documentation Tests

The @tentocms/client SDK examples (quick start, preview mode, collections/blog/media, error handling, pagination/filtering) are validated by an automated test suite so they compile against the current SDK surface. The framework-integration guides (Nuxt/Next.js/Astro) and typegen guides are verified by hand against the current APIs, not by that suite.

Test File: tests/docs-examples.test.ts (25 tests) — SDK-client examples only

Coverage Includes:

  • ✅ Quick start examples
  • ✅ Preview mode patterns
  • ✅ TypeScript usage
  • ✅ Error handling
  • ✅ Collections API
  • ✅ Blog API
  • ✅ Media transformations
  • ✅ Advanced usage (custom fetch, timeouts, base URL)
  • ✅ Pagination patterns
  • ✅ Filtering examples

Run Tests:

pnpm test docs-examples

Documentation Format

All documentation is written in Markdown format, making it:

  • ✅ Ready for nuxt/content integration
  • ✅ Easy to version control
  • ✅ Simple to read on GitHub
  • ✅ Compatible with static site generators
  • ✅ Searchable and accessible

Contributing to Docs

When updating documentation:

  1. Update Code Examples - Ensure all examples are current
  2. Run Tests - Verify examples compile: pnpm test docs-examples
  3. Update Multiple Locations - Keep framework guides in sync with SDK reference
  4. Add Tests - Add tests for new examples in tests/docs-examples.test.ts
  5. Check Links - Verify all internal links work
  6. Review Formatting - Ensure consistent markdown formatting

Resources

  • Generated API Reference: ./reference/README.md
  • SDK Package: @tentocms/client (published on npm — pnpm add @tentocms/client; see the framework guides)

License

MIT

Copyright © 2026