{"id":15593788,"url":"https://github.com/seven7ty/shorty","last_synced_at":"2026-01-20T02:01:58.876Z","repository":{"id":40387655,"uuid":"451568586","full_name":"seven7ty/shorty","owner":"seven7ty","description":"Short links 🤷‍♂️","archived":false,"fork":false,"pushed_at":"2022-05-11T11:31:07.000Z","size":53,"stargazers_count":2,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-06T22:24:45.900Z","etag":null,"topics":["api","cloudflare","cloudflare-workers","http","javascript","web"],"latest_commit_sha":null,"homepage":"https://wulf.works","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/seven7ty.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"ko_fi":"wulf_"}},"created_at":"2022-01-24T17:41:05.000Z","updated_at":"2022-04-15T09:31:33.000Z","dependencies_parsed_at":"2022-08-09T19:01:04.103Z","dependency_job_id":null,"html_url":"https://github.com/seven7ty/shorty","commit_stats":null,"previous_names":["paulnewcomer/shorty","bwv2/shorty","seven7ty/shorty"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/seven7ty/shorty","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seven7ty%2Fshorty","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seven7ty%2Fshorty/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seven7ty%2Fshorty/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seven7ty%2Fshorty/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/seven7ty","download_url":"https://codeload.github.com/seven7ty/shorty/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seven7ty%2Fshorty/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28593781,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T01:57:22.592Z","status":"online","status_checked_at":"2026-01-20T02:00:07.325Z","response_time":117,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["api","cloudflare","cloudflare-workers","http","javascript","web"],"created_at":"2024-10-03T00:21:30.944Z","updated_at":"2026-01-20T02:01:58.858Z","avatar_url":"https://github.com/seven7ty.png","language":"JavaScript","funding_links":["https://ko-fi.com/wulf_"],"categories":[],"sub_categories":[],"readme":"# 👄 My simple [`worker`](https://developers.cloudflare.com/workers/) for short links\n\nI wanted a quick-and-easy way to create links on my domain, so I turned to Cloudflare Workers.  \nAll routes available, apart from the base redirect, return a JSON response paired with the `Content-Type: application/json` header.  \n**Every aforementioned JSON response follows this rough schema**:\n\n- for successful `POST` requests:\n\n```json\n{\n  \"success\": true,\n  \"payload\": {}\n}\n```\n\n- for successful `DELETE` and `PUT` requests:\n\n```json\n{\n  \"success\": true,\n  \"message\": \"Some message.\"\n}\n```\n\n- for _any_ **unsuccessful** request:\n\n```json\n{\n  \"success\": false,\n  \"message\": \"Error message.\"\n}\n```\n\nAside from that, the API also requires authentication through the `X-Auth-Key` header.\n\n## 🛣️ The routes\n\nRequests to URLs other than `/` are handled by the worker and fall under the following spec.\n\n### `GET /:slug`\n\nRuns a check against a bound KV namespace called `LINKS`, and if a slug like the one requested exists, redirects to the associated URL.  \nIf the slug can't be found, a JSON response is returned.\n\n### `POST /:slug?url={url}`\n\nCreates a **case-sensitive** entry in the KV namespace called `slug` with the value `url`.  \nRequests to the above endpoint are then redirected to corresponding URLs.  \nUpon successful creation (not a duplicate, etc.), a JSON response is returned:\n\n```json\n{\n  \"success\": true,\n  \"payload\": {\n    \"slug\": \"The passed slug\",\n    \"url\": \"The passed url\"\n  }\n}\n```\n\n### `POST /new?url={url}`\n\nSimilar to the above, except, this route randomizes the slug using [`nanoid`](https://www.npmjs.com/package/nanoid).  \nSince the slug is random, it's very important to save it by reading the response:\n\n```json\n{\n  \"success\": true,\n  \"payload\": {\n    \"slug\": \"The nanoid-generated slug\",\n    \"url\": \"The passed url\"\n  }\n}\n```\n\n### `DELETE /:slug`\n\nDeletes a link associated with the `slug`.\n\n### `PUT /:slug?url={url}`\n\nUpdate an existing `slug` with a new `url`. Doesn't return the new link like `POST` requests.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseven7ty%2Fshorty","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseven7ty%2Fshorty","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseven7ty%2Fshorty/lists"}