### Create a New React App Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/quickstart.md Use these commands to create a new React application and start the development server. Ensure you have Node.js and npm installed. ```bash npx create-react-app my-app cd my-app npm start ``` -------------------------------- ### SDK Installation Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/cli-mcp/mcp-reference.md Command to fetch DevCycle SDK installation instructions for various platforms. ```APIDOC ## install_devcycle_sdk ### Description Fetch DevCycle SDK installation instructions and follow the guide to install the SDK. Includes documentation and examples for using the SDK in your application. ### Parameters #### Path Parameters - **guide** (string) - Required - One of `android`, `android-openfeature`, `angular`, `dotnet`, `dotnet-openfeature`, `flutter`, `go`, `go-openfeature`, `ios`, `ios-openfeature`, `java`, `java-openfeature`, `javascript`, `javascript-openfeature`, `nestjs`, `nestjs-openfeature`, `nextjs`, `nodejs`, `nodejs-openfeature`, `php`, `php-openfeature`, `python`, `python-openfeature`, `react`, `react-native`, `react-openfeature`, `roku`, `ruby`, `ruby-openfeature` ``` -------------------------------- ### Install OpenFeature Web Provider with Yarn Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/sdk/client-side-sdks/javascript/javascript-openfeature.md Install the OpenFeature Web SDK and DevCycle Web Provider using Yarn. Ensure peer dependencies are also installed. ```bash yarn add @openfeature/web-sdk @openfeature/core @devcycle/openfeature-web-provider ``` -------------------------------- ### Install SDK Dependencies with npx Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/sdk/client-side-sdks/react-native/react-native-expo-install.md Install the required SDK dependencies using npx. ```bash npx expo install @react-native-async-storage/async-storage react-native-get-random-values react-native-device-info react-native-sse ``` -------------------------------- ### Install Go Server SDK Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/sdk/server-side-sdks/go/go-install.md Use this command to install the DevCycle Go Server SDK. Ensure you are using the latest version. ```bash go get "github.com/devcyclehq/go-server-sdk/v2" ``` -------------------------------- ### Get SDK Keys Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/cli-guides/keys.md Retrieve your SDK keys after installing and authorizing the CLI. Ensure your organization and project are selected. ```bash dvc keys get ``` -------------------------------- ### Start the SDK Proxy Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/sdk/sdk-proxy/usage.md Run the proxy binary to start the local bucketing proxy. Ensure the DVC_LB_PROXY_SDK_KEY environment variable is set. ```bash devcycle-local-bucketing-proxy ``` -------------------------------- ### Install and Run PHP Tests Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/sdk/server-side-sdks/php/php-usage.md Instructions for installing project dependencies and running unit tests using Composer and PHPUnit. ```bash composer install vendor/bin/phpunit ``` -------------------------------- ### Install RPM Package Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/sdk/sdk-proxy/installation.md Use this command to install the proxy on RPM-based systems. ```bash sudo rpm -i devcycle-local-bucketing-proxy_*.rpm ``` -------------------------------- ### Complete App.jsx Example Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/sdk/client-side-sdks/react-native/react-native-expo-install.md A full example of an App.jsx file demonstrating the integration of DevCycle SDK with necessary imports and HOC wrapping. ```jsx import React from 'react' import { View, Text } from 'react-native' import 'react-native-get-random-values' import DeviceInfo from 'react-native-device-info' import '@react-native-async-storage/async-storage' import { withDevCycleProvider } from '@devcycle/react-native-expo-client-sdk' global.DeviceInfo = DeviceInfo function App() { return ( My React App ) } export default withDevCycleProvider({ sdkKey: '' })( App, ) ``` -------------------------------- ### Install OpenFeature Angular SDK with npm Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/sdk/client-side-sdks/angular/angular-install.md Use this command to install the OpenFeature Angular SDK and the DevCycle provider using npm. ```bash npm install --save @openfeature/angular-sdk @devcycle/openfeature-angular-provider ``` -------------------------------- ### Install Debian Package Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/sdk/sdk-proxy/installation.md Use this command to install the proxy on Debian-based systems. It installs the package and then resolves any missing dependencies. ```bash sudo dpkg -i devcycle-local-bucketing-proxy_*.deb sudo apt-get install -f ``` -------------------------------- ### Install DevCycle Ruby SDK Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/sdk/server-side-sdks/ruby/ruby-openfeature.md Install the DevCycle Ruby SDK using either the gem command or bundler. ```shell gem install devcycle-ruby-server-sdk ``` ```shell bundler add devcycle-ruby-server-sdk ``` -------------------------------- ### Install OpenFeature Angular SDK with yarn Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/sdk/client-side-sdks/angular/angular-install.md Use this command to install the OpenFeature Angular SDK and the DevCycle provider using yarn. Manual installation of peer dependencies is required. ```bash yarn add @openfeature/angular-sdk @openfeature/web-sdk @openfeature/core @devcycle/openfeature-angular-provider ``` -------------------------------- ### Install SDK Dependencies with yarn Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/sdk/client-side-sdks/react-native/react-native-expo-install.md Install the required SDK dependencies using yarn. ```bash yarn expo install @react-native-async-storage/async-storage react-native-get-random-values react-native-device-info react-native-sse ``` -------------------------------- ### Install DevCycle Ruby Server SDK Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/sdk/server-side-sdks/ruby/ruby-install.md Use this command to install the DevCycle Ruby Server SDK gem. ```ruby gem install devcycle-ruby-server-sdk ``` -------------------------------- ### Install Dependencies with Yarn Source: https://github.com/devcyclehq/devcycle-docs/blob/main/README.md Run this command to install project dependencies using Yarn. Ensure Yarn is installed globally. ```bash yarn ``` -------------------------------- ### Install DevCycle Local Bucketing SDK Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/sdk/server-side-sdks/dotnet/dotnet-install.md Use this command to install the DevCycle SDK for local bucketing. This package is for scenarios where bucketing logic runs on the client. ```bash dotnet add package DevCycle.SDK.Server.Local ``` -------------------------------- ### Install JS SDK using NPM Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/sdk/client-side-sdks/javascript/javascript-install.md Install the JS SDK using NPM. This is the recommended method for bundling with your Javascript or Typescript application. ```bash npm install --save @devcycle/js-client-sdk ``` -------------------------------- ### Install Node.js SDK with npm Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/sdk/server-side-sdks/node/node-install.md Use this command to install the DevCycle Node.js SDK via npm. This is the standard package manager for Node.js. ```bash npm install --save @devcycle/nodejs-server-sdk ``` -------------------------------- ### Install NestJS OpenFeature Provider Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/sdk/server-side-sdks/nestjs/nestjs-openfeature.md Install the DevCycle NodeJS Server SDK and the OpenFeature NestJS SDK using npm or yarn. ```bash npm install --save @devcycle/openfeature-nestjs-provider @openfeature/nestjs-sdk ``` ```bash yarn add @devcycle/openfeature-nestjs-provider @openfeature/nestjs-sdk ``` -------------------------------- ### Install React SDK with npm Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/sdk/client-side-sdks/react/react-install.md Use this command to install the DevCycle React SDK using npm. This is the standard package manager for Node.js. ```bash npm install --save @devcycle/react-client-sdk ``` -------------------------------- ### Complete React Native App Example Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/sdk/client-side-sdks/react-native/react-native-install.md A full example of an App.jsx file demonstrating the integration of the DevCycle SDK, including necessary imports and wrapping the application with the provider. ```jsx import React from 'react' import { View, Text } from 'react-native' import 'react-native-get-random-values' import DeviceInfo from 'react-native-device-info' import '@react-native-async-storage/async-storage' import { withDevCycleProvider } from '@devcycle/react-native-client-sdk' global.DeviceInfo = DeviceInfo function App() { return ( My React App ) } export default withDevCycleProvider({ sdkKey: '' })( App, ) ``` -------------------------------- ### Install DevCycle Python SDK with PIP Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/sdk/server-side-sdks/python/python-install.md Use this command to install the SDK. You may need root permissions. Ensure you are using Python 3.8 or higher. ```shell pip install devcycle-python-server-sdk ``` -------------------------------- ### Before Obfuscation Example Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/platform/security-and-guardrails/feature-obfuscation.md This example shows how DevCycle variables are typically used with plain string keys before implementing obfuscation. ```jsx import { useVariableValue } from '@devcycle/react-client-sdk' function MyComponent() { const myFirstVariable = useVariableValue('my-first-variable', false) const mySecondVariable = useVariableValue('my-second-variable', false) return
{myFirstVariable} {mySecondVariable}
} ``` -------------------------------- ### Install SDK Dependencies with npm Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/sdk/client-side-sdks/react-native/react-native-install.md Install the necessary SDK dependencies using npm. These are required for caching, unique ID generation, device information, and real-time updates. ```bash npm install --save @react-native-async-storage/async-storage react-native-get-random-values react-native-device-info react-native-sse ``` -------------------------------- ### Install DevCycle Cloud Bucketing SDK Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/sdk/server-side-sdks/dotnet/dotnet-install.md Use this command to install the DevCycle SDK for cloud bucketing. This package is for scenarios where bucketing logic is handled by the DevCycle platform. ```bash dotnet add package DevCycle.SDK.Server.Cloud ``` -------------------------------- ### Install React Native SDK with npm Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/sdk/client-side-sdks/react-native/react-native-install.md Use this command to install the main React Native SDK package using npm. ```bash npm install --save @devcycle/react-native-client-sdk ``` -------------------------------- ### Install OpenFeature Web Provider with NPM Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/sdk/client-side-sdks/javascript/javascript-openfeature.md Install the OpenFeature Web SDK and the DevCycle Web Provider using NPM. This is the first step to integrating OpenFeature with DevCycle. ```bash npm install --save @devcycle/openfeature-web-provider ``` -------------------------------- ### Install Node.js SDK with Yarn Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/sdk/server-side-sdks/node/node-install.md Use this command to install the DevCycle Node.js SDK via Yarn. Yarn is an alternative package manager for Node.js. ```bash yarn add @devcycle/nodejs-server-sdk ``` -------------------------------- ### Install React SDK with yarn Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/sdk/client-side-sdks/react/react-install.md Use this command to install the DevCycle React SDK using yarn. Yarn is an alternative package manager for Node.js. ```bash yarn add @devcycle/react-client-sdk ``` -------------------------------- ### Install DevCycle CLI Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/cli-mcp/index.md Install the DevCycle CLI globally using npm. This command is the first step to using the CLI for feature flag management. ```bash npm install -g @devcycle/cli ``` -------------------------------- ### Install OpenFeature React SDK and DevCycle Provider Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/sdk/client-side-sdks/react/react-openfeature.md Install the necessary packages for the OpenFeature React SDK and the DevCycle Web Provider using NPM or Yarn. If using Yarn, additional peer dependencies are required. ```bash npm install @openfeature/react-sdk @devcycle/openfeature-react-provider ``` ```bash yarn add @openfeature/react-sdk @devcycle/openfeature-react-provider @openfeature/web-sdk @openfeature/core ``` -------------------------------- ### Run Local Development Server Source: https://github.com/devcyclehq/devcycle-docs/blob/main/README.md Start a local instance of the documentation site. Changes will automatically compile and update the browser. ```bash yarn dev ``` -------------------------------- ### Get Variable Value in Server Component Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/sdk/client-side-sdks/nextjs/nextjs-usage-app.md Retrieve a feature flag variable's value within a Next.js server component using the `getVariableValue` function imported from your DevCycle setup file. This function is asynchronous. ```jsx import { getVariableValue } from './devcycle' import * as React from 'react' export const MyServerComponent = async function () { const myVariable = await getVariableValue('myVariable', false) return myVariable ? : } ``` -------------------------------- ### Setup DevCycle with Vercel Edge Config (Next.js Pages Router) Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/integrations/vercel-edge-config.md Integrate DevCycle with Vercel Edge Config for Next.js applications using the Pages Router. This example shows how to use `getServerSideDevCycle` to fetch configurations server-side. ```typescript import { createClient } from '@vercel/edge-config' import { EdgeConfigSource} from '@devcycle/vercel-edge-config' import { getServerSideDevCycle } from '@devcycle/nextjs-sdk/pages' const edgeClient = createClient(process.env.EDGE_CONFIG) const edgeConfigSource = new EdgeConfigSource(edgeClient) export const getServerSideProps: GetServerSideProps = async (context) => { const user = { user_id: 'server-user', } return { props: { ...(await getServerSideDevCycle({ serverSDKKey: process.env.DEVCYCLE_SERVER_SDK_KEY || '', clientSDKKey: process.env.NEXT_PUBLIC_DEVCYCLE_CLIENT_SDK_KEY || '', user, context, options: { // pass the configSource option with the instance of EdgeConfigSource configSource: edgeConfigSource } })), }, } } ``` -------------------------------- ### DevCycle SDK Initialization Options Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/sdk/server-side-sdks/python/python-gettingstarted.md Demonstrates setting up initialization options for the DevCycleLocalClient. Ensure the DEVCYCLE_SERVER_SDK_KEY environment variable is set. ```python from devcycle_python_sdk import DevCycleLocalClient, DevCycleLocalOptions from devcycle_python_sdk.models.user import DevCycleUser import os # Create an options object to do custom configurations, or use the defaults options = DevCycleLocalOptions() # create an instance of the DevCycleLocalClient class devcycle_client = DevCycleLocalClient(os.environ["DEVCYCLE_SERVER_SDK_KEY"], options) ``` -------------------------------- ### Setup DevCycle with Vercel Edge Config (Next.js App Router) Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/integrations/vercel-edge-config.md Configure DevCycle for Next.js applications using the App Router, fetching configurations from Vercel Edge Config. This sets up functions to get variable values and client contexts. ```typescript 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) export const { 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 } }) ``` -------------------------------- ### DevCycle Client Initialization with Options Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/sdk/server-side-sdks/php/php-gettingstarted.md This snippet shows how to create a DevCycle client instance, passing initialization options. The SDK key must be provided, and the DEVCYCLE_SERVER_SDK_KEY environment variable should be configured. ```php $options = new DevCycleOptions(); $devCycleClient = new DevCycleClient( sdkKey: getenv("DEVCYCLE_SERVER_SDK_KEY"), dvcOptions: ($options); $user_data = new DevCycleUser(array( "user_id"=>"my-user" )); ``` -------------------------------- ### Install Yarn on macOS Source: https://github.com/devcyclehq/devcycle-docs/blob/main/README.md If Yarn is not installed, use Homebrew to install it on macOS. ```bash brew install yarn ``` -------------------------------- ### Initialize Local Bucketing SDK Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/sdk/server-side-sdks/python/python-gettingstarted.md Import and set up the DevCycleLocalClient. Ensure you have the DEVCYCLE_SERVER_SDK_KEY environment variable set. User data must be an instance of DevCycleUser. ```python from devcycle_python_sdk import DevCycleLocalClient, DevCycleLocalOptions from devcycle_python_sdk.models.user import DevCycleUser import os # Create an options object to do custom configurations, or use the defaults options = DevCycleLocalOptions() # create an instance of the DevCycleLocalClient class devcycle_client = DevCycleLocalClient(os.environ["DEVCYCLE_SERVER_SDK_KEY"], options) # all client functions require user data to be an instance of the DevCycleUser class user = DevCycleUser( user_id='test', email='example@example.ca', country='CA' ) ``` -------------------------------- ### Install DevCycle SDK with CocoaPods Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/sdk/client-side-sdks/ios/ios-install.md Integrate the DevCycle SDK into your iOS project by adding the 'DevCycle' pod to your Podfile. Run 'pod install' to complete the installation. ```ruby pod 'DevCycle' ``` -------------------------------- ### Build and Run DevCycle CLI from Source Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/cli-mcp/mcp-reference.md Steps to clone the DevCycle CLI repository, install dependencies, build the project, and run the local MCP server from source. ```bash # Clone the repository git clone https://github.com/DevCycleHQ/cli.git cd cli # Install dependencies yarn install # Build the project yarn build # Run the MCP server node dist/mcp/index.js ``` -------------------------------- ### Initialize DevCycle Client (Local Bucketing) Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/sdk/server-side-sdks/go/go-gettingstarted.md Initialize the DevCycle client with local bucketing enabled. Ensure the DEVCYCLE_SERVER_SDK_KEY environment variable is set. Local bucketing is the default mode. ```go package main import ( "log" "os" devcycle "github.com/devcycle/go-server-sdk/v2" ) func main() { sdkKey := os.Getenv("DEVCYCLE_SERVER_SDK_KEY") options := devcycle.Options{ EnableCloudBucketing: false, } devcycleClient, err := devcycle.NewClient(sdkKey, &options) if err != nil { log.Fatalf("Error initializing DevCycle client: %v", err) } } ``` -------------------------------- ### Example Feature Variations Output Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/cli-guides/variations.md Example JSON output when retrieving variations for a feature. ```json [ { "_id": "abcdefg1234567", "key": "variation-on", "name": "Variation On", "variables": { "variable-a": 1 } }, { "_id": "gfedcba7654321", "key": "variation-off", "name": "Variation Off", "variables": { "variable-a": 0 } } ] ``` -------------------------------- ### Initialize DevCycle SDK (Non-Blocking) Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/sdk/client-side-sdks/react-native/react-native-gettingstarted.md Wrap your root `App` component with `withDevCycleProvider` to initialize the SDK in the background. Replace '' with your actual SDK key. ```javascript export default withDevCycleProvider({ sdkKey: '' })(App) ``` -------------------------------- ### Install Pods Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/sdk/client-side-sdks/react-native/react-native-expo-install.md Run this command to install native dependencies for React Native Expo functionality. ```bash npx pod-install ``` -------------------------------- ### Initialize DevCycle SDK and Set OpenFeature Provider Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/sdk/server-side-sdks/go/go-openfeature.md Initialize the DevCycle client with your SDK key and options, then set it as the OpenFeature provider. This setup is required before evaluating any feature flags. ```go package main import ( "log" "os" "time" "context" devcycle "github.com/devcyclehq/go-server-sdk/v2" "github.com/open-feature/go-sdk/pkg/openfeature" ) func main() { sdkKey := os.Getenv("DEVCYCLE_SERVER_SDK_KEY") options := devcycle.Options{ EnableEdgeDB: false, EnableCloudBucketing: false, EventFlushIntervalMS: 30 * time.Second, ConfigPollingIntervalMS: 1 * time.Minute, RequestTimeout: 30 * time.Second, DisableAutomaticEventLogging: false, DisableCustomEventLogging: false, } devcycleClient, err := devcycle.NewClient(sdkKey, &options) if err != nil { log.Fatalf("Error initializing DevCycle client: %v", err) } if err := openfeature.SetProvider(devcycleClient.OpenFeatureProvider()); err != nil { log.Fatalf("Failed to set DevCycle provider: %v", err) } client := openfeature.NewClient("devcycle") } ``` -------------------------------- ### Initialize DevCycle SDK and OpenFeature Provider Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/sdk/server-side-sdks/python/python-openfeature.md Initialize the DevCycle SDK with your server key and options, then set it as the OpenFeature provider. Retrieve the OpenFeature client for flag evaluations. ```python from devcycle_python_sdk import DevCycleLocalClient, DevCycleLocalOptions from devcycle_python_sdk.models.user import DevCycleUser from openfeature import api from openfeature.evaluation_context import EvaluationContext import os # Create an options object to do custom configurations, or use the defaults options = DevCycleLocalOptions() # create an instance of the DevCycleLocalClient class devcycle_client = DevCycleLocalClient(os.environ["DEVCYCLE_SERVER_SDK_KEY"], options) # set the provider for OpenFeature api.set_provider(devcycle_client.get_openfeature_provider()) # get the OpenFeature client open_feature_client = api.get_client() ``` -------------------------------- ### Example Create Variation Output Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/cli-guides/variations.md Example JSON output after creating a new variation for a feature. ```json { "_id": "q1w2e3r4t5y6u7i", "_project": "p0o9i8u7y6t5", "source": "dashboard", "type": "release", "name": "feature-a", "key": "feature-a", "description": "", "_createdBy": "google-oauth2|q1w2e3r4t5y6y", "createdAt": "2023-07-26T19:49:33.004Z", "updatedAt": "2023-07-26T20:23:57.035Z", "variations": [ { "_id": "d3df4g5h6j7j8k8k", "key": "variation-on", "name": "Variation On", "variables": { "variable-alpha": true } }, { "_id": "a1s2d3f4g5h6j7", "key": "variation-off", "name": "Variation Off", "variables": { "variable-alpha": true } }, { "_id": "l9k8kj6h5g4f3", "key": "new-variation", "name": "New Variation", "variables": { "variable-alpha": true } } ], "controlVariation": "variation-on", "variables": [ { "_id": "q1w2e3r4t5y6u7i", "_project": "p0o9i8u7y6t5", "_feature": "e3r4t5y6u7u7", "name": "variable-alpha", "key": "variable-alpha", "type": "Boolean", "status": "active", "source": "dashboard", "_createdBy": "google-oauth2|q1w2e3r4t5y6y", "createdAt": "2023-07-26T20:28:03.057Z", "updatedAt": "2023-07-26T20:28:03.057Z" } ], "tags": [], "readonly": false, "settings": { "optInEnabled": false, "publicName": "", "publicDescription": "" }, "sdkVisibility": { "mobile": true, "client": true, "server": true } } ``` -------------------------------- ### Example List Variation Keys Output Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/cli-guides/variations.md Example JSON output when listing variation keys for a feature. ```json ["variation-on", "variation-off"] ``` -------------------------------- ### Initialize DevCycle Client and User in Ruby Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/sdk/server-side-sdks/ruby/ruby-gettingstarted.md Demonstrates how to initialize the DevCycle client with a server token and options, and create a user object for evaluation. Ensure you have the 'devcycle-ruby-server-sdk' gem installed. ```ruby require 'devcycle-ruby-server-sdk' options = DevCycle::Options.new() devcycle_client = DevCycle::Client.new("dvc_server_token_hash", options, true) user = DevCycle::User.new({ user_id: 'test_user', email: 'example@example.ca', country: 'CA' }) ``` -------------------------------- ### Initialize DevCycle Go Client Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/sdk/server-side-sdks/go/go-gettingstarted.md Initialize the DevCycle client with your SDK key and custom options. Ensure the DEVCYCLE_SERVER_SDK_KEY environment variable is set. ```go package main import ( "log" "os" "time" devcycle "github.com/devcyclehq/go-server-sdk/v2" ) func main() { sdkKey := os.Getenv("DEVCYCLE_SERVER_SDK_KEY") options := devcycle.Options{ // Insert Options } devcycleClient, err := devcycle.NewClient(sdkKey, &options) if err != nil { log.Fatalf("Error initializing DevCycle client: %v", err) } } ``` -------------------------------- ### Initialize DevCycle SDK in JavaScript Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/sdk/server-side-sdks/node/node-gettingstarted.md Import the SDK and call `initializeDevCycle` with your server key. You can optionally await the client initialization. ```javascript const DevCycle = require('@devcycle/nodejs-server-sdk') const devcycleClient = await DevCycle.initializeDevCycle( process.env.DEVCYCLE_SERVER_SDK_KEY, ).onClientInitialized() ``` -------------------------------- ### Install DevCycle NestJS SDK with npm Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/sdk/server-side-sdks/nestjs/nestjs-install.md Use this command to install the DevCycle NestJS server-side SDK using npm. ```bash npm install --save @devcycle/nestjs-server-sdk ``` -------------------------------- ### Install Web Debugger with Yarn Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/platform/testing-and-qa/debug-tools/web-debugger.md Install the Web Debugger package using Yarn. This is an alternative to NPM for package management. ```bash yarn add @devcycle/web-debugger ``` -------------------------------- ### Get All Features in Client Component Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/sdk/client-side-sdks/nextjs/nextjs-usage-app.md Use the `useAllFeatures` hook within client components to get all DevCycle features. ```typescript jsx import { useAllFeatures } from '@devcycle/nextjs-sdk' import * as React from 'react' export const MyClientComponent = function () { const allFeatures = useAllFeatures() return
JSON.stringify(allFeatures)
} ``` -------------------------------- ### Initialize Cloud Bucketing SDK Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/sdk/server-side-sdks/python/python-gettingstarted.md Import and set up the DevCycleCloudClient. Ensure you have the DEVCYCLE_SERVER_SDK_KEY environment variable set. User data must be an instance of DevCycleUser. Options can be configured to enable storing user data in EdgeDB. ```python from devcycle_python_sdk import DevCycleCloudClient, DevCycleCloudOptions from devcycle_python_sdk.models.user import DevCycleUser import os # Create an options object and enable storing user data in EdgeDB options = DevCycleCloudOptions(enable_edge_db=True) # create an instance of the DevCycleCloudClient class devcycle_client = DevCycleCloudClient(os.environ["DEVCYCLE_SERVER_SDK_KEY"], options) # all client functions require user data to be an instance of the DevCycleUser class user = DevCycleUser( user_id='test', email='example@example.ca', country='CA' ) ``` -------------------------------- ### Login and Select Project CLI Commands Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/cli-mcp/mcp-reference.md Use these commands for CLI authentication and to select the project for subsequent operations. Recommended for local development. ```bash dvc login sso dvc projects select ``` -------------------------------- ### Install React Native SDK with yarn Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/sdk/client-side-sdks/react-native/react-native-install.md Use this command to install the main React Native SDK package using yarn. ```bash yarn add @devcycle/react-native-client-sdk ``` -------------------------------- ### Initialize DevCycle Client and Fetch Features Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/sdk/server-side-sdks/php/php-gettingstarted.md This snippet demonstrates how to initialize the DevCycle client with your server SDK key and a user, then fetch all features for that user. Ensure the DEVCYCLE_SERVER_SDK_KEY environment variable is set. ```php require_once(__DIR__ . '/vendor/autoload.php'); use DevCycle\Api\DevCycleClient; use DevCycle\Model\DevCycleOptions; use DevCycle\Model\DevCycleUser; $options = new DevCycleOptions(); $devCycleClient = new DevCycleClient( sdkKey: getenv("DEVCYCLE_SERVER_SDK_KEY"), dvcOptions: $options); $user_data = new DevCycleUser(array( "user_id"=>"my-user" )); try { $result = $devcycleClient->allFeatures($user_data); print_r($result); } catch (Exception $e) { echo 'Exception when calling DevCycleClient->allFeatures: ', $e->getMessage(), PHP_EOL; } ``` -------------------------------- ### Initialize Local Bucketing Client Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/sdk/server-side-sdks/dotnet/dotnet-gettingstarted.md Initialize a DevCycle client for local bucketing using your SDK key. Replace `` with your actual key. The `using` statement ensures proper disposal of client resources. ```csharp using System; using System.Diagnostics; using DevCycle.SDK.Server.Local.Api; namespace Example { public class Example { static Main(string[] args) { using DevCycleLocalClient client = new DevCycleLocalClientBuilder() .SetSDKKey("") .SetLogger(LoggerFactory.Create(builder => builder.AddConsole())) .Build(); } } } ``` -------------------------------- ### Install React Native Expo SDK with yarn Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/sdk/client-side-sdks/react-native/react-native-expo-install.md Use this command to install the DevCycle React Native Expo SDK using yarn. ```bash yarn expo install @devcycle/react-native-expo-client-sdk ``` -------------------------------- ### Initialize DevCycle Client (Cloud Bucketing) Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/sdk/server-side-sdks/go/go-gettingstarted.md Initialize the DevCycle client with cloud bucketing enabled by setting EnableCloudBucketing to true in the options. Ensure the DEVCYCLE_SERVER_SDK_KEY environment variable is set. ```go package main import ( "log" "os" devcycle "github.com/devcycle/go-server-sdk/v2" ) func main() { sdkKey := os.Getenv("DEVCYCLE_SERVER_SDK_KEY") options := devcycle.Options{ EnableCloudBucketing: true, } devcycleClient, err := devcycle.NewClient(sdkKey, &options) if err != nil { log.Fatalf("Error initializing DevCycle client: %v", err) } } ``` -------------------------------- ### Install React Native Expo SDK with npx Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/sdk/client-side-sdks/react-native/react-native-expo-install.md Use this command to install the DevCycle React Native Expo SDK using npx. ```bash npx expo install @devcycle/react-native-expo-client-sdk ``` -------------------------------- ### Initialize DevCycle Client and Get Features Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/sdk/server-side-sdks/ruby/ruby-gettingstarted.md Loads the gem, sets up authorization with your SDK key, and initializes the DevCycle client. It then retrieves all features for a given user and prints the result. Includes basic error handling for API calls. ```ruby # Load the gem require 'devcycle-ruby-server-sdk' # Setup authorization devcycle_client = DevCycle::Client.new(ENV['DEVCYCLE_SERVER_SDK_KEY'], DevCycle::Options.new, true) user = DevCycle::User.new({ user_id: 'user_id_example' }) begin # Get all features for user data result = devcycle_client.all_features(user) p result rescue DevCycle::ApiError => e puts "Exception when calling DevCycle::Client->all_features: #{e}" end ``` -------------------------------- ### Install Web Debugger with NPM Source: https://github.com/devcyclehq/devcycle-docs/blob/main/docs/platform/testing-and-qa/debug-tools/web-debugger.md Install the Web Debugger package using NPM. This is the first step to integrating the tool into your frontend project. ```bash npm install @devcycle/web-debugger ```