Community SDK
Browser-safe post reads and nullable detail results.
For a complete task, start with the Community guide. This page covers the public Community SDK; see SDK basics for imports and peers.
Community public reads
Use these browser-safe 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 public CommunityPost fields, and null for a missing, hidden, or other-workspace post. A customer JWT may be sent with the request, but a Secret Key is never needed. Raw client.collections.from('posts') stays server-only.
Authenticated participation
listPosts({ limit }) returns a paginated feed. getPost({ postId }) returns one post, or null only for a missing, hidden, or other-workspace post; other errors propagate. Do not use a Secret Key to get around a customer's denial. The Community guide covers hosted sign-in, createComment({ postId, body }), a separate listComments lookup, and error handling.