{"id":13616303,"url":"https://github.com/pxeger/url-shortener","last_synced_at":"2026-03-10T11:04:14.678Z","repository":{"id":54751031,"uuid":"285522785","full_name":"pxeger/url-shortener","owner":"pxeger","description":"World's simplest URL shortener using Cloudflare Workers","archived":false,"fork":false,"pushed_at":"2020-08-17T15:08:46.000Z","size":18,"stargazers_count":12,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-07T04:56:27.911Z","etag":null,"topics":["cloudflare","javascript","serverless","url-shortener","webpack","wrangler"],"latest_commit_sha":null,"homepage":"https://www.pxeger.com/2020-08-06-world%27s-simplest-url-shortener-using-cloudflare-workers/","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/pxeger.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":"2020-08-06T08:58:30.000Z","updated_at":"2025-01-28T01:42:26.000Z","dependencies_parsed_at":"2022-08-14T01:40:40.087Z","dependency_job_id":null,"html_url":"https://github.com/pxeger/url-shortener","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pxeger/url-shortener","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pxeger%2Furl-shortener","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pxeger%2Furl-shortener/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pxeger%2Furl-shortener/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pxeger%2Furl-shortener/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pxeger","download_url":"https://codeload.github.com/pxeger/url-shortener/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pxeger%2Furl-shortener/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30331644,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T05:25:20.737Z","status":"ssl_error","status_checked_at":"2026-03-10T05:25:17.430Z","response_time":106,"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":["cloudflare","javascript","serverless","url-shortener","webpack","wrangler"],"created_at":"2024-08-01T20:01:26.696Z","updated_at":"2026-03-10T11:04:14.637Z","avatar_url":"https://github.com/pxeger.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# World's Simplest URL Shortener using Cloudflare Workers\nA URL Shortener is a very common proof-of-concept app to build when learning web development, and this one is nothing new.\nI wanted to try out Cloudflare's Workers, a super-simple Serverless platform built on their Edge Network.\n\nIf you're familiar with JavaScript Service Workers, you'll be able to write a Worker.\n\nHere's step-by-step instructions for setting it up, also available [on my blog](https://www.pxeger.com/2020-08-06-world's-simplest-url-shortener-using-cloudflare-workers)\n\n1. Get a [Cloudflare account](https://cloudflare.com) and enable Workers\n2. Install [`wrangler`](https://github.com/cloudflare/wrangler), Cloudflare's CLI tool for working with Workers, and set it up using your Cloudflare API token\n3. Copy the [Workers JavaScript template repository](https://github.com/cloudflare/worker-template)\n4. Write your code - you can see mine in [`index.js`](./index.js) (don't worry, it's very simple)\n4. Create your own `urls.json` for mapping paths( e.g. `foo` for `https://your-domain.com/foo`) to redirect URLs.\n5. Set `type` to `webpack` in `wrangler.toml` (see the [docs](https://developers.cloudflare.com/workers/tooling/wrangler/webpack/))\n6. Set your Account ID in `wrangler.toml` then run `wrangler publish` to deploy your app to a default subdomain of `workers.dev`\n7. To get it on your custom domain, set `workers_dev` to `false`, and `zone_id` in `wrangler.toml` to the Zone ID of your domain in Cloudflare, and `route` to `your-domain.com/*`.\n\nThis URL shortener can only have new URLs added by modifying `urls.json` and re-deploying. That may not be what you want, but it's perfect for me because I want mine to be private. You could look in to Cloudflare Workers KV to create a dynamic system, but for me the $5/month price floor was a little too steep for something this mundane.\n\nMine's deployed at `pxeger.net`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpxeger%2Furl-shortener","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpxeger%2Furl-shortener","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpxeger%2Furl-shortener/lists"}