Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.replyke.com/llms.txt

Use this file to discover all available pages before exploring further.

Each space has its own membership list. Members can be regular users, moderators, or admins. Spaces can require join approval, and moderators/admins can approve, decline, ban, or unban members.

Joining and Leaving

The simplest membership operations are exposed directly from useSpace:
import { useSpace } from "@replyke/react-js";

function MembershipButton() {
  const { isMember, isPending, joinSpace, leaveSpace } = useSpace();

  if (isPending) return <p>Waiting for approval...</p>;
  if (isMember) return <button onClick={leaveSpace}>Leave</button>;
  return <button onClick={joinSpace}>Join</button>;
}
When a space has requireJoinApproval: true, joinSpace() creates a pending membership that must be approved by a moderator or admin before the user becomes active.

Fetching Members

Use standalone hooks to fetch member lists:
import { useFetchSpaceMembers, useFetchSpaceTeam } from "@replyke/react-js";

// Paginated list of all members
const fetchMembers = useFetchSpaceMembers();
const { data, pagination } = await fetchMembers({ spaceId, page: 1, limit: 20 });
// data: SpaceMemberWithUser[]

// All admins + moderators (no pagination)
const fetchTeam = useFetchSpaceTeam();
const { data } = await fetchTeam({ spaceId });
// data: SpaceMemberWithUser[]

Checking Membership Status

Check the current user’s membership without loading the full space:
import { useCheckMyMembership } from "@replyke/react-js";

const checkMembership = useCheckMyMembership();
const result = await checkMembership({ spaceId });
// result: { isMember, role, status, joinedAt, permissions }

Approving and Declining Requests

Moderators and admins can process pending membership requests:
import { useApproveMember, useDeclineMember } from "@replyke/react-js";

const approve = useApproveMember();
const decline = useDeclineMember();

await approve({ spaceId, memberId });
await decline({ spaceId, memberId });
Both useApproveMember and useDeclineMember require the caller to be a moderator or admin of the space.

Role Management

Admins can change a member’s role:
import { useUpdateMemberRole } from "@replyke/react-js";

const updateRole = useUpdateMemberRole();
await updateRole({ spaceId, memberId, role: "moderator" });
// Valid roles: "admin" | "moderator" | "member"

Banning and Unbanning

Moderators can ban and unban members:
import { useRemoveMember, useUnbanMember } from "@replyke/react-js";

const removeMember = useRemoveMember();
const unban = useUnbanMember();

await removeMember({ spaceId, memberId });
await unban({ spaceId, memberId });
Banning a member sets their status to "banned". Moderators can only ban regular members. Admins can ban moderators and regular members. Only the space creator can ban admins.

Sub-space Cascade

When a child space is created, all admins and moderators of the parent space are automatically added to the child space with their same roles. This ensures governance cascades to sub-communities without manual setup.

Hook Reference

HookDescription
useFetchSpaceMembersPaginated list of space members
useFetchSpaceTeamAll admins and moderators (no pagination)
useCheckMyMembershipCurrent user’s membership status
useApproveMemberApprove a pending join request
useDeclineMemberDecline a pending join request
useUpdateMemberRoleChange a member’s role
useRemoveMemberBan/remove a member
useUnbanMemberUnban a banned member
useJoinSpaceJoin a space
useLeaveSpaceLeave a space