Using Edge Config with DevCycle

Learn how to use Edge Config with Vercel's DevCycle integration.
Table of Contents

The DevCycle Edge Config integration is available in Beta on all plans

DevCycle is a feature management platform designed for developers. DevCycle allows you to work with feature flags more naturally, where you write code, so you can deliver better features, faster.

With DevCycle and Vercel Edge Config the decision logic for your features lives with your hosted site, so you can run your feature rollouts or experiments with ultra-low latency.

Before using this integration, you should have:

  1. The latest version of Vercel CLI. To check your version, use vercel --version. To install or update Vercel CLI, use:

    pnpm
    yarn
    npm
    pnpm i -g vercel@latest
  2. A project. If you don't have one, you can run the following terminal commands to create a Next.js project:

    pnpm
    yarn
    npm
    pnpm i next
    terminal
    npx create-next-app@latest
  3. A Vercel project. If you don't have one, see Creating a Project

  4. An Edge Config. If you don't have one, follow the Edge Config quickstart

  5. The Edge Config SDK:

    pnpm
    yarn
    npm
    pnpm i @vercel/edge-config

The following steps will walk you through:

  • Configuring Vercel's DevCycle Edge Config integration.
  • Using the integration to check your feature flags from your frontend code.
  1. Visit the DevCycle page in the Integration Marketplace and select the Add Integration button. From the modal that opens:

    1. Select your Vercel team and project.
    2. Continue and log into DevCycle.
    3. Select the DevCycle Organization and Project you want to use with Vercel Edge Config.
    4. Connect your DevCycle project to an existing or new Edge Config store.
    5. Click Finish Setup.
  2. pnpm
    yarn
    npm

    pnpm i @devcycle/vercel-edge-config @vercel/edge-config

  3. For more information on DevCycle Next.js SDK usage, see the DevCycle docs.

    Next.js (/app)
    Next.js (/pages)
    Node.js
    app/index.tsx
    import { createClient } from '@vercel/edge-config'
    import { EdgeConfigSource} from '@devcycle/vercel-edge-config'
    import { setupDevCycle } from '@devcycle/nextjs-sdk/server'
     
    const edgeClient = createClient(process.env.EDGE_CONFIG)
    const edgeConfigSource =new EdgeConfigSource(edgeClient)
     
    exportconst { getVariableValue, getClientContext } = setupDevCycle({
      serverSDKKey: process.env.DEVCYCLE_SERVER_SDK_KEY ?? '',
      clientSDKKey: process.env.NEXT_PUBLIC_DEVCYCLE_CLIENT_SDK_KEY ?? '',
      userGetter: () => ({user_id: 'test_user'}),
      options: {
    // pass the configSource option with the instance of EdgeConfigSource
        configSource: edgeConfigSource
      }
    })
     
Last updated on September 20, 2024