This sections outlines the distinctions between FlagSync's client-side, server-side SDKs. These SDK types differ in terms of security implications and flag evaluation methodologies.
SDK types
The table below summarizes the different SDK types that FlagSync currently offers, and in which environments you would use them.
Client-side
Intended for single-user contexts in browser environments, such as mobile or desktop web applications.
Use client-side SDK key.
Server-side
Intended for multi-user contexts such as web or API servers, game servers, or real-time messaging/chat servers, etc.
Use server-side SDK key.
SDK differences
While FlagSync maintains feature parity amongst all of its SDKs, there are some key difference between server-side and client-side.
Storage
Client-side SDKs can optionally make use of LocalStorage to bootstrap the SDK and speed up the initialization process. While these flags may be stale until the SDK fully initializes, it mitigates potential delays, ensuring a more responsive user experience from the outset until the latest flag values are retrieved.
Flag evaluation and flag updates
Among other features, FlagSync SDKs allows you to evaluate feature flags for a specific user context.
SDK Type
Flag Evaluation
Client-side
When you initialize a client-side SDK with a user context (required), it sends the user context to the FlagSync.
The server then evaluates all feature flag rules for that user context and returns the results in the form of a key-value pairs:
For streaming updates, a server-side event (SSE) connection is opened between FlagSync and the client.
When a flag updates occur on the server, that flag is reevaluated for the user context are automatically sent back to the client SDK.
This ensures that the client always has the latest flag values streamed (or polled) from the server, pre-evaluated for the given user.
Server-side
For server-side SDKs, you initialize the SDK without a user context, and receive the complete set of feature flag rules from FlagSync.
When evaluating for a specific flag, you must pass a user context, and the flag evaluation is performed locallybased on the rules already fetched by the SDK.
For streaming updates, a server-side event (SSE) connection is opened between FlagSync and the client.
When a flag updates occur on the server, the updated rule(s) are sent to the server SDK.
This ensures that subsequent flag evaluations use the latest rules streamed (or polled) from the server.
Flag evaluation comparison
Client-side SDKs requires a user context when initializing the client. Server-side SDKs require a user context when evaluating flags.
// User Context A{"is-oauth-enabled":true,"register-button":"Join Now","banner-value": {"type":"danger","content":"Sorry, we're down for maintenance!" }}// User Context B{"is-oauth-enabled":false,"register-button":"Sign Up","banner-value": {"type":"danger","content":"Sorry, we're down for maintenance!" }}