Installation

Get started with @trident/client in your project.

Prerequisites

  • Node.js 18 or later
  • A Trident account with an API key
  • React 18 or 19 (for component usage)

Install the package

Install using your preferred package manager:

npm

npm install @trident/client

yarn

yarn add @trident/client

pnpm

pnpm add @trident/client

Configuration

Add your Trident API key to your environment variables:

# .env.local
TRIDENT_API_KEY=trident_pk_your_api_key_here

Initialize the client

Create a client instance to interact with the Trident API:

// lib/trident.ts
import { createTridentClient } from "@trident/client";

export const trident = createTridentClient({
  apiKey: process.env.TRIDENT_API_KEY!,
  // Optional: custom base URL
  // baseUrl: "https://your-trident.vercel.app/api/v1/public",
  // Optional: request timeout (default: 30000ms)
  // timeout: 30000,
});

Package Exports

The package provides three entry points:

ImportDescription
@trident/clientCore client, types, and error classes
@trident/client/nextjsNext.js adapter (sitemap, metadata)
@trident/client/genericFramework-agnostic rendering helpers
@trident/client/componentsReact components for rendering content

TypeScript Support

The package is written in TypeScript and includes full type definitions. All types are exported from the main entry point:

import type {
  Article,
  StructuredContent,
  ContentBlock,
  ArticleSection,
  SEOMetadata,
  SitemapEntry,
} from "@trident/client";