01.software Docs

Community SDK

Browser-safe post reads and nullable detail results.

Community SDK

For a complete task, start with the Community guide. This reference keeps the public SDK boundary; use SDK basics for imports and peers.

Community public reads

Use the browser-safe shaped helpers for community list and detail pages:

import { createClient } from '@01.software/sdk'

type Client = ReturnType<typeof createClient>

export async function readFirstPost(client: Client) {
  const page = await client.community.listPosts({ limit: 20 })
  if (page.docs.length === 0) return { kind: 'empty' as const }
  const post = await client.community.getPost({ postId: page.docs[0].id })
  if (!post) return { kind: 'absent' as const }
  return { kind: 'found' as const, post }
}

A publishable key is enough for these reads. getPost() returns the allowlisted CommunityPost DTO and returns null for missing, hidden, or cross-workspace posts. A customer JWT may accompany the request, but a secret key is never needed. Raw client.collections.from('posts') remains server-only.

Authenticated participation

listPosts({ limit }) returns a paginated shaped feed. getPost({ postId }) returns one safe DTO or null only for the defined missing/hidden/cross-workspace outcome; unrelated errors propagate. Do not use a Secret Key to bypass a customer's denial. The Community task covers hosted identity, createComment({ postId, body }), independent listComments readback and error handling.

Next Actions

On this page