{"id":18816045,"url":"https://github.com/0-vortex/cf-workers-url-shortener","last_synced_at":"2025-04-13T22:21:07.825Z","repository":{"id":52510052,"uuid":"344665669","full_name":"0-vortex/cf-workers-url-shortener","owner":"0-vortex","description":"Social URL links redirect service powered by Cloudflare Workers and KV. Features customizable landing page, 404 status page for missing redirects, and one-click deploy!","archived":false,"fork":false,"pushed_at":"2021-04-27T05:02:26.000Z","size":508,"stargazers_count":28,"open_issues_count":1,"forks_count":9,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T12:39:11.942Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://connect-with.vortex.name","language":"Handlebars","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/0-vortex.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null},"funding":{"ko_fi":"0vortex","liberapay":"ted.vortex","issuehunt":"0-vortex","custom":["https://PayPal.Me/TeodorDutulescu"]}},"created_at":"2021-03-05T02:02:28.000Z","updated_at":"2025-01-11T08:06:48.000Z","dependencies_parsed_at":"2022-09-06T15:10:57.511Z","dependency_job_id":null,"html_url":"https://github.com/0-vortex/cf-workers-url-shortener","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0-vortex%2Fcf-workers-url-shortener","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0-vortex%2Fcf-workers-url-shortener/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0-vortex%2Fcf-workers-url-shortener/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0-vortex%2Fcf-workers-url-shortener/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/0-vortex","download_url":"https://codeload.github.com/0-vortex/cf-workers-url-shortener/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248789711,"owners_count":21161871,"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":[],"created_at":"2024-11-07T23:52:03.369Z","updated_at":"2025-04-13T22:21:07.795Z","avatar_url":"https://github.com/0-vortex.png","language":"Handlebars","funding_links":["https://ko-fi.com/0vortex","https://liberapay.com/ted.vortex","https://issuehunt.io/r/0-vortex","https://PayPal.Me/TeodorDutulescu"],"categories":[],"sub_categories":[],"readme":"# workers-url-shortener\n\n[![Commitizen Friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)\n [![License](https://img.shields.io/github/license/0-vortex/workers-url-shortener)](./LICENSE)\n [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2F0-vortex%2Fworkers-url-shortener.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2F0-vortex%2Fworkers-url-shortener?ref=badge_shield)\n\n[![Maintainability](https://api.codeclimate.com/v1/badges/26ea74df7c6fe2f18438/maintainability)](https://codeclimate.com/github/0-vortex/workers-url-shortener/maintainability)\n [![Known Vulnerabilities](https://snyk.io/test/github/0-vortex/workers-url-shortener/badge.svg)](https://snyk.io/test/github/0-vortex/workers-url-shortener)\n\n## Overview\n\nA Cloudflare Workers script to use as a simple redirect system.\n\nThe [data.json](./src/data.json) file can be used as dummy input or ``git`` enabled backup for your production environment.\n\nThe motivation for doing such a thing is GUI or IAM enabled acces to these variables from other CloudFlare tools, essentially promoting observability.\n\n## Folder structure\n\n```\n├──── workers-url-shortener\n│  ├── .github/\n│  ├── src/\n│  ├── static/\n│  ├── .editorconfig\n│  ├── .eslintrc.js\n│  ├── .gitattributes\n│  ├── .gitignore\n│  ├── .lintstagedrc.js\n│  ├── .npmrc\n│  ├── CODE_OF_CONDUCT.md\n│  ├── LICENSE\n│  ├── npm-shrinkwrap.json\n│  ├── package.json\n│  ├── README.md\n│  └── wrangler.toml\n```\n\n##  Deploy as Cloudflare Worker\n\nI use this service for my profile at [github.com](https://github.com/0-vortex). Currently, the service is hosted on a free tier of [Cloudflare Workers](https://workers.cloudflare.com/) and limited at 100K requests per day.\nMake sure to make the appropriate changes in [wrangler.toml](./wrangler.toml) first.\n\n[![Deploy to Cloudflare Workers](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/0-vortex/workers-url-shortener)\n\n## Requirements\n\nIn order to run the project locally you need ``node\u003e=14`` and ``npm\u003e=6``. \n\n### Install ``@cloudflare/wrangler``\n\nMake sure you have the latest version of ``wrangler`` as described in [the wrangler docs](https://developers.cloudflare.com/workers/cli-wrangler/install-update).\n\n#### Updating Wrangler with NPM:\n\n```shell\nnpm uninstall -g @cloudflare/wrangler \u0026\u0026 \n  npm install -g @cloudflare/wrangler \n```\n\n#### Install with cargo\n\n```shell\ncargo install wrangler --force\n```\n\n### Get a valid ``CF_API_TOKEN``\n\nMake sure you have a valid deployment token by doing: \n\n```shell\nwrangler login \n```\n\nor:\n\n```shell\nwrangler config \n```\n\n### Generate a new repository\n\nCreate a new GitHub repository with the green button or clone:\n\n```shell\n# with git\ngit clone https://github.com/0-vortex/workers-url-shortener.git\n```\n\nor with [github-cli](https://cli.github.com):\n\n```shell\n# with github-cli\ngh repo clone  0-vortex/workers-url-shortener\n```\n\n## Usage\n\n### Configure KV\n\nTo successfully run the redirect worker we need to set up some KV namespaces.\n\nGenerate new `namespace_id`s for the KV keys it [wrangler.toml](./wrangler.toml) and follow the instructions:\n\n```shell\n# dev environment\nwrangler kv:namespace create \"REDIRECTS\"\nwrangler kv:namespace create \"REDIRECTS\" --preview\n```\n\n```shell\n# production environment\nwrangler kv:namespace create \"REDIRECTS\" --env production\nwrangler kv:namespace create \"REDIRECTS\" --env production --preview\n```\n\nAfter you are done editing check if the changes are correct:\n\n```shell\nwrangler kv:namespace list\n```\n\n### Test data\n\nUpload some data to the ``REDIRECTS`` namespace:\n\n```shell\n# dev environment\nwrangler kv:bulk put --binding=\"REDIRECTS\" ./src/data.json\nwrangler kv:bulk put --binding=\"REDIRECTS\" ./src/data.json --preview\n```\n\n```shell\n# production environment\nwrangler kv:bulk put --binding=\"REDIRECTS\" ./src/data.json --env production\nwrangler kv:bulk put --binding=\"REDIRECTS\" ./src/data.json --env production --preview\n```\n\n### Local development\n\nTo develop locally just run:\n\n```shell\nnpm start\n```\n\nTo deploy to ``dev`` just run:\n\n```shell\nnpm run deploy\n```\n\n### Monitoring\n\nTo monitor any of the deployed environments run:\n\n```shell\nwrangler tail\n```\n\n## License\n\nThis library is released under BSD-3 license clause.\n\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2F0-vortex%2Fworkers-url-shortener.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2F0-vortex%2Fworkers-url-shortener?ref=badge_large)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0-vortex%2Fcf-workers-url-shortener","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F0-vortex%2Fcf-workers-url-shortener","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0-vortex%2Fcf-workers-url-shortener/lists"}