@follow-app/client-sdk

中文文档
0.3.98发布于 2026/10/19MITTypeScriptESM + CJS近 30 天下载 4417

TypeScript client SDK for Follow RSS Server API

原始使用文档
文档目录21 节
  1. Why Use the Folo SDK?
  2. Installation
  3. Quick Start
  4. Core Features
  5. 📰 Feed Management
  6. 📖 Reading Experience
  7. 🤖 AI-Powered Features
  8. 📊 Analytics & Insights
  9. Setup & Configuration
  10. For Web Applications
  11. For Node.js Applications
  12. For React Native
  13. Error Handling
  14. Specific Error Codes
  15. Profile Error Codes
  16. Common Use Cases
  17. Building a Personal RSS Reader
  18. Content Curation Tool
  19. AI-Enhanced Reading App
  20. License
  21. Contributing

Folo Client SDK

The official JavaScript/TypeScript client for Folo - the modern RSS reader. This SDK makes it easy to build applications that interact with Folo's RSS management, reading history, and AI-powered features.

Why Use the Folo SDK?

  • Cross-Platform: Works in browsers, Node.js, React Native, and other JavaScript environments
  • Type-Safe: Full TypeScript support with auto-completion and error prevention
  • Production Ready: Used by Folo's official apps with comprehensive error handling

Installation

pnpm add @follow-app/client-sdk

Quick Start

import { FollowClient } from '@follow-app/client-sdk'

// Connect to Folo
const follow = new FollowClient({
  baseURL: 'https://api.follow.is',
  credentials: 'include', // For web apps
})

// Subscribe to an RSS feed
await follow.subscriptions.create({
  url: 'https://example.com/rss',
  category: 'Technology',
})

// Get your latest unread articles
const articles = await follow.entries.list({
  read: false,
  limit: 20,
})

// Mark articles as read
await follow.entries.batch.read({
  entryIds: articles.data.map((entry) => entry.id),
})

Core Features

📰 Feed Management

Subscribe to and manage RSS feeds with ease:

// Subscribe to feeds
await follow.subscriptions.create({
  url: 'https://blog.example.com/rss',
  category: 'Tech Blogs',
})

// Get all your subscriptions
const subscriptions = await follow.subscriptions.get()

// Import OPML files
await follow.subscriptions.import({ opmlContent })

📖 Reading Experience

Track and manage your reading:

// Get unread articles
const unread = await follow.entries.list({
  read: false,
  limit: 50,
})

// Mark articles as read
await follow.entries.batch.read({
  entryIds: ['article-1', 'article-2'],
})

// Save articles to inbox
await follow.entries.inbox.add({
  entryId: 'article-123',
  note: 'Read later',
})

🤖 AI-Powered Features

Enhance your reading with AI:

// Get article summaries
const summary = await follow.ai.summary({
  id: 'article-123',
})

// Chat with AI about your articles
const response = await follow.ai.chat({
  messages: [
    { role: 'user', content: 'What are the key trends in this article?' },
  ],
})

// Get personalized recommendations
const recommendations = await follow.ai.recommendations()

📊 Analytics & Insights

Understand your reading habits:

// Get reading statistics
const stats = await follow.reads.stats()

// Track feed performance
const feedAnalytics = await follow.feeds.analytics({
  feedId: 'feed-123',
})

Setup & Configuration

For Web Applications

import { FollowClient } from '@follow-app/client-sdk'

const follow = new FollowClient({
  baseURL: 'https://api.follow.is',
  credentials: 'include', // For cookie-based authentication
})

For Node.js Applications

import { FollowClient } from '@follow-app/client-sdk'

const follow = new FollowClient({
  baseURL: 'https://api.follow.is',
  headers: {
    Authorization: 'Bearer your-api-token',
  },
})

// Or set the token later
follow.setAuthToken('your-api-token')

For React Native

import { FollowClient } from '@follow-app/client-sdk'

const follow = new FollowClient({
  baseURL: 'https://api.follow.is',
  credentials: 'include',
  headers: {
    'User-Agent': 'YourApp/1.0.0',
  },
})

Error Handling

The SDK provides clear error handling for common scenarios:

import { FollowAPIError, FollowAuthError } from '@follow-app/client-sdk'

try {
  const articles = await follow.entries.list()
} catch (error) {
  if (error instanceof FollowAuthError) {
    // User needs to log in
    console.log('Authentication required')
    redirectToLogin()
  } else if (error instanceof FollowAPIError) {
    // Handle API errors (network, server, etc.)
    console.log(`Error: ${error.message}`)
    showErrorMessage(error.message)
  }
}

error.message is what the server answered, fit to show. What the request asked for is kept apart in error.request for logs and reports: its method, path, query and body, with values that authenticate the user, such as a password, replaced. It never holds the request's headers.

Specific Error Codes

error.serverCode is the code of the server's answer, one of ExceptionCodeMap, also for an authentication error, whose code is AUTH_REQUIRED. An answer that is not the API's, such as a proxy's error page, has none.

import { ExceptionCodeMap, FollowAPIError } from '@follow-app/client-sdk'

try {
  await follow.subscriptions.create({ feedId: '41234567890123456' })
} catch (error) {
  if (error instanceof FollowAPIError && error.serverCode === ExceptionCodeMap.FeedNoFound) {
    console.log('There is no feed with that id')
  }
}

Profile Error Codes

Better Auth's update-user and sign-up/email answer a profile field they refuse with a 400 whose code names the field. Better Auth's client resolves with the error instead of throwing, so read res.error.code:

CodeFieldRefused value
HANDLE_ALREADY_TAKENhandleAnother user has the handle, in any letter case.
HANDLE_INVALIDhandleA character other than A-Z, a-z, 0-9 or _.
HANDLE_INVALID_CHARACTERShandleA space or a character that cannot be seen, such as U+200B.
HANDLE_TOO_LONGhandleMore than 36 characters.
NAME_CANNOT_BE_EMPTYnameA blank name.
NAME_TOO_LONGnameMore than 64 characters.
IMAGE_TOO_LONGimageMore than 256 characters.
BIO_TOO_LONGbioMore than 256 characters.
WEBSITE_TOO_LONGwebsiteMore than 256 characters.

The handle rules apply to a new or changed handle only: a handle saved before them keeps saving while a save sends it back as it is. Surrounding spaces are trimmed, and a blank handle clears it.

Common Use Cases

Building a Personal RSS Reader

// Set up the client
const follow = new FollowClient({
  baseURL: 'https://api.follow.is',
  credentials: 'include',
})

// Subscribe to feeds
await follow.subscriptions.create({
  url: 'https://blog.openai.com/rss/',
  category: 'AI & Technology',
})

// Get latest articles
const latest = await follow.entries.list({
  read: false,
  limit: 20,
})

// Display articles to user, then mark as read
await follow.entries.batch.read({
  entryIds: latest.data.map((article) => article.id),
})

Content Curation Tool

// Import existing OPML subscription list
await follow.subscriptions.import({ opmlContent })

// Get articles from specific categories
const techNews = await follow.entries.list({
  category: 'Technology',
  limit: 100,
  read: false,
})

// Filter by keywords
const aiArticles = techNews.data.filter(
  (article) =>
    article.title.toLowerCase().includes('ai') ||
    article.content.toLowerCase().includes('artificial intelligence'),
)

// Save important articles to inbox
for (const article of aiArticles) {
  await follow.entries.inbox.add({
    entryId: article.id,
    note: 'AI trend research',
  })
}

AI-Enhanced Reading App

// Get user's reading recommendations
const recommendations = await follow.ai.chat({
  messages: [
    {
      role: 'user',
      content: 'What are the most important articles I should read today?',
    },
  ],
})

// Get summary of long articles
const longArticles = await follow.entries.list({
  read: false,
  limit: 10,
})

for (const article of longArticles.data) {
  const summary = await follow.ai.summary({
    id: article.id,
  })

  console.log(`${article.title}\nSummary: ${summary.summary}`)
}

License

MIT License - see LICENSE file for details.

Contributing

We welcome contributions! Please see our contributing guide for details on:

  • Setting up the development environment
  • Running tests and linting
  • Submitting pull requests
  • Code style guidelines

Made with ❤️ by the Folo team

版本与发布记录

@follow-app/client-sdk 共发布 112 个版本,首次发布于 2025/07/21;过去 12 个月发布了 12 个版本。

版本发布日期距今
0.3.98latest2026/10/1928 天前
0.3.972026/10/131 个月前
0.3.962026/09/171 个月前
0.3.952026/04/027 个月前
0.3.942026/04/027 个月前
0.3.932026/04/027 个月前

关于 @follow-app/client-sdk 的常见问题

@follow-app/client-sdk 是什么?

TypeScript client SDK for Follow RSS Server API

如何安装 @follow-app/client-sdk?

在项目目录运行 npm install @follow-app/client-sdk,或使用 pnpm add / yarn add / bun add。

@follow-app/client-sdk 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@follow-app/client-sdk 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@follow-app/client-sdk 可以商用吗?

@follow-app/client-sdk 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@follow-app/client-sdk 的下载量有多少?

根据 npm 官方下载统计,@follow-app/client-sdk 在 2026/10/15 – 2026/11/13 这 30 天内被下载 4,417 次,日均约 147 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@follow-app/client-sdk 还在维护吗?

最新版本 0.3.98 发布于 2026/10/19(28 天前);至今共发布 112 个版本,其中过去 12 个月发布了 12 个;首次发布于 2025/07/21。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。