Skip to main content

Features Config

On/off switches for every optional module.

File: config/features.config.ts

Toggle features without touching code. When a flag is false:

  • Related UI components hide themselves
  • API routes return 404
  • Cron jobs associated with the feature are skipped

The core platform (submissions, payments, auth, admin) is always active — you can't turn those off.

features.config.ts open in IDE

All flags

FlagDefaultWhat it adds
partnerstruePartner/sponsor slots in the sidebar (monthly subscriptions).
badgestrueEmbeddable "Featured on …" badges for winners.
backlinkstrueDofollow/nofollow toggle on outbound project links.
socialProoftrueLive counters, "X people submitted today" widgets.
newslettertrueEmail newsletter signup (uses Resend).
blogtrue/blog section, SEObot integration for AI articles.
webhooksExternaltrueOutbound webhooks (Discord/Slack) on events.
adBannertrueTop horizontal banner above the header.
bookmarkstrueLogged-in users can save projects.
ratingstrue1–5 star ratings on project pages.
commentstrueComment threads on project pages.
promotionstruePaid ad placements (banner, catalog cards, detail cards).
analyticstrueEnhanced tracking: device, browser, country, per-project events.
aifalseAI-powered description generation & category suggestions.
i18nfalseMulti-language via next-intl.

Where flags are checked

In API routes

import { featureGuard } from '@/lib/features';
 
export async function GET() {
  const guard = featureGuard('partners');
  if (guard) return guard; // 404 response if disabled
 
  // ... normal logic
}

In server components

import { isFeatureEnabled } from '@/lib/features';
 
if (isFeatureEnabled('comments')) {
  // render comments
}

In client components

import { useFeatures } from '@/hooks/use-features';
 
function ProjectPage() {
  const { isEnabled } = useFeatures();
 
  return (
    <>
      <ProjectInfo />
      {isEnabled('ratings') && <StarRating />}
      {isEnabled('comments') && <Comments />}
    </>
  );
}

Common recipes

"Free-only" directory (no payments)

Don't disable promotions — disable payments at the provider level instead. In config/payments.config.ts:

export const paymentsConfig = {
  provider: 'none',  // disables all paid flows
  testMode: false,
};

Launch MVP with minimum features

Set everything except the essentials to false:

export const featuresConfig: FeaturesConfig = {
  partners: false,
  badges: false,
  backlinks: true,       // keep — nice for SEO
  socialProof: false,
  newsletter: true,      // keep — grows your list
  blog: false,
  webhooksExternal: false,
  adBanner: false,
  bookmarks: false,
  ratings: false,
  comments: false,
  promotions: false,
  analytics: true,       // keep — you need usage data
  ai: false,
  i18n: false,
};

Ship, watch what users ask for, turn flags back on one at a time.

Turning on AI features

  1. Set ai: true here
  2. Set AI_PROVIDER, AI_MODEL, AI_API_KEY in .env.local
  3. See AI Config for options

With AI

AI Prompt· Configure features for my MVP

Edit config/features.config.ts for my directory about {your niche}. I'm launching an MVP — enable only the features that are critical for day one and disable the rest to keep the UI focused.

Must-have for me: {list what matters most — e.g. "submissions, pricing, analytics"}. Nice-to-have (disable for now): {list what to defer — e.g. "ratings, comments, promotions"}.

For each flag, briefly tell me why you enabled or disabled it. Preserve the FeaturesConfig type.