{"id":31974667,"url":"https://github.com/splitio/vercel-integration-utils","last_synced_at":"2026-03-05T17:44:09.323Z","repository":{"id":177043554,"uuid":"614914710","full_name":"splitio/vercel-integration-utils","owner":"splitio","description":null,"archived":false,"fork":false,"pushed_at":"2026-02-05T19:09:50.000Z","size":1183,"stargazers_count":0,"open_issues_count":2,"forks_count":1,"subscribers_count":6,"default_branch":"main","last_synced_at":"2026-02-06T04:35:37.157Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/splitio.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.txt","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-03-16T15:14:11.000Z","updated_at":"2026-02-05T18:57:02.000Z","dependencies_parsed_at":"2023-12-07T21:29:02.312Z","dependency_job_id":"69e3a7c8-10b0-4ecc-a6db-f665379a69b0","html_url":"https://github.com/splitio/vercel-integration-utils","commit_stats":null,"previous_names":["splitio/vercel-integration-utils"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/splitio/vercel-integration-utils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/splitio%2Fvercel-integration-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/splitio%2Fvercel-integration-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/splitio%2Fvercel-integration-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/splitio%2Fvercel-integration-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/splitio","download_url":"https://codeload.github.com/splitio/vercel-integration-utils/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/splitio%2Fvercel-integration-utils/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30139647,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-05T16:58:46.102Z","status":"ssl_error","status_checked_at":"2026-03-05T16:58:45.706Z","response_time":93,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-10-14T20:20:06.050Z","updated_at":"2026-03-05T17:44:09.300Z","avatar_url":"https://github.com/splitio.png","language":"TypeScript","readme":"# Vercel integration using Edge Config and Split SDK\n\n## Overview\n\nThis package provides a Split Storage Wrapper for Vercel Edge Config, a low latency data storage used to store and retrieve feature flag definitions for running the Split SDK on the Edge.\n\nKeeping feature flag definitions within an Edge Config instance enables the Split SDK to operate in [partial consumer mode](https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#sharing-state-with-a-pluggable-storage). This mode means that the SDK doesn't fetch feature flags from the Split backend, and instead relies on those stored in the Edge Config, thereby significantly reducing the latency during feature flag evaluations.\n\nThe package includes the storage wrapper module (`src/EdgeConfigWrapper.ts`), as well as an `example` folder to quickly get started with the integration.\n\nThe project overall architecture is illustrated in the following diagram:\n\n\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"Overview\" src=\"./diagram.png\" width=\"720\"\u003e\n\u003c/p\u003e\n\n## Setup\n\n1. Install the [Split integration for Vercel](https://help.split.io/hc/en-us/articles/16469873148173) to start synchronizing feature flag definitions into your Edge Config instance.\n2. Setup the Split SDK in your application project:\n    - Install dependencies: `npm install @splitsoftware/splitio-browserjs @splitsoftware/vercel-integration-utils @vercel/edge-config`\n    - Import and use the Split SDK with the EdgeConfig wrapper in your Edge function or middleware (check [API route example here](./example/pages/api/get-treatment.js)):\n    ```javascript\n    import { SplitFactory, PluggableStorage, ErrorLogger } from '@splitsoftware/splitio-browserjs';\n    import { EdgeConfigWrapper } from '@splitsoftware/vercel-integration-utils';\n    import { createClient } from '@vercel/edge-config';\n\n    // Deploying as an Edge function here, but you can also use it on Edge middlewares and Serverless functions\n    export const config = { runtime: \"edge\" };\n\n    // Creates a client which knows how to read from Edge Config\n    // This client is defined outside of the handler so that it can be reused across requests\n    const edgeConfigClient = createClient(process.env.EDGE_CONFIG);\n\n    export default async function handler(req, event) {\n      // Extract user key. In this case from a request query param\n      const { searchParams } = new URL(req.url);\n      const userKey = searchParams.get('userKey');\n\n      const client = SplitFactory({\n        core: {\n          authorizationKey: '\u003cYOUR_SPLIT_SDK_KEY\u003e',\n          key: userKey\n        },\n        mode: 'consumer_partial',\n        storage: PluggableStorage({\n          wrapper: EdgeConfigWrapper({\n            // The Edge Config item where Split stores feature flag definitions, specified in the Split integration step\n            edgeConfigItemKey: '\u003cYOUR_EDGE_CONFIG_ITEM_KEY\u003e',\n            // The Edge Config client\n            edgeConfig: edgeConfigClient,\n          })\n        }),\n        // Disable or keep only ERROR log level in production, to minimize performance impact\n        debug: ErrorLogger()\n      }).client();\n\n      // Wait until the SDK is ready or timed out. If timeout occurs, treatment evaluations will default to 'control'.\n      // A timeout should not occur if Edge Config is properly configured and synchronized.\n      await new Promise(res =\u003e {\n        client.on(client.Event.SDK_READY, res);\n        client.on(client.Event.SDK_READY_TIMED_OUT, res);\n      });\n\n      const treatment = await client.getTreatment('SOME_FEATURE_FLAG');\n\n      // Flush impressions asynchronously. Avoid 'await' on the destroy call, to not delay the response.\n      event.waitUntil(client.destroy());\n\n      return new Response(JSON.stringify({ treatment }), {\n        status: 200,\n        headers: { 'content-type': 'application/json' }\n      });\n    }\n    ```\n    - Remember to update the Split SDK key and Edge Config item key in the code above.\n3. Deploy your application to Vercel and test the integration.\n\n## Advanced use cases\n\n### Provide an Edge Config connection string\n\nBy default, the Edge Config client access an Edge Config instance using the Connection String stored in the `EDGE_CONFIG` environment variable. That variable is automatically set by Vercel when you [connect the Edge Config to your project](https://vercel.com/docs/concepts/edge-network/edge-config/using-edge-config#using-a-connection-string) via the Vercel Dashboard.\n\nHowever, you might require to use a different Edge Config instance, for example, if the default one is used for storing other data. In that case, you can create an Edge Config client with a different connection string, as shown below:\n\n```javascript\nimport { createClient } from '@vercel/edge-config';\n\nconst client = SplitFactory({\n  ...\n  storage: PluggableStorage({\n    wrapper: EdgeConfigWrapper({\n      edgeConfigItemKey: '\u003cYOUR_EDGE_CONFIG_ITEM_KEY\u003e',\n      edgeConfig: createClient('\u003cYOUR-EDGE-CONFIG-CONNECTION-STRING\u003e')\n    })\n  })\n});\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsplitio%2Fvercel-integration-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsplitio%2Fvercel-integration-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsplitio%2Fvercel-integration-utils/lists"}