Skip to content

Design and implement the Governance module (deferred) behind its existing feature flag #337

Description

@Lakes41

Difficulty: Expert
Type: feature

Background
The README already reserves NEXT_PUBLIC_FEATURE_GOVERNANCE (default false everywhere) and lists "Advanced analytics and governance" as intentionally deferred, but no governance UI or data model currently exists in this frontend.

Problem
Communities have no way to propose, discuss, or vote on decisions (role policy changes, resource additions, community rules) through the dashboard, and there's no defined contract for how this frontend would talk to a (currently non-existent, or future guildpass-core) governance backend.

Expected outcome
A feature-flagged Governance module lets members view active proposals, cast votes (weighted by role/tier if applicable), and lets admins create new proposals, backed by a clearly documented API contract this frontend expects from guildpass-core (to be implemented there separately), with a full mock-mode implementation so the module is demoable without a live governance backend.

Suggested implementation

  • Design the proposal/vote data shapes in lib/api/types.ts (or a new governance-specific types module) and document the expected guildpass-core endpoints (e.g., GET /v1/governance/proposals, POST /v1/governance/proposals/:id/vote) in a new docs/governance-contract.md.
  • Implement lib/api/mock.ts support for the full proposal lifecycle (draft → active → closed → resolved) with simulated votes.
  • Build the /governance route (proposal list, proposal detail with voting UI, admin proposal-creation form), gated via <FeatureGate enabled={features.governance} name="Governance"> following the documented pattern.
  • Ensure vote-casting respects the existing SIWE-authenticated admin/member patterns (voting likely requires an authenticated wallet at minimum, even if not full admin SIWE).
  • Add lib/api/live.ts implementations calling the documented (new) endpoints, with clear 503/graceful-degradation behavior if the live backend doesn't yet support them (consistent with the existing integration-gateway pattern).

Acceptance criteria

  • Module fully functions in mock mode (create proposal, vote, see results)
  • API contract for guildpass-core documented clearly enough to be implemented independently
  • Live-mode implementation degrades gracefully (not a hard crash) if the backend doesn't support governance endpoints yet
  • Module is properly hidden/flagged per the existing feature-flag pattern

Likely affected files/directories

  • app/governance/ (new)
  • lib/api/mock.ts, lib/api/live.ts, lib/api/types.ts
  • lib/features.ts
  • docs/governance-contract.md (new)

Metadata

Metadata

Assignees

Labels

GrantFox OSSGrantFox Open Source Sponsorship program tagMaybe RewardedIssue may qualify for a reward upon successful completion per campaign rulesOfficial Campaign | FWC26Official FWC26 campaign issue — eligible for campaign scoring and rewardsexpertExpert difficulty tasks requiring deep expertise and architectural decision-makingfeatureNew feature, enhancement, or functional addition

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions