Shipkit
DocsFeaturesPricing
DocsFeaturesPricing

Shipkit DocumentationBuild memory optimizationDevelopment GuideEnvironment VariablesError HandlingFile StructureMiddlewareRebranding Guide

Vercel Deployment Checks

Development GuideCLIDependency UpdatesDevToolsFeature FlagsAI PromptsSetup RequirementsSupply chaintRPCWeb Workers

FeaturesAIAnalytics IntegrationAuthenticationCMSDatabaseEmailHapticsPaymentsComponent RegistryStorageUIVisual BuilderWaitlist Feature

Quick StartDeploymentEnvironment VariablesFile StructureSetup Wizard

Caching & Rate LimitingContent ManagementError HandlingMarkdown and MDXMiddlewareProxy-Safe Server ActionsRebranding GuideWebhook Security Implementation GuideMulti-Zone ArchitectureVercel Deployment

IntegrationsPayload CMSDataFast Analytics IntegrationGoogle Analytics IntegrationGoogle Tag Manager IntegrationPostHogStatSig IntegrationUmami Analytics IntegrationAuth.js IntegrationBetter AuthClerkStack Auth IntegrationSupabase Authentication IntegrationBuilder.io IntegrationPayload CMS IntegrationAWS S3 IntegrationResend Email IntegrationUpstash Redis IntegrationVercel Blob IntegrationLemon SqueezyPolarStripe

API RoutesComponentsAPI Route SnippetsAuthentication SnippetsComponent SnippetsForm Handling SnippetsSnippets Introduction

    Feature Flags

    Shipkit detects which features are available at build time by checking environment variables. No manual flag configuration needed — set the env vars for a feature and it turns on.

    How It Works

    src/config/features-config.ts runs during build. It:

    1. Checks which env vars are present
    2. Sets buildTimeFeatures.FEATURE_NAME = true/false
    3. Generates NEXT_PUBLIC_FEATURE_* flags for client-side checks
    4. Only enabled flags are injected (disabled = undefined, not false)

    Usage

    Client-side

    import { env } from "@/env";
    
    if (env.NEXT_PUBLIC_FEATURE_STRIPE_ENABLED) {
      // only runs when Stripe env vars are set
    }
    

    Build-time (Next.js config, plugins)

    import { buildTimeFeatures } from "@/config/features-config";
    
    if (buildTimeFeatures.PAYLOAD_ENABLED) {
      // configure Payload plugin
    }
    

    Env Var Mirroring

    Shipkit auto-mirrors server-side public keys to NEXT_PUBLIC_ variants at build time. You can set:

    STRIPE_PUBLISHABLE_KEY=pk_test_...
    

    And NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY will be generated automatically. Only whitelisted keys are mirrored (see PUBLIC_ENV_BASE_KEYS in features-config.ts).

    Mirrored keys: BUILDER_API_KEY, CLERK_PUBLISHABLE_KEY, SUPABASE_URL, SUPABASE_ANON_KEY, STRIPE_PUBLISHABLE_KEY, POSTHOG_KEY, UMAMI_WEBSITE_ID, DATAFAST_WEBSITE_ID, DATAFAST_DOMAIN, STATSIG_CLIENT_KEY, GOOGLE_ANALYTICS_ID, GOOGLE_GTM_ID, C15T_URL, VERCEL_INTEGRATION_SLUG.

    APP_SECRET Derivation

    If APP_SECRET is set, secrets like PAYLOAD_SECRET and BETTER_AUTH_SECRET are treated as satisfied — they derive from the master secret. One env var, multiple features.

    Complete Flag Reference

    Core

    FlagEnabled whenDisable with
    DATABASE_ENABLEDDATABASE_URL set—
    PAYLOAD_ENABLEDDatabase + PAYLOAD_SECRET (or APP_SECRET)DISABLE_PAYLOAD=true
    BUILDER_ENABLEDNEXT_PUBLIC_BUILDER_API_KEY setDISABLE_BUILDER=true
    MDX_ENABLEDAlways (default on)DISABLE_MDX=true
    PWA_ENABLEDAlways (default on)DISABLE_PWA=true
    DEVTOOLS_ENABLEDENABLE_DEVTOOLS=true—

    Authentication

    FlagEnabled whenDisable with
    AUTH_JS_ENABLEDAny Auth.js provider enabled—
    BETTER_AUTH_ENABLEDBETTER_AUTH_SECRET (or APP_SECRET)DISABLE_BETTER_AUTH=true
    AUTH_CLERK_ENABLEDCLERK_PUBLISHABLE_KEY + CLERK_SECRET_KEYDISABLE_AUTH_CLERK=true
    AUTH_STACK_ENABLEDSTACK_PROJECT_ID + STACK_PUBLISHABLE_CLIENT_KEY + STACK_SECRET_SERVER_KEYDISABLE_AUTH_STACK=true
    SUPABASE_AUTH_ENABLEDSUPABASE_URL + SUPABASE_ANON_KEYDISABLE_SUPABASE_AUTH=true
    AUTH_GUEST_ENABLEDENABLE_AUTH_GUEST=true—
    AUTH_CREDENTIALS_ENABLEDPayload enabledDISABLE_AUTH_CREDENTIALS=true
    AUTH_RESEND_ENABLEDRESEND_API_KEY (dev only)DISABLE_AUTH_RESEND=true
    AUTH_GITHUB_ENABLEDAUTH_GITHUB_ID + AUTH_GITHUB_SECRETDISABLE_AUTH_GITHUB=true
    AUTH_GOOGLE_ENABLEDAUTH_GOOGLE_ID + AUTH_GOOGLE_SECRETDISABLE_AUTH_GOOGLE=true
    AUTH_DISCORD_ENABLEDAUTH_DISCORD_ID + AUTH_DISCORD_SECRETDISABLE_AUTH_DISCORD=true
    AUTH_TWITTER_ENABLEDAUTH_TWITTER_ID + AUTH_TWITTER_SECRETDISABLE_AUTH_TWITTER=true
    AUTH_GITLAB_ENABLEDAUTH_GITLAB_ID + AUTH_GITLAB_SECRETDISABLE_AUTH_GITLAB=true
    AUTH_BITBUCKET_ENABLEDAUTH_BITBUCKET_ID + AUTH_BITBUCKET_SECRETDISABLE_AUTH_BITBUCKET=true
    AUTH_VERCEL_ENABLEDVERCEL_CLIENT_ID + VERCEL_CLIENT_SECRETDISABLE_AUTH_VERCEL=true
    AUTH_ENABLEDAny auth provider enabled—

    Payments

    FlagEnabled whenDisable with
    LEMONSQUEEZY_ENABLEDLEMONSQUEEZY_API_KEY + LEMONSQUEEZY_STORE_IDDISABLE_LEMONSQUEEZY=true
    STRIPE_ENABLEDSTRIPE_SECRET_KEY + STRIPE_PUBLISHABLE_KEYDISABLE_STRIPE=true
    POLAR_ENABLEDPOLAR_ACCESS_TOKENDISABLE_POLAR=true

    Storage

    FlagEnabled whenDisable with
    S3_ENABLEDAWS_REGION + AWS_ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY + AWS_BUCKET_NAMEDISABLE_S3=true
    VERCEL_BLOB_ENABLEDVERCEL_BLOB_READ_WRITE_TOKENDISABLE_VERCEL_BLOB=true
    FILE_UPLOAD_ENABLEDS3 or Vercel Blob enabled—

    Analytics

    FlagEnabled whenDisable with
    POSTHOG_ENABLEDPOSTHOG_KEYDISABLE_POSTHOG=true
    UMAMI_ENABLEDUMAMI_WEBSITE_IDDISABLE_UMAMI=true
    DATAFAST_ENABLEDDATAFAST_WEBSITE_IDDISABLE_DATAFAST=true
    STATSIG_ENABLEDSTATSIG_CLIENT_KEYDISABLE_STATSIG=true
    GOOGLE_ANALYTICS_ENABLEDGOOGLE_ANALYTICS_IDDISABLE_GOOGLE_ANALYTICS=true
    GOOGLE_TAG_MANAGER_ENABLEDGOOGLE_GTM_IDDISABLE_GOOGLE_TAG_MANAGER=true

    Infrastructure

    FlagEnabled whenDisable with
    REDIS_ENABLEDUPSTASH_REDIS_REST_URL + UPSTASH_REDIS_REST_TOKENDISABLE_REDIS=true
    VERCEL_INTEGRATION_ENABLEDVERCEL_INTEGRATION_SLUG + VERCEL_CLIENT_ID + VERCEL_CLIENT_SECRETDISABLE_VERCEL_INTEGRATION=true

    AI / External Services

    FlagEnabled whenDisable with
    OPENAI_ENABLEDOPENAI_API_KEYDISABLE_OPENAI=true
    ANTHROPIC_ENABLEDANTHROPIC_API_KEYDISABLE_ANTHROPIC=true
    GITHUB_API_ENABLEDGITHUB_ACCESS_TOKENDISABLE_GITHUB_API=true

    Other

    FlagEnabled whenDisable with
    LIGHT_MODE_ENABLEDAlways (default on)DISABLE_LIGHT_MODE=true
    DARK_MODE_ENABLEDAlways (default on)DISABLE_DARK_MODE=true
    C15T_ENABLEDC15T_URLDISABLE_C15T=true
    CONSENT_MANAGER_ENABLEDC15T or ENABLE_CONSENT_MANAGER=trueDISABLE_CONSENT_MANAGER=true
    TURNSTILE_ENABLEDTURNSTILE_SITE_KEY + TURNSTILE_SECRET_KEY—

    Adding a New Feature Flag

    1. Add detection in src/config/features-config.ts:
    buildTimeFeatures.MY_FEATURE_ENABLED = hasEnv("MY_API_KEY") && !envIsTrue("DISABLE_MY_FEATURE");
    
    1. Add the env var to src/env.ts for type safety.
    2. Use env.NEXT_PUBLIC_FEATURE_MY_FEATURE_ENABLED client-side or buildTimeFeatures.MY_FEATURE_ENABLED at build time.

    Key Files

    FilePurpose
    src/config/features-config.tsFeature detection + flag generation
    src/env.tsT3 Env schema (runtime validation)