{"id":14973881,"url":"https://github.com/basemax/bitlygo","last_synced_at":"2025-10-27T05:30:55.289Z","repository":{"id":151535227,"uuid":"527705015","full_name":"BaseMax/BitlyGo","owner":"BaseMax","description":"URL Shortener - Short URLs \u0026 Custom Free Link Powered by Go language and PostgreSQL database. (API, JSON)","archived":false,"fork":false,"pushed_at":"2024-12-11T23:47:27.000Z","size":160,"stargazers_count":10,"open_issues_count":3,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-04T07:15:36.515Z","etag":null,"topics":["api","api-rest","api-server","go","golang","postgresql","psql","url-shortener","url-shortener-api","url-shortening","url-shortner"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BaseMax.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2022-08-22T19:29:05.000Z","updated_at":"2024-03-18T12:53:00.000Z","dependencies_parsed_at":"2024-03-20T22:28:14.814Z","dependency_job_id":"a96c8b7d-115c-46f0-9e10-11391294a9b4","html_url":"https://github.com/BaseMax/BitlyGo","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/BaseMax%2FBitlyGo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2FBitlyGo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2FBitlyGo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2FBitlyGo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BaseMax","download_url":"https://codeload.github.com/BaseMax/BitlyGo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238437593,"owners_count":19472440,"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":["api","api-rest","api-server","go","golang","postgresql","psql","url-shortener","url-shortener-api","url-shortening","url-shortner"],"created_at":"2024-09-24T13:49:37.693Z","updated_at":"2025-10-27T05:30:50.004Z","avatar_url":"https://github.com/BaseMax.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bitly Go\n\nURL Shortener - Short URLs \u0026 Custom Free Link Powered by GoLang and PostgreSQL database.\n\n## Dependencies\n\n- Golang 1.18+\n- [Tern](https://github.com/jackc/tern) 1.13+ (The SQL Fan's Migrator)\n\n## Getting started\n\n- Rename `config.yaml.example` to `config.yaml`, and `tern.conf.example` to `tern.conf`;\n- Change the database connection info with your own.\n\n### Run without docker\n\n```bash\ncd cmd/bitlygo/\ngo run main.go\n```\n\n### Run as a docker container\n\nNOTE: Make sure you changed the database connection info in `docker-compose.yaml` file\n\n```bash\n$ docker-compose build --no-cache\n$ docker-compose up -d\n```\n\n## Routes\n\n### `GET /`\n\nThis route will show this README to show the features of the projects to everyone.\n\n### `POST /register`\n\n- STRING `username` (required, The minimum length is 4 and maximum length is 88 also does not allow empty username)\n- STRING `password` (required)\n\nThis route will make new user if didn't exist\n\nExample response:\n\n```json\n{\n   \"username\": \"john\",\n   \"api_key\": \"abcd-efgh-ijkl-mnop-124v-852a\"\n}\n```\n\nOR\n\n```json\n{\n   \"status\": false,\n   \"message\": \"Error message\"\n}\n```\n\n### `POST /login`\n\n- STRING `username` (required)\n- STRING `password` (required)\n\nThis route will log into user account if exists\n\nExample response:\n```json\n{\n   \"status\": true\n}\n```\n\nOR\n\n```json\n{\n   \"status\": false,\n   \"message\": \"Error message\"\n}\n```\n\n### `GET /search`\n\n- STRING `q` (required, The minimum length is 1 and does not allow empty queries also we will trim the value to make it ready to search)\nWe will remove and skip all non-English and non-Digits characters and after that, if `q` is not empty we will search and fetch the results. Otherwise, throw an error!\n\n- POSITIVE INT `limit` (default is 10, Minimum value is 1 and Maximum is 100. Otherwise, throw an error!)\n\nExample response:\n\n```json\n{\n   \"status\": true,\n   \"items\": {\n    \"google\": \"https://google.com\",\n    \"facebook\": \"https://fb.com/?from_my_site\",\n    \"telegram\": \"https://t.me/\"\n   }\n}\n```\n\nOR\n\n```json\n{\n   \"status\": false,\n   \"error\": \"Error message\"\n}\n```\n\n### `GET /top`\n\n- POSITIVE INT `limit` (default is 10, Minimum value is 1 and Maximum is 100. Otherwise, throw an error!)\n\nExample response:\n\n```json\n{\n   \"status\": true,\n   \"items\": [\n      {\n         \"name\": \"google\",\n         \"link\": \"https://google.com\",\n         \"visits\": 300\n      },\n      {\n         \"name\": \"github\",\n         \"link\": \"https://github.com/test\",\n         \"visits\": 255\n      },\n      {\n         \"name\": \"fb\",\n         \"link\": \"https://fb.com\",\n         \"visits\": 200\n      }\n   ]\n}\n```\n\nOR\n\n```json\n{\n   \"status\": false,\n   \"error\": \"Error message\"\n}\n```\n\n### `GET /expire-soon`\n\n- POSITIVE INT `limit` (default is 10, Minimum value is 1 and Maximum is 100. Otherwise, throw an error!)\n\nExample response:\n\n```json\n{\n   \"status\": true,\n   \"items\": {\n    \"google\": \"https://google.com\",\n    \"facebook\": \"https://fb.com/?from_my_site\",\n    \"telegram\": \"https://t.me/\"\n   }\n}\n```\n\nOR\n\n```json\n{\n   \"status\": false,\n   \"error\": \"Error message\"\n}\n```\n\n### `POST /add` or `POST /add/`\n\n- STRING `name` (optional, If not defined, we will generate a short and unique random name)\n\n- STRING `link` (required, and we will check the link should be valid and pass URL standard format)\nAbout link value: we must support **UTF-8** characters or query values.\n\nIf you send `API-KEY` in the headers, your short link will be alive for ever, otherwise, all links you are creating will only live for 2 days. It should be nice to easily config this limitation inside the source.\n\nNote: you cannot create a duplicate name and It should throw an error. But it's okay to store the same link in different names.\n\n### `POST /:name` or `POST /:name/`\n\n- STRING `link` (required, and we will check the link should be valid and pass URL standard format)\nAbout link value: we must support **UTF-8** characters or query values.\n\nIf you send `API-KEY` in the headers, your short link will be alive for ever, otherwise, all links you are creating will only live for 2 days. It should be nice to easily config this limitation inside the source.\n\nNote: you cannot create a duplicate name and It should throw an error. But it's okay to store the same link in different names.\n\n### `GET /:name`\n\nIf the name is available on the databases. we will redirect the clients to the target URL. 301 redirect is fine.\n\nOtherwise, we should alert that is a 404 (HTTP Status) route and display a 404 warning.\n\n### `UPDATE /:name`\n\n- STRING `new_name` (optional)\n\n- STRING `link` (required, and we will check the link should be valid and pass URL standard format)\nAbout link value: we must support **UTF-8** characters or query values.\n\nYou can only update a link created by an API-KEY.\nSo if the owner of that link is same as your API-KEY, you are allowed to update that.\n\nNote: you cannot change the name, you only can change the link value and link that to another new URL.\n\n### `DELETE /:name` or `DELETE /:name/`\n\nYou can only delete links created by an API-KEY.\nSo if the owner of that link is same as your API-KEY, you are allowed to delete.\n\nExample response:\n\n```json\n{\n   \"status\": true\n}\n```\n\nOR\n\n```json\n{\n   \"status\": false,\n   \"error\": \"Sorry, no permission\"\n}\n```\n\n**Important NOTE:** Note that `search`, `add`, `expire-soon`, and `top` are not allowed for names and we should make sure it's not allowed to create such names. since they are already reserved in the router.\n\nThe **minimum** allowed name length is 4 and the **maximum** is 25.\n\nThe name can only contain English and numeric characters. Any other character is ignored.\n\n## Database\n\nIt's okay to use **PostgreSQL** or **MariaDB**.\n\nNote: since this project supports short lifetime links, we can use other databases too. but it's possible to use SQL and delete old rows.\n\n## Authors\n\n- Its Joniur\n- Max Base\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasemax%2Fbitlygo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbasemax%2Fbitlygo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasemax%2Fbitlygo/lists"}