You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update LaunchDarkly examples for native Vercel Marketplace integration (#1532)
## Summary
Updates the LaunchDarkly examples to use the new native LaunchDarkly
Vercel Marketplace integration, alongside the upcoming
`@flags-sdk/launchdarkly` v1.0.0 release.
The key change is that the Edge Config connection string is now exposed
as `EXPERIMENTATION_CONFIG` (renamed from `EDGE_CONFIG`), matching the
native Marketplace integration and other experimentation adapters (e.g.
Statsig).
### `flags-sdk/launchdarkly`
- Bump `@flags-sdk/launchdarkly` `^0.3.2` → `^1.0.0` (v1.0.0 reads
`EXPERIMENTATION_CONFIG` by default)
- `.env.example`: `EDGE_CONFIG` → `EXPERIMENTATION_CONFIG`
- README: Marketplace `products` deploy param + docs on enabling the
Edge Config sync from the integration resource
- Regenerated `pnpm-lock.yaml`
### `edge-middleware/feature-flag-launchdarkly`
- `page.tsx`: read connection string from `EXPERIMENTATION_CONFIG`
- Deploy URL: replaced legacy `integration-ids`/`edge-config-stores`
params with the Marketplace `products` param
- README/link updates for the native Marketplace integration
### Notes
- `toolbar/toolbar-launchdarkly` is unaffected (uses
`LAUNCHDARKLY_SDK_KEY` directly, no Edge Config).
- Edge Config provisioning with the integration is handled by a separate
change.
This example shows how to use the [LaunchDarkly integration](https://vercel.com/integrations/launchdarkly) with Next.js.
17
+
This example shows how to use the native [LaunchDarkly integration](https://vercel.com/marketplace/launchdarkly) from the Vercel Marketplace with Next.js.
18
18
19
-
> ℹ️ The LaunchDarkly integration requires a LaunchDarkly enterprise account.
19
+
The integration provides the `NEXT_PUBLIC_LAUNCHDARKLY_CLIENT_SIDE_ID` environment variable, which contains your client-side ID from LaunchDarkly.
20
20
21
-
You will need to provide the `NEXT_PUBLIC_LD_CLIENT_SIDE_ID` environment variable. Fill it with your client-side ID from LaunchDarkly.
21
+
LaunchDarkly syncs your feature flags into an Edge Config. When installing the LaunchDarkly integration from the Vercel Marketplace, turn on the **Enable Edge Config Syncing** toggle in the "Configuration and Plan" step of the install process. This provisions an Edge Config and exposes its connection string as the `EXPERIMENTATION_CONFIG` environment variable, which this example reads to create the Edge Config client.
22
22
23
-
LaunchDarkly wills sync your feature flags into an Edge Config, which you can set in the integration. Note that the same Edge Config also needs to be linked to this project via the `EDGE_CONFIG` environment variable. If you clone this template, this will be set up for you automatically when you select the Edge Config.
23
+
## Set up the feature flag
24
+
25
+
Head over to the [LaunchDarkly Console](https://app.launchdarkly.com) and create the feature flag used by this example, in the same project and environment your client-side ID belongs to:
26
+
27
+
-`My Flag` (type boolean) with the key `my-flag` and the variations `true` and `false`
28
+
29
+
Turn the flag ON. Toggling targeting on and off changes what the page shows, confirming flags are being read from Edge Config.
30
+
31
+
The example evaluates the flag against a context of kind `org` with the key `my-org-key` (see `app/page.tsx`). Contexts do not need to be created in LaunchDarkly ahead of time — they are simply sent by the app at evaluation time. The default targeting rule works without any extra setup. If you want to add targeting rules, target the `org` context kind rather than `user`.
24
32
25
33
## Demo
26
34
@@ -34,7 +42,7 @@ You can choose from one of the following two methods to use this repository:
34
42
35
43
Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=vercel-examples):
36
44
37
-
[](https://vercel.com/new/clone?repository-url=https://github.com/vercel/examples/tree/main/edge-middleware/feature-flag-launchdarkly&project-name=feature-flag-launchdarkly&repository-name=feature-flag-launchdarkly&integration-ids=oac_8DFUMlauSkqeQhdGHpL5xbWp&env=NEXT_PUBLIC_LD_CLIENT_SIDE_ID&env=EDGE_CONFIG&edge-config-stores=%7B%22EDGE_CONFIG%22%3A%7B%7D%7D)
45
+
[](https://vercel.com/new/clone?repository-url=https://github.com/vercel/examples/tree/main/edge-middleware/feature-flag-launchdarkly&project-name=feature-flag-launchdarkly&repository-name=feature-flag-launchdarkly&products=%5B%7B%22integrationSlug%22%3A%22launchdarkly%22%2C%22productSlug%22%3A%22launchdarkly%22%2C%22type%22%3A%22integration%22%2C%22protocol%22%3A%22experimentation%22%7D%5D)
0 commit comments