Official npm package

nexoflow-sdk

The official TypeScript SDK for the NexoFlow Content API. npm · License: MIT

What is NexoFlow?

NexoFlow is an AI-powered content automation platform. It lets you generate, schedule, and publish blog posts and social media content from one dashboard. NexoFlow handles AI writing, image generation, and multi-channel publishing (WordPress or any JavaScript framework via the Content API), then delivers your content so you can display it on any website.

nexoflow-sdk gives you a clean, type-safe way to fetch that content from any JavaScript or TypeScript backend-with zero dependencies, full TypeScript support, built-in retries, and support for every environment Node.js runs in.

Why use the SDK?

  • Zero dependencies - nothing extra to audit or break at install time.
  • Full TypeScript - every response is typed; autocomplete works out of the box.
  • Retries & timeouts - transient failures use exponential backoff automatically.
  • Async iterators - paginate through large archives with for await.
  • Framework-agnostic - Next.js, Nuxt, SvelteKit, Astro, Remix, Express, Fastify, Cloudflare Workers, Deno, Bun, and more.
  • ISR-ready - pass revalidate and the SDK sets Next.js-friendly cache headers.

Install

npm install nexoflow-sdk
# or
yarn add nexoflow-sdk
pnpm add nexoflow-sdk

Quick start

quick-start.ts
import { NexoFlow } from "nexoflow-sdk"

const nf = new NexoFlow({ apiKey: process.env.NEXOFLOW_API_KEY! })

// List recent posts
const { data } = await nf.posts.list({ limit: 10 })
console.log(data.posts)       // PostListItem[]
console.log(data.pagination)  // { page, limit, total, hasMore }

// Get a single post by slug
const { data: post } = await nf.posts.get("my-first-post")
console.log(post.title)
console.log(post.content) // full HTML content

// Iterate over ALL posts (auto-paginates)
for await (const post of nf.posts.iter()) {
  console.log(post.title)
}

Continue with configuration, Posts API, and framework examples.

Server-side usage only

Your NexoFlow API key (pk_live_*) is a secret-treat it like a database password.

Do not

  • Import nexoflow-sdk in browser bundles or React client components
  • Hard-code the key in sources that ship to the browser
  • Use the key in <script> tags, Vite client bundles, or browser-only services

Do

  • Store the key in an environment variable (e.g. NEXOFLOW_API_KEY)
  • Call the SDK only from server code (Server Components, API routes, server loaders, etc.)

If the SDK detects a browser (window is defined), it logs a console warning. Execution is not blocked, but the warning indicates a security misconfiguration.

Response format

Every method returns a consistent envelope:

{
  data: T,               // the API response payload
  rateLimit?: {           // extracted from response headers (when available)
    limit?: number,
    remaining?: number,
    reset?: number,
  }
}
example.ts
const { data, rateLimit } = await nf.posts.list({ limit: 5 })

console.log(data.posts)
console.log(data.pagination)
console.log(rateLimit?.remaining)