{"id":22066070,"url":"https://github.com/pcpratheesh/go-urlshortner","last_synced_at":"2026-05-06T06:32:24.508Z","repository":{"id":154439041,"uuid":"572567559","full_name":"pcpratheesh/go-urlshortner","owner":"pcpratheesh","description":"URL Shortener Service in Go with storage","archived":false,"fork":false,"pushed_at":"2024-07-02T06:59:48.000Z","size":47,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-30T00:41:38.233Z","etag":null,"topics":["docker","docker-compose","fiber","fiber-framework","file","golang","golang-package","snippets","swagger","url-shortener"],"latest_commit_sha":null,"homepage":"","language":"Go","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/pcpratheesh.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-30T14:53:07.000Z","updated_at":"2024-06-25T04:45:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"f22f3177-2174-463e-b929-58d265f6d6f2","html_url":"https://github.com/pcpratheesh/go-urlshortner","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pcpratheesh/go-urlshortner","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pcpratheesh%2Fgo-urlshortner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pcpratheesh%2Fgo-urlshortner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pcpratheesh%2Fgo-urlshortner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pcpratheesh%2Fgo-urlshortner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pcpratheesh","download_url":"https://codeload.github.com/pcpratheesh/go-urlshortner/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pcpratheesh%2Fgo-urlshortner/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278686633,"owners_count":26028325,"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","status":"online","status_checked_at":"2025-10-06T02:00:05.630Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["docker","docker-compose","fiber","fiber-framework","file","golang","golang-package","snippets","swagger","url-shortener"],"created_at":"2024-11-30T19:25:35.633Z","updated_at":"2025-10-06T21:56:26.910Z","avatar_url":"https://github.com/pcpratheesh.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-urlshortner\nA golang api application which can be used to shorten any url.\n\n## URL Shortening\n```\nURL shortening is a technique on the World Wide Web in which a Uniform Resource Locator may be made substantially shorter and still direct to the required page. This is achieved by using a redirect which links to the web page that has a long URL\n```\n\n## Tech Stack\n- [Golang](https://go.dev/)\n- [Fiber](https://docs.gofiber.io/) - Express inspired web framework\n- [Docker](https://www.docker.com/) \n- [Docker compose](https://docs.docker.com/compose/)\n\n\n### Golang\nGo is a statically typed, compiled programming language designed at Google by Robert Griesemer, Rob Pike, and Ken Thompson. It is syntactically similar to C, but with memory safety, garbage collection, structural typing, and CSP-style concurrency\n\ncredits:google\n\n### Fiber\nFiber is a Go web framework built on top of Fasthttp, the fastest HTTP engine for Go. It's designed to ease things up for fast development with zero memory allocation and performance in mind\n\n### Docker\nDocker is a set of platform as a service products that use OS-level virtualization to deliver software in packages called containers. The service has both free and premium tiers. The software that hosts the containers is called Docker Engine. It was first started in 2013 and is developed by Docker, Inc\n\ncredits:google\n\n\n### Docker Compose \nDocker Compose is a tool for running multi-container applications on Docker defined using the Compose file format. A Compose file is used to define how the one or more containers that make up your application are configured.\n\ncredits:google\n\n\n## Installation\n- install Docker\n    - [Linux](https://docs.docker.com/desktop/install/linux-install/)\n    - [Windows](https://docs.docker.com/desktop/install/windows-install/)\n    - [Mac OS](https://docs.docker.com/desktop/install/mac-install/)\n- Install Docker compose\n    - https://docs.docker.com/compose/install/other/\n\n- After successfull installation, run the following command to build and up the docker container\n\n        docker-compose up \n        or \n        docker-compose up -d : to run the container in background\n- Server will be running now\n\n## API KEY\n`encode` is secured with an api key. You can use `3cbc5291f1e04ebe5ea24bfdba6763c49c597cea` as default.\n\n## Try API\ncurl --request POST \\\n  --url http://127.0.0.1:8080/encode \\\n  --header 'Content-Type: application/json' \\\n  --header 'x-api-key: 3cbc5291f1e04ebe5ea24bfdba6763c49c597cea' \\\n  --data '{\n\t\"url\":\"https://google.com\"\n}'\n\n\n\n## How to implement new storage\nAt the moment, the system is developed with easy implementation of new storages, such as databases, caches, etc.\n\nFollow the below steps to implement the redis cache\n- Install redis\n- Create `redis.go` and `redis_test.go` files under `pkg/storage`\n- Create new structure `RedisStorage` within redis.go \n- Implement `CheckURLExists`, `SaveURL`, `RetrieveURL` methods in `RedisStorage` struct, and a `NewRedisStorage` function to create new object of `RedisStorage`\n- Create new global variable `STORE_TYPE_REDIS` with value `Redis`\n- Add a new case within the `NewStorage` function to switch to `RedisStorage`\n- And the last set teh env config as `Redis` to run the application with `Redis Cache`\n\n\n\n## Useful Docker commands\n\n    docker build -t pcpratheesh/go_url_shortner .\n\n    docker images\n\n    docker container ps\n    \n    docker logs \u003ccontainer_id\u003e --follow\n\n\n\n## Switch shortned url storage\nYou can setup environment variable as \n`URLSRT_STORE='File'` or `URLSRT_STORE='InMemory'`","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpcpratheesh%2Fgo-urlshortner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpcpratheesh%2Fgo-urlshortner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpcpratheesh%2Fgo-urlshortner/lists"}