|
| 1 | +# LaunchDarkly Vercel Edge SDK |
| 2 | + |
| 3 | +This library supports using Vercel [Edge Config](https://vercel.com/docs/concepts/edge-network/edge-config) to replace the default in-memory feature store of the [LaunchDarkly Node.js SDK](https://github.com/launchdarkly/vercel-server-sdk). |
| 4 | + |
| 5 | +For more information, see the [SDK features guide](https://docs.launchdarkly.com/sdk/features/storing-data). |
| 6 | + |
| 7 | +## Install |
| 8 | + |
| 9 | +```shell |
| 10 | +npm i @launchdarkly/vercel-server-sdk |
| 11 | +``` |
| 12 | + |
| 13 | +or yarn: |
| 14 | + |
| 15 | +```shell |
| 16 | +yarn add -D @launchdarkly/vercel-server-sdk |
| 17 | +``` |
| 18 | + |
| 19 | +## Quickstart |
| 20 | + |
| 21 | +Initialize the ldClient with the [Vercel Edge SDK](https://vercel.com/docs/concepts/edge-network/edge-config/edge-config-sdk) and your LaunchDarkly client side sdk key: |
| 22 | + |
| 23 | +```typescript |
| 24 | +import init from '@launchdarkly/vercel-server-sdk'; |
| 25 | +import { createClient } from '@vercel/edge-config'; |
| 26 | + |
| 27 | +const edgeClient = createClient(process.env.EDGE_CONFIG); |
| 28 | +const ldClient = init('YOUR CLIENT-SIDE SDK KEY', edgeClient); |
| 29 | + |
| 30 | +await ldClient.waitForInitialization(); |
| 31 | +const ldContext = { |
| 32 | + kind: 'org', |
| 33 | + key: 'my-org-key', |
| 34 | + someAttribute: 'my-attribute-value', |
| 35 | +}; |
| 36 | +const flagValue = await ldClient.variation('my-flag', ldContext, true); |
| 37 | +``` |
| 38 | + |
| 39 | +To learn more, head straight to the [complete reference guide for this SDK](https://docs.launchdarkly.com/sdk/server-side/vercel). |
| 40 | + |
| 41 | +## Developing this SDK |
| 42 | + |
| 43 | +```shell |
| 44 | +# at js-core repo root |
| 45 | +yarn && yarn build && cd packages/sdk/vercel |
| 46 | +# run tests |
| 47 | +yarn test |
| 48 | +``` |
| 49 | + |
| 50 | +## About LaunchDarkly |
| 51 | + |
| 52 | +- LaunchDarkly is a continuous delivery platform that provides feature flags as a service and allows developers to iterate quickly and safely. We allow you to easily flag your features and manage them from the LaunchDarkly dashboard. With LaunchDarkly, you can: |
| 53 | + - Roll out a new feature to a subset of your users (like a group of users who opt-in to a beta tester group), gathering feedback and bug reports from real-world use cases. |
| 54 | + - Gradually roll out a feature to an increasing percentage of users, and track the effect that the feature has on key metrics (for instance, how likely is a user to complete a purchase if they have feature A versus feature B?). |
| 55 | + - Turn off a feature that you realize is causing performance problems in production, without needing to re-deploy, or even restart the application with a changed configuration file. |
| 56 | + - Grant access to certain features based on user attributes, like payment plan (eg: users on the ‘gold’ plan get access to more features than users in the ‘silver’ plan). Disable parts of your application to facilitate maintenance, without taking everything offline. |
| 57 | +- LaunchDarkly provides feature flag SDKs for a wide variety of languages and technologies. Read [our documentation](https://docs.launchdarkly.com/sdk) for a complete list. |
| 58 | +- Explore LaunchDarkly |
| 59 | + - [launchdarkly.com](https://www.launchdarkly.com/ 'LaunchDarkly Main Website') for more information |
| 60 | + - [docs.launchdarkly.com](https://docs.launchdarkly.com/ 'LaunchDarkly Documentation') for our documentation and SDK reference guides |
| 61 | + - [apidocs.launchdarkly.com](https://apidocs.launchdarkly.com/ 'LaunchDarkly API Documentation') for our API documentation |
| 62 | + - [blog.launchdarkly.com](https://blog.launchdarkly.com/ 'LaunchDarkly Blog Documentation') for the latest product updates |
0 commit comments