Founderflow Logo

Enable or Disable Integrations

Complete guide to managing integrations in your Founderflow Boilerplate. Learn how to enable, disable, and configure various integrations based on your project needs.

Overview

⚙️

Integration Management

The boilerplate includes a flexible integration system that allows you to enable or disable various services based on your project requirements. This helps keep your application lean and focused.

Environment-Based Toggles

Enable/disable integrations via environment variables

Runtime Configuration

Dynamic integration management at runtime

Graceful Degradation

App continues to work when integrations are disabled

Feature Flags

Toggle specific features within integrations

Development Mode

Easy switching between development and production configs

Cost Optimization

Disable unused services to reduce costs

Configuration System

Integration Configuration

Configure which integrations are enabled in your application:

lib/config/integrations.ts
export const integrations = {
// Authentication
clerk: {
enabled: process.env.ENABLE_CLERK === 'true',
required: true
},
// Payments
stripe: {
enabled: process.env.ENABLE_STRIPE === 'true',
required: false
},
lemonsqueezy: {
enabled: process.env.ENABLE_LEMONSQUEEZY === 'true',
required: false
},
// Content Management
sanity: {
enabled: process.env.ENABLE_SANITY === 'true',
required: false
},
// Search
algolia: {
enabled: process.env.ENABLE_ALGOLIA === 'true',
required: false
},
// Email
resend: {
enabled: process.env.ENABLE_RESEND === 'true',
required: false
},
mailchimp: {
enabled: process.env.ENABLE_MAILCHIMP === 'true',
required: false
}
};

Environment Variables

Set these environment variables to enable or disable integrations:

.env.local
# Integration Toggles
ENABLE_CLERK=true
ENABLE_STRIPE=true
ENABLE_LEMONSQUEEZY=false
ENABLE_SANITY=true
ENABLE_ALGOLIA=false
ENABLE_RESEND=true
ENABLE_MAILCHIMP=false
# Set to 'true' to enable, 'false' to disable

Usage Examples

Integration Checker

Create a utility to check if integrations are enabled:

lib/utils/integration-checker.ts
import { integrations } from '@/lib/config/integrations';
export function isIntegrationEnabled(integration: keyof typeof integrations): boolean {
return integrations[integration].enabled;
}
export function getEnabledIntegrations(): string[] {
return Object.entries(integrations)
.filter(([, config]) => config.enabled)
.map(([name]) => name);
}
export function getRequiredIntegrations(): string[] {
return Object.entries(integrations)
.filter(([, config]) => config.required)
.map(([name]) => name);
}

Conditional Integration Usage

Use integrations conditionally in your components and API routes:

components/payments/PaymentButton.tsx
import { isIntegrationEnabled } from '@/lib/utils/integration-checker';
import StripeCheckout from './StripeCheckout';
import LemonSqueezyCheckout from './LemonSqueezyCheckout';
export default function PaymentButton(props: any) {
const stripeEnabled = isIntegrationEnabled('stripe');
const lemonsqueezyEnabled = isIntegrationEnabled('lemonsqueezy');
if (stripeEnabled) {
return <StripeCheckout {...props} />;
}
if (lemonsqueezyEnabled) {
return <LemonSqueezyCheckout {...props} />;
}
return <div>No payment provider configured</div>;
}

Development vs Production

Development Environment

Recommended settings for development:

.env.local
# Development - Enable all for testing
ENABLE_CLERK=true
ENABLE_STRIPE=true
ENABLE_LEMONSQUEEZY=true
ENABLE_SANITY=true
ENABLE_ALGOLIA=true
ENABLE_RESEND=true
ENABLE_MAILCHIMP=true

Production Environment

Recommended settings for production:

.env.production
# Production - Enable only what you need
ENABLE_CLERK=true
ENABLE_STRIPE=true
ENABLE_LEMONSQUEEZY=false
ENABLE_SANITY=true
ENABLE_ALGOLIA=false
ENABLE_RESEND=true
ENABLE_MAILCHIMP=false