{"id":26909944,"url":"https://github.com/stack-spot/web-deploy-ab","last_synced_at":"2025-04-01T13:30:02.381Z","repository":{"id":42504218,"uuid":"470586590","full_name":"stack-spot/web-deploy-ab","owner":"stack-spot","description":null,"archived":false,"fork":false,"pushed_at":"2024-02-10T23:10:33.000Z","size":139411,"stargazers_count":0,"open_issues_count":9,"forks_count":0,"subscribers_count":11,"default_branch":"main","last_synced_at":"2024-02-11T00:22:33.428Z","etag":null,"topics":["stackspot"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stack-spot.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-03-16T13:05:40.000Z","updated_at":"2024-02-11T00:22:33.428Z","dependencies_parsed_at":"2023-02-08T04:16:27.774Z","dependency_job_id":null,"html_url":"https://github.com/stack-spot/web-deploy-ab","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stack-spot%2Fweb-deploy-ab","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stack-spot%2Fweb-deploy-ab/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stack-spot%2Fweb-deploy-ab/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stack-spot%2Fweb-deploy-ab/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stack-spot","download_url":"https://codeload.github.com/stack-spot/web-deploy-ab/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246647135,"owners_count":20811259,"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":["stackspot"],"created_at":"2025-04-01T13:30:01.524Z","updated_at":"2025-04-01T13:30:02.349Z","avatar_url":"https://github.com/stack-spot.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Stack Foundation Deploy A/B Plugin\n\n## Goal\n\nImplement A/B testing solution for a website on AWS.\n\nWe explore the use of edge computing, which is between the browser and the backend, to provide processing close to where data is generated. This plugin lets you run code closer to users of your application, which improves performance and reduces latency, through the use of three services:\n\n- [AWS Lambda@Edge](https://aws.amazon.com/lambda/edge) runs your code globally at AWS locations close to your users, so you can deliver full-featured, customized content with high performance, and low latency.\n- With [AWS CloudFront Functions](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cloudfront-functions.html) in Amazon CloudFront, you can write lightweight functions in JavaScript for high-scale, latency-sensitive CDN customizations. The CloudFront Functions allows you to run lightweight JavaScript code at the [218+ CloudFront edge locations](https://aws.amazon.com/cloudfront/features/?whats-new-cloudfront.sort-by=item.additionalFields.postDateTime\u0026whats-new-cloudfront.sort-order=desc#Global_Edge_Network) (as of August 2021).\n- [Amazon CloudFront](https://aws.amazon.com/cloudfront) delivers your content through a worldwide network of data centers called edge locations. The regional edge caches are located between your origin web server and the global edge locations that serve content directly to your viewers.\n\n**Architecture:**\n\nThe following diagram illustrates the architecture we will implement:\n\n![General architecture](templates/iac-deploy-ab/resources/readme/architecture_module_3_3.png)\n\nThe static resources (html, javascript, css and images) are hosted on S3 and we can imagine having APIs for the dynamic part. We will concentrate on the static part, so our website has only the static part implemented.\n\n## Example Scenario\n\nWe have an e-commerce website for selling digital images and we want to modify the layout of the home page in order to see if more visitors will click on a image and potentially buy it when they arrive on the new layout versus the old layout.\n\nThe home page (A version) looks like this:\n\n![Homepage - A version](templates/iac-deploy-ab/resources/readme/layout_A.png?width=1024px)\n\nThe new layout (B version) has the images on three columns, a buy button and looks like this:\n\n![Homepage - B version](templates/iac-deploy-ab/resources/readme/layout_B.png?width=1024px)\n\nTo test the new layout, we want to show it only to a small percentage of visitors. Based on the success of failure of the new layout we would like to be able to increase/decrease this percentage of visitor getting the new layout.\n\n### Prerequisites\n\n- AWS keys setted in the runtime\n- NPM\n- CDK\n- STK CLI\n\n### Instructions\n\n#### 1. Add plugin to your application\n\n```bash\nstk add plugin uxservices-web-deploy-ab\ncd iac-deploy-ab\n```\n\n#### 2. Installs the dependencies\n\n```bash\nnpm install\n```\n\n#### 3. Deploy\n\n```bash\ncdk deploy AB\n```\n\n#### 4. Create configuration in DynamoDB table\n\n```bash\naws dynamodb put-item \\\n    --table-name WebsiteRedirection  \\\n    --item \\\n        '{\"path\": {\"S\": \"/\"}, \"segment\": {\"S\": \"0.8\"}, \"version_a\": {\"S\": \"index.html\"}, \"version_b\": {\"S\": \"index_b.html\"}}'\n```\n\n## Costs\n\nAll resources created are billed based on pay-per-use principle. The estimated cost of AWS resources is **below $2** for one day.\n\nExcept for CloudFront Functions, all services used benefit from [AWS Free Tier](https://aws.amazon.com/free/) offer.\n\n## Cleanup\n\nPlease ensure to perform the cleanup command after the completion to avoid potentially unwanted costs.\n\n```bash\ncdk destroy AB\n```\n\n## Intended Audience\n\n- Developers, Solutions Architect, Project Managers\n- Prior experience in Cloud Computing is required\n- Basic understanding of a programming language is suitable","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstack-spot%2Fweb-deploy-ab","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstack-spot%2Fweb-deploy-ab","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstack-spot%2Fweb-deploy-ab/lists"}