Difficulty: Advanced
Type: feature
Background
The README already defines a NEXT_PUBLIC_FEATURE_ANALYTICS flag (defaulting to false in every environment, since the module is "not yet built"), and documents the exact process for adding new feature-gated modules via lib/features.ts and <FeatureGate>.
Problem
The Analytics module has a reserved flag and nav slot but no implementation, meaning there's no way to see engagement/membership trends for a community, and no established data-source abstraction for what will eventually need to consume analytics data (from guildpass-core or elsewhere).
Expected outcome
A working Analytics module (behind the existing flag, off by default in prod) renders at least: membership growth over time, role distribution, and gated-resource access attempts (allowed vs. denied), using a pluggable data-source interface so it can start on mock data and later swap to a real analytics backend.
Suggested implementation
- Add the
/analytics route wrapped in <FeatureGate enabled={features.analytics} name="Analytics">, following the documented pattern for adding new flagged modules exactly.
- Define an
AnalyticsDataSource interface (getMembershipTrend(), getRoleDistribution(), getAccessAttempts()) with a mock implementation seeded from existing mock data patterns in lib/api/mock.ts.
- Build the three chart/summary views using a lightweight charting approach consistent with the project's minimal shadcn-style UI primitives.
- Update
.env.example to note the flag's purpose and default, consistent with existing flag documentation style.
Acceptance criteria
Likely affected files/directories
app/analytics/ (new)
lib/features.ts
lib/api/mock.ts
.env.example
Difficulty: Advanced
Type: feature
Background
The README already defines a
NEXT_PUBLIC_FEATURE_ANALYTICSflag (defaulting tofalsein every environment, since the module is "not yet built"), and documents the exact process for adding new feature-gated modules vialib/features.tsand<FeatureGate>.Problem
The Analytics module has a reserved flag and nav slot but no implementation, meaning there's no way to see engagement/membership trends for a community, and no established data-source abstraction for what will eventually need to consume analytics data (from
guildpass-coreor elsewhere).Expected outcome
A working Analytics module (behind the existing flag, off by default in prod) renders at least: membership growth over time, role distribution, and gated-resource access attempts (allowed vs. denied), using a pluggable data-source interface so it can start on mock data and later swap to a real analytics backend.
Suggested implementation
/analyticsroute wrapped in<FeatureGate enabled={features.analytics} name="Analytics">, following the documented pattern for adding new flagged modules exactly.AnalyticsDataSourceinterface (getMembershipTrend(),getRoleDistribution(),getAccessAttempts()) with a mock implementation seeded from existing mock data patterns inlib/api/mock.ts..env.exampleto note the flag's purpose and default, consistent with existing flag documentation style.Acceptance criteria
NEXT_PUBLIC_FEATURE_ANALYTICS, hidden from nav and showing "Feature unavailable" when disabled and visited directlyLikely affected files/directories
app/analytics/(new)lib/features.tslib/api/mock.ts.env.example