{"id":18694752,"url":"https://github.com/cjdenio/shorty","last_synced_at":"2025-04-12T07:22:36.004Z","repository":{"id":42058402,"uuid":"340471585","full_name":"cjdenio/shorty","owner":"cjdenio","description":"High-performance link shortener","archived":false,"fork":false,"pushed_at":"2023-02-05T06:17:02.000Z","size":121,"stargazers_count":57,"open_issues_count":5,"forks_count":4,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-26T02:35:11.446Z","etag":null,"topics":["diesel-rs","docker","link-shortener","link-shortener-api","postgres","postgresql","rocket-rs","rust","self-hosted"],"latest_commit_sha":null,"homepage":"https://clb.li","language":"Rust","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/cjdenio.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":"2021-02-19T19:38:42.000Z","updated_at":"2024-12-05T11:27:16.000Z","dependencies_parsed_at":"2022-08-12T03:40:25.089Z","dependency_job_id":null,"html_url":"https://github.com/cjdenio/shorty","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/cjdenio%2Fshorty","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cjdenio%2Fshorty/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cjdenio%2Fshorty/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cjdenio%2Fshorty/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cjdenio","download_url":"https://codeload.github.com/cjdenio/shorty/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248531168,"owners_count":21119713,"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":["diesel-rs","docker","link-shortener","link-shortener-api","postgres","postgresql","rocket-rs","rust","self-hosted"],"created_at":"2024-11-07T11:12:37.002Z","updated_at":"2025-04-12T07:22:35.972Z","avatar_url":"https://github.com/cjdenio.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# shorty\n\n🔗 High-performance link shortener written in Rust\n\n[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/cjdenio/shorty)\n\n## 💾 Hosting\n\nIn addition to being easy to build from source (`cargo build --release`), shorty is available as a Docker image on both [Docker Hub](https://hub.docker.com/r/cjdenio/shorty) and [GitHub Container Registry](https://ghcr.io/cjdenio/shorty).\n\n### 🏁 Prerequisites\n\n- Some sort of Docker or Rust-compatible hosting. [clb.li](https://clb.li) runs on [CapRover](https://caprover.com), for example, but [Heroku](https://heroku.com) is a good free option.\n- A Postgres database (Heroku Postgres is your friend if you're running shorty on Heroku)\n\n### 🌎 Environment variables\n\n- `DATABASE_URL` - a valid Postgres URL, e.g. postgres://user:password@localhost:5432/database _(automatically set when using Heroku Postgres)_\n- `TOKEN` - your desired API token; only required if you're using the API (described below).\n- `PORT` - Change the port the server listens on; defaults to `8000`\n\n## 👀 Public links page\n\nThere's a page available at /links that displays all links with the `public` field set to `true`.\n\nCheck out [clb.li/links](https://clb.li/links) for an example!\n\nIf you _haven't_ set up a redirect for the root URL, it'll show this page as well.\n\n## 📡 API\n\nYou can use shorty's API to add/remove links. No UI is available quite yet, but will be soon!\n\n### Authentication\n\nProvide your `TOKEN` (described above) as a bearer token, so set the `Authorization` header to `Bearer \u003ctoken\u003e`. Example: `curl -H \"Authorization: Bearer token1234\" http://localhost:8000/api/example/route`\n\n### Requests\n\n`POST` requests must all contain JSON payloads. `x-www-form-urlencoded` is _not_ supported.\n\n### Responses\n\nAll responses are JSON, and follow this rough schema:\n\n```jsonc\n{\n  // False if something went wrong\n  \"ok\": true,\n\n  // Will be a string if something went wrong\n  \"err\": null,\n\n  \"data\": {\n    // Response data here...\n  }\n}\n```\n\n---\n\n### 📋 `GET /api/link` - list all links\n\nThis method has no options.\n\n---\n\n### ➕ `POST /api/link` - create a named link\n\nOptions:\n\n- `url` (string, **required**) - The URL the redirect to.\n- `name` (string, optional) - The link's name. Leave blank to randomly generate a 5-character ID.\n- `public` (bool, optional) - Whether or not to display this link on the public links page.\n- `description` (string, optional) - This field is displayed on the public links page (if `public` is set to `true`)\n\nℹ️ Note:\n**`/` and `root` are special values for `\u003cname\u003e` that create redirects for the root URL. You may use either.**\n\n---\n\n### 📝 `PATCH /api/link/\u003cname\u003e` - update a named link\n\nOptions:\n\nThis method takes the same parameters as `POST /api/link`, except they're all optional.\n\nℹ️ Note:\n**Please URL encode the `\u003cname\u003e` parameter if necessary; `/` will become `%2F`**\n\n---\n\n### ❌ `DELETE /api/link/\u003cname\u003e` - delete a named link\n\nexample: `curl -X DELETE http://localhost:8000/api/link/gh`\n\nℹ️ Note:\n**Please URL encode the `\u003cname\u003e` parameter if necessary; `/` will become `%2F`**\n\n---\n\n## 🚗 Roadmap\n\nCheck the [issues page](https://github.com/cjdenio/shorty/issues) for more information on in-progress features!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcjdenio%2Fshorty","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcjdenio%2Fshorty","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcjdenio%2Fshorty/lists"}