{"id":27097490,"url":"https://github.com/anddsdev/gotiny","last_synced_at":"2025-04-06T10:48:08.189Z","repository":{"id":256511187,"uuid":"855518814","full_name":"anddsdev/gotiny","owner":"anddsdev","description":"Link shortener built in go as part of roadmap.sh challenge","archived":false,"fork":false,"pushed_at":"2024-09-12T04:34:36.000Z","size":69,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-21T20:45:30.600Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/anddsdev.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":"2024-09-11T02:05:47.000Z","updated_at":"2024-09-16T16:07:26.000Z","dependencies_parsed_at":"2024-09-11T08:03:50.402Z","dependency_job_id":"34c2b36c-a89b-4fbf-bf50-a80101ad3065","html_url":"https://github.com/anddsdev/gotiny","commit_stats":null,"previous_names":["farbautie/gotiny","anddsdev/gotiny"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anddsdev%2Fgotiny","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anddsdev%2Fgotiny/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anddsdev%2Fgotiny/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anddsdev%2Fgotiny/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anddsdev","download_url":"https://codeload.github.com/anddsdev/gotiny/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247471396,"owners_count":20944154,"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":[],"created_at":"2025-04-06T10:48:07.252Z","updated_at":"2025-04-06T10:48:08.182Z","avatar_url":"https://github.com/anddsdev.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gotiny\n\n## Introduction\n\nA fast and efficient link shortener built with Go.\nSimplifies and manages long URLs quickly and reliably.\n\n\u003e [!IMPORTANT]\n\u003e This project built following the specifications from [roadmap.sh](https://roadmap.sh/projects/url-shortening-service)\n\n## Installation\n\n```bash\ngit clone https://github.com/gotiny/gotiny.git\ncd gotiny\ngo mod tidy\n// create .env file, set environment variables: see .env.example\ndocker-compose up -d // start postgres\ngo run ./cmd/app/main.go // start app\n```\n\n## Arquitecture\n\n![Gotiny Architecture](./docs/url-shortener-architecture.png)\n\n## Requirements\n\n- Create a new short URL\n- Retrieve an original URL from a short URL\n- Update an existing short URL\n- Delete an existing short URL\n- Get statistics on the short URL (e.g., number of times accessed)\n\n## Api Documentation\n\n```bash\nPOST /api/v1/shorten\n{\n    \"url\": \"https://www.example.com/some/long/url\"\n}\n```\n\nThe endpoint validates the body of the request and return a\n201 Created status code with the newly created short URL\n\n```json\n{\n  \"id\": \"1\",\n  \"url\": \"https://www.example.com/some/long/url\",\n  \"short_url\": \"abc123\",\n  \"hits\": 39,\n  \"createdAt\": \"2021-09-01T12:00:00Z\",\n  \"updatedAt\": \"2021-09-01T12:00:00Z\"\n}\n```\n\nor a 400 Bad Request status code with error messages in case of validation errors.\nShort codes are unique and randomly generated.\n\n### Retrieve Original URL\n\nRetrieve the original URL from a short URL using the GET method\n\n```bash\nGET /api/v1/shorten/abc123\n```\n\nThe endpoint returns a 200 OK status code with the original URL\n\n```json\n{\n  \"id\": \"1\",\n  \"url\": \"https://www.example.com/some/long/url\",\n  \"short_url\": \"abc123\",\n  \"hits\": 39,\n  \"createdAt\": \"2021-09-01T12:00:00Z\",\n  \"updatedAt\": \"2021-09-01T12:00:00Z\"\n}\n```\n\nor a 404 Not Found status code if the short URL was not found.\nThe frontend is responsible for retrieving the original URL\nusing the short URL and redirecting the user to the original URL.\n\n### Update Short URL\n\nUpdate an existing short URL using the PUT method\n\n```bash\nPUT /api/v1/shorten/abc123\n{\n    \"url\": \"https://www.example.com/some/new/long/url\"\n}\n```\n\nThe endpoint validates the body of the request and return a\n200 OK status code with the updated short URL\n\n```json\n{\n  \"id\": \"1\",\n  \"url\": \"https://www.example.com/some/new/long/url\",\n  \"short_url\": \"abc123\",\n  \"hits\": 39,\n  \"createdAt\": \"2021-09-01T12:00:00Z\",\n  \"updatedAt\": \"2021-09-01T12:00:00Z\"\n}\n```\n\nor a 400 Bad Request status code with error messages in case of validation errors.\nReturns a 404 Not Found status code if the short URL was not found.\n\n### Delete Short URL\n\nDelete an existing short URL using the DELETE method\n\n```bash\nDELETE /api/v1/shorten/abc123\n```\n\nThe endpoint returns a 204 No Content status code if the short URL was deleted.\nor a 404 Not Found status code if the short URL was not found.\n\n### Get Statistics\n\nGet statistics on the short URL using the GET method\n\n```bash\nGET /api/v1/shorten/stats/abc123\n```\n\nThe endpoint returns a 200 OK status code with the statistics\n\n```json\n{\n  \"id\": \"1\",\n  \"url\": \"https://www.example.com/some/long/url\",\n  \"short_url\": \"abc123\",\n  \"hits\": 10,\n  \"createdAt\": \"2021-09-01T12:00:00Z\",\n  \"updatedAt\": \"2021-09-01T12:00:00Z\"\n}\n```\n\nor a 404 Not Found status code if the short URL was not found.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanddsdev%2Fgotiny","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanddsdev%2Fgotiny","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanddsdev%2Fgotiny/lists"}