Groups Flows

Groups provide a shared space for members to deliberate on constitutions and proposals.

Pages

  • /groups — Lists groups and opens the Create Group dialog.
  • /groups/[id] — Group details, invite code, member list, and proposal activity.

Create Group Flow

  1. Open /groups and click Create Group.
  2. Enter a required name and optional description.
  3. The client sends POST /api/groups with { name, description? }.
  4. On success, the creator is inserted as ADMIN and the UI routes to /groups/[id].

Group Detail Flow

  1. The page loads GET /api/groups/[id].
  2. Response data includes members, constitutions, clauses, proposals, proposal votes, and comments.
  3. The invite code is shown and can be copied from the UI.

Membership Flow

Joining is API-driven using POST /api/groups/[id]/joinwith { inviteCode }.

  • New members are created with role VOTER.
  • If the user is already in the group, the endpoint returns { message: "Already a member" }.

Proposal Deliberation Flow

Proposal cards in /groups/[id] call these endpoints:

  • POST /api/proposals/[id]/vote with { choice, reason? }.
  • POST /api/proposals/[id]/comment with { content, parentId? }.
  • PATCH /api/proposals/[id] with { action: "move-to-voting" } or { action: "ratify" }.

Current Implementation Notes

  • GET /api/groups and GET /api/groups/[id] do not currently enforce authentication.
  • The Create Group Constitution action calls POST /api/constitutions with title/description only; it does not currently send groupId.

Related Pages