Overview
The Sidecar SDK is used to interact with the Stigg Sidecar Service, which provides low latency entitlement checks, handles caching, and subscribes to real-time entitlement and usage data updates.Each Sidecar package (the Python, Ruby, Go, and Java SDKs, and the Sidecar service image) is versioned independently and released only when it changes. Don’t assume the same version number across languages — check each package’s own version in the changelog.
Node.js applications do not require the Sidecar. The Node.js SDK provides full feature parity with the Sidecar, including low-latency entitlement checks, caching, and real-time updates.
Installing the SDK
The first step is to install the Stigg SDK as a dependency in your application:The Go module path includes a major version (currently
v7), which is derived from the Go SDK’s version at release time and will change on the next major bump. Check the Sidecar SDK changelog for the current major before running go get.Retrieving the full access key
In the Stigg app, go to Integrations > API keys. Copy the Full access key of the relevant environment.Initializing the SDK
Development
For development, first run the Sidecar service using Docker. Run the service with the latest version in the ECR Public Gallery:Production
For production use, its recommended to deploy the Sidecar service using the sidecar pattern, or as a standalone service. You set the remote sidecar host and port parameters as part of the SDK initialization:Running in offline or air-gapped environments
In air-gapped or highly secure environments where the Sidecar service cannot be deployed, you can use the Sidecar SDK in offline mode. This mode enables entitlement evaluation entirely in-memory without connecting to a remote or local Sidecar process. Offline mode is ideal for:- Air-gapped deployments
- Environments with restricted network access
- Testing with predefined entitlement data
The Offline mode is only available in Java SDK (v2.420.0+). This mode supports all entitlement types (boolean, numeric, metered). Usage and event reporting (
reportUsage, reportEvents) are disabled in the offline mode.OfflineStiggConfig, supplying a customer-to-entitlements mapping either programmatically or via a JSON string.
Initializing with programmatic config
You can pass static entitlement data directly as Java objects:Initializing from a JSON string
You can also load entitlements from a JSON string:Checking entitlements
All entitlement methods -getXEntitlement and getEntitlements - remain the same:
Getting the entitlement of a customer to a specific feature
Generic entitlement check (recommended)
ThegetEntitlement method provides a unified way to check any type of feature entitlement. It automatically returns the appropriate entitlement type based on the feature configuration.
The generic
getEntitlement method is the recommended approach for checking feature entitlements as it provides a unified interface and automatically handles all entitlement types. For metered features, you can also pass a requestedUsage parameter to proactively check if additional usage would be allowed.Checking the entitlement of a boolean feature
Checking the entitlement of a numeric configuration feature
Checking if a customer has access to a metered feature
Proactively checking if a customer will have access to X units of a metered feature
Getting all of the entitlements for a specific customer
Reload entitlements for a specific customer
Invalidate the cache and reload entitlements of a customer or customer resource. Note: this method skips the Edge API, so use it only when you need “read-after-write” consistency after entitlements presumably have changed.Reporting usage measurements to Stigg
The Stigg SDK allows you to report usage measurements for metered features. The reported usage will be used to track, limit and bill the customer’s usage of metered features. Stigg supports metering of usage from the following data sources:- Calculated usage - usage that has been aggregated and calculated by your application. This type is useful for features, such as: seats.
- Raw events - raw events from your application, which Stigg filters and aggregates aggregate to calculate customer usage. This type is useful for features, such as: monthly active users (MAUs).
Stigg's metering and aggregation capabilities
Validating that a measurement was successfully reported to Stigg is also possible in the customer details section of the relevant customer in the Stigg app.
Calculated usage
updateBehavior parameter:
Report in bulks
Calculated usage measurements can also be reported in bulks:Raw events
Access to additional Stigg APIs
The Sidecar SDK exposes a type-safe generated API client that can be used for send requests to the Stigg API:Persistent caching
In order for the cache to survive between restarts or to be shared across multiple instances of the Sidecar service, you can configure the Sidecar to use Redis as a cache provider.Prerequisites
Run a Persistent Cache Service in a separate process.SDK configuration
Configure Redis on the Sidecar service itself (see Running the Sidecar for theREDIS_* environment variables), then point the SDK at the running Sidecar with the remote host and port parameters. For local development, run the Sidecar with Docker as shown above.
