Getting started with SDKs
This guide outlines the necessary requirements and preliminary steps to take when initially configuring a FlagSync SDK.
Prerequisites
Before integrating FlagSync into your codebase, regardless of which SDK you choose, there are some essential prerequisites to address.
Evaluating the factors outlined below will enable you to leverage feature flags effectively, aligning with your specific use case, customer needs, security protocols, and existing network infrastructure.
Determine your SDK type
You may need server-side or client-side.
To learn more, read SDK types (client/server).
Depending on your use case, you may need multiple SDKs to support front-end and backend behavior simultaneously, such as an SSR web application.
For instance, you may want to evaluate flags server-side, and pipe them to the frontend. But if you also want to send events to FlagSync from the frontend, you'll need a front-end SDK.
Language support:
FlagSync supports JavaScript in many forms (e.g Node.js, JavaScript, React, Nest.js, etc), however if you require a language we do not support, contact us at support@flagsync.com.
Secure your SDK keys:
Server-side SDKs can expose details of your flag rules, such as internal email addresses or user keys, and its keys should never be made public.
Client-side SDK keys are safe to expose, and should be used for client-facing applications such as web browsers or mobile applications.
Initialization process
Whether initializing a server-side or client-side SDK, it is an asynchronous process. Depending on the SDK type, individual flag values or entire flag rulesets will be sent to the SDK client.
While the initialization call to FlagSync is on the order of milliseconds, it much depends on the number of flags in your system and complexity of the rulesets.
SDK singleton
Similar to other feature flag platforms, it's crucial to initialize the SDK as a single instance within your project. SDKs such as the Nest.js SDK do this automatically, however in other cases it's up to you to ensure the singleton pattern.
Creating multiple instances can lead to memory leaks, where previous instances remain active beyond their intended lifespan.
Last updated