{"id":28628449,"url":"https://github.com/optimizely/edge-delivery","last_synced_at":"2026-02-26T21:46:35.536Z","repository":{"id":262862723,"uuid":"798374111","full_name":"optimizely/edge-delivery","owner":"optimizely","description":null,"archived":false,"fork":false,"pushed_at":"2025-05-15T15:49:12.000Z","size":7669,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-05-15T16:42:55.665Z","etag":null,"topics":["optimizely-environment-prod","optimizely-environment-public","optimizely-owner-cjs"],"latest_commit_sha":null,"homepage":"","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/optimizely.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-05-09T16:43:55.000Z","updated_at":"2025-05-15T15:49:14.000Z","dependencies_parsed_at":"2024-12-03T15:29:28.217Z","dependency_job_id":"4b2b9bbb-9692-46ef-ab09-eccbfd64f279","html_url":"https://github.com/optimizely/edge-delivery","commit_stats":null,"previous_names":["optimizely/edge-delivery"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/optimizely/edge-delivery","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/optimizely%2Fedge-delivery","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/optimizely%2Fedge-delivery/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/optimizely%2Fedge-delivery/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/optimizely%2Fedge-delivery/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/optimizely","download_url":"https://codeload.github.com/optimizely/edge-delivery/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/optimizely%2Fedge-delivery/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259447800,"owners_count":22859127,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["optimizely-environment-prod","optimizely-environment-public","optimizely-owner-cjs"],"created_at":"2025-06-12T10:33:47.621Z","updated_at":"2026-02-26T21:46:30.501Z","avatar_url":"https://github.com/optimizely.png","language":"TypeScript","readme":"\u003ch1 align=\"center\"\u003eOptimizely Edge Delivery SDK\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  Optimizely Edge Delivery lets you execute Optimizely Web experiments on Cloudflare Workers.\n  \u003cbr\u003e\n\u003c/p\u003e\n\n\u003chr\u003e\n\n## Prequisites\n\n- You must have a [Cloudflare Account](https://dash.cloudflare.com/sign-up/workers-and-pages).\n- You must install the [Wrangler CLI](https://developers.cloudflare.com/workers/wrangler/).\n\n## Quick Start\n\n#TODO: turn this into a cloudflare worker template instead\n\nTo get started quickly with a new project:\n1. Clone this repository and navigate to the templates/edge-delivery-starter directory\n    ```bash\n    cd templates/edge-delivery-starter\n    ```\n1. Install requirements \n    ```bash\n    npm install\n    ```\n1. Run the worker locally\n    ```bash\n    npm run dev \n    ```\n\n    This will open your worker executing in a browser. This loads the website https://example.com/ and executes an experiment that modifies the `h1` header text on the edge. \n\n1.  Modify the `SNIPPET_ID` and `DEV_URL` environment variables in the in the [wrangler.toml file](./templates/edge-delivery-starter/wrangler.toml). In this project, these are set to an example Optimizely Web Experiment by default. Modify these to your to test an Optimizely Web Experiment against your own website. \n    - Run `npm run dev` again to test the changes.\n1. Log in to your Cloudflare account using OAuth\n    ```bash\n    wrangler login\n    ``` \n1. Deploy the worker to your Cloudflare account:\n    ```bash\n    npm run deploy\n    ```\n1. On Cloudflare, add a route for your worker for the target website you want to proxy \n    - Alternatively, you can do this by [adding a route to the wrangler.toml](https://developers.cloudflare.com/workers/configuration/routing/routes/#set-up-a-route-in-wranglertoml) before running `npm run deploy`.\n1. Navigate to your website in a browser, and see your experiments in action!\n\n\n## Implementing in an existing Worker\n\nYou can install the Optimizely Edge Delivery SDK in any existing Cloudflare Worker, whether you already route your incoming traffic through a Cloudflare Worker, or you'd prefer to start from scratch using Cloudflare's [getting started guide](https://developers.cloudflare.com/workers/get-started/guide/).\n\n### Installing the Edge Delivery SDK\n\nTo install the Edge Delivery library, download and install the latest version of the [edge-delivery npm package](https://www.npmjs.com/package/@optimizely/edge-delivery):\n\n```bash \nnpm install @optimizely/edge-delivery@latest\n```\n\n### Implementing and executing experiments\n\nThe SDK requires a Snippet ID (`snippetId`) to know which configuration file to retrieve to execute your experiments.\n\n#### Basic configuration options\n\nIt's recommended to set a Development URL (`devUrl`) for the SDK to use as a target when testing locally or at your worker site directly.\n\n```typescript\nconst options = {\n    \"snippetId\": \"29061560280\",\n    \"devUrl\": \"https://example.com/\"\n};\n```\n\n#### applyExperiments\n\nThe `applyExperiments` method is used to execute experiments. This method uses the request information to make experiment bucketing decisions and apply active experiment variations to the control. Any decisions or changes that cannot be made on the edge are packaged together and added to the `\u003chead\u003e` element for execution on the browser.\n\n```typescript\nimport { applyExperiments } from '@optimizely/edge-delivery';\n...\nawait applyExperiments(request, ctx, options);\n```\n\n#### Other configuration options\n\nOptionally, you may pass a Response object as the control in the `options` parameter. This can be useful if you already have an existing Cloudflare Worker that, for example, makes modifications to the control outside of Optimizely experiments. \n\n```typescript\nlet control = await fetch(request);\n...\nconst options = {\n    // Other options\n    \"control\": control\n};\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foptimizely%2Fedge-delivery","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foptimizely%2Fedge-delivery","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foptimizely%2Fedge-delivery/lists"}