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/clientyarn
yarn add @trident/clientpnpm
pnpm add @trident/clientConfiguration
Add your Trident API key to your environment variables:
# .env.local
TRIDENT_API_KEY=trident_pk_your_api_key_hereInitialize 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:
| Import | Description |
|---|---|
@trident/client | Core client, types, and error classes |
@trident/client/nextjs | Next.js adapter (sitemap, metadata) |
@trident/client/generic | Framework-agnostic rendering helpers |
@trident/client/components | React 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";