{"id":23081047,"url":"https://github.com/aden-q/short-url","last_synced_at":"2026-04-12T05:35:07.487Z","repository":{"id":210090638,"uuid":"724454793","full_name":"Aden-Q/short-url","owner":"Aden-Q","description":"A URL shortener web application built in Go","archived":false,"fork":false,"pushed_at":"2025-04-01T17:44:02.000Z","size":126,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-03T14:14:57.299Z","etag":null,"topics":["cache","docker","docker-compose","go","golang","mysql","redis","urlshortener"],"latest_commit_sha":null,"homepage":"","language":"Go","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/Aden-Q.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,"publiccode":null,"codemeta":null}},"created_at":"2023-11-28T05:28:51.000Z","updated_at":"2025-02-27T16:23:12.000Z","dependencies_parsed_at":"2024-06-04T04:44:55.149Z","dependency_job_id":"a58e5e26-7d3f-4432-a4d0-68ed294a8c0d","html_url":"https://github.com/Aden-Q/short-url","commit_stats":null,"previous_names":["aden-q/short-url"],"tags_count":51,"template":false,"template_full_name":null,"purl":"pkg:github/Aden-Q/short-url","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aden-Q%2Fshort-url","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aden-Q%2Fshort-url/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aden-Q%2Fshort-url/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aden-Q%2Fshort-url/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Aden-Q","download_url":"https://codeload.github.com/Aden-Q/short-url/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aden-Q%2Fshort-url/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31705574,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-12T05:11:36.334Z","status":"ssl_error","status_checked_at":"2026-04-12T05:11:27.332Z","response_time":58,"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":["cache","docker","docker-compose","go","golang","mysql","redis","urlshortener"],"created_at":"2024-12-16T13:45:30.225Z","updated_at":"2026-04-12T05:35:07.471Z","avatar_url":"https://github.com/Aden-Q.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Short URL\n\nA fully functional URL shortener using MySQL as the storage server and Redis as the cache server.\n\nThe current components include:\n\n+ a web server for URL shortening and redirection\n  + regex to verify validity of a URL\n  + Base62 encoding to compress a long URL\n+ an external Redis cache server\n+ a local dev enviroment setup with `docker-compose`\n+ automatic configuration management with a single `.env` file\n+ logging\n+ docs generated by swagger\n+ request timeout control\n+ in-memory cache\n+ [TODO] integration test running on CI\n+ [TODO] IP based rate limiting\n\n## Docs\n\nDocs are generated by [gin-swagger](https://github.com/swaggo/gin-swagger). To access the docs, open your browser and go to the following link after launching the web server on your localhost.\n\n```text\nhttp://127.0.0.1:8000/swagger/index.html\n```\n\n## Usages\n\nWe provide two API endpoints: one for URL shortening and another for URL redirection.\n\n### URL shortening\n\n`POST /api/v1/data/shorten`\n\n+ Request parameter: {longURL: string}\n+ Rreturn: shortURL\n\nExample usage:\n\n```bash\n$ curl -iX POST 'http://localhost:8080/api/v1/data/shorten?longURL=www.google.com'\nHTTP/1.1 200 OK\nContent-Type: application/json; charset=utf-8\nDate: Fri, 01 Dec 2023 05:10:33 GMT\nContent-Length: 18\n\n{\"shortURL\":\"aA4\"}\n```\n\n### URL redirection\n\n`shortURL`: The request URI path\n\n`GET /api/v1/:shortURL`\n\n+ Request parameter: no, using URI path binding instead\n+ Return: longURL for HTTP redirection\n\nExample usage:\n\n```bash\n$ curl -i 'http://localhost:8080/api/v1/aA4'\nHTTP/1.1 301 Moved Permanently\nContent-Type: text/html; charset=utf-8\nLocation: /api/v1/www.google.com\nDate: Fri, 01 Dec 2023 05:11:54 GMT\nContent-Length: 57\n\n\u003ca href=\"/api/v1/www.google.com\"\u003eMoved Permanently\u003c/a\u003e.\n```\n\n## Command Runner\n\nWe use the command runner [just](https://github.com/casey/just) as an alternative to makefile. Execute `just help` to access a complete list of available commands. If you do not have `just` installed, check the [justfile](./justfile) for all receipts.\n\n## Build and Run Locally\n\nWe use `docker-compose` to set up local development pretty easily. It exposes a web server forwarded to host port 8080, a MySQL server forwarded to host port 3306, and a Redis server forwarded to host port 6379. To launch, simply run:\n\n```bash\n$ docker-compose up -d\n```\n\nThen you are ready to go.\n\nTo build a binary, run:\n\n```bash\n$ just build\n```\n\nTo connect to the mysql server, run:\n\n```bash\n$ just mysql\n```\n\nTo connect to the redis server, run:\n\n```bash\n$ just redis\n```\n\n## License\n\n[MIT License](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faden-q%2Fshort-url","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faden-q%2Fshort-url","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faden-q%2Fshort-url/lists"}