Build-time logic snapshot

You can embed a fallback snapshot of your flag logic in the generated client.

The SDK will locally, reliably and instantly initialize from the snapshot first, before fetching the latest flag logic from Hypertune Edge. So even in the unlikely event that Hypertune Edge is unreachable, SDKs will still successfully initialize from the snapshot.

This is useful on the frontend as you can use your flags in the first app render without any page load delay, UI flicker or layout shift.

It's also useful for running an SDK in local-only, offline mode for unit tests.

The snapshot can be kept fresh by setting up a webhook to automatically regenerate it on every Hypertune commit, then committing the result to your own repo.

1. Set environment variable

Set the HYPERTUNE_INCLUDE_INIT_DATA environment variable:

HYPERTUNE_INCLUDE_INIT_DATA=true

2. Regenerate the client

Regenerate the client. The generated client now includes a fallback snapshot of your flag logic.

That's it

The SDK will now instantly initialize from the snapshot first before fetching the latest flag logic from the server. And it will always successful initialize, even if the server is unreachable. You can keep the snapshot fresh by setting up a webhook to regenerate the client on every Hypertune commit.

Last updated