Skip to main content

Public library

LibraryClient from @cstar.help/js/library is the public-side knowledge base. No API key — just teamSlug. Read categories, articles, search; record views and feedback so analytics knows what's working.

Setup

setup.js
import { LibraryClient } from '@cstar.help/js/library';

const library = new LibraryClient({
  teamSlug: 'acme'
  // Optional: scope to test data with publishableKey: 'pk_test_...'
});

Browse

browse.js
const categories = await library.categories();

const articles = await library.articles({
  categorySlug: 'billing',
  limit: 20,
  offset: 0
});

const article = await library.article('reset-password');
console.log(article.title, article.content);
search.js
const results = await library.search('reset password', { limit: 10 });
// results.data    — matching articles with highlighted excerpts
// results.count   — total matches
popular.js
const top5 = await library.popularArticles(5);

const stats = await library.stats();
// → { totalArticles, totalCategories, totalViews }

Record views + feedback

record.js
// Increment the view counter for analytics
await library.recordView('reset-password');

// Helpful / not helpful
await library.submitFeedback('reset-password', {
  helpful: true,
  comment: 'Solved my problem in two minutes!'
});

Reactive wrappers

React and Svelte wrap this client in framework-native primitives (useArticles, ArticlesState, etc.) with built-in loading and error handling.

Next up