{"id":13832097,"url":"https://github.com/roboncode/shorty-go","last_synced_at":"2025-07-09T16:34:08.639Z","repository":{"id":119405658,"uuid":"179331702","full_name":"roboncode/shorty-go","owner":"roboncode","description":"Microservice that shortens urls like bit.ly written in Go","archived":false,"fork":false,"pushed_at":"2019-04-09T23:34:08.000Z","size":1143,"stargazers_count":36,"open_issues_count":0,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-08-24T01:53:36.447Z","etag":null,"topics":["badgerdb","go","golang","microservice","mongodb","url-shortener","vuejs"],"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/roboncode.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}},"created_at":"2019-04-03T16:46:39.000Z","updated_at":"2024-02-04T22:18:38.000Z","dependencies_parsed_at":"2023-06-18T23:28:05.809Z","dependency_job_id":null,"html_url":"https://github.com/roboncode/shorty-go","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/roboncode%2Fshorty-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roboncode%2Fshorty-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roboncode%2Fshorty-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roboncode%2Fshorty-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/roboncode","download_url":"https://codeload.github.com/roboncode/shorty-go/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225575186,"owners_count":17490715,"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":["badgerdb","go","golang","microservice","mongodb","url-shortener","vuejs"],"created_at":"2024-08-04T10:01:50.836Z","updated_at":"2024-11-20T14:30:29.466Z","avatar_url":"https://github.com/roboncode.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# Shortens URLs like bit.ly written in Go\n\nA microservice used to shorten URLs built with Go.\n\nThis project was built using [Echo](https://echo.labstack.com/) and offers the option between two data stores:\n\n* [Badger](https://github.com/dgraph-io/badger) - Embedded Go Key/Value Database as a single standalone executable. Great for light / mid-tier usage.\n* [Mongo](https://github.com/mongodb/mongo-go-driver) + [go-cache](github.com/patrickmn/go-cache) - Allows for greater control of data storage and clustered environments. \n\nMicroservice runs on http://localhost:8080 by default.\n\n### Getting started\n\n```\ncd $GOPATH\ngo get github.com/roboncode/shorty-go\ncd github.com/roboncode/shorty-go\ndep ensure\n\n# To run with BadgerDb\ngo run main.go \n\n# To run with MongoDb\nmake mongo\nSTORE=mongo go run main.go\n```\n\n### Running standalone executable\n\nGive the code a quick spin by building a single exec with no external dependencies. Optional config.yaml file can be used for configuration or you can configure it as part of the command line.\n\n```\nmake standalone\n\n# Run with BadgerDb\n# Run on Linux\nmake run\n# Run on Mac OSX\nmake run_osx\n# Run on Windows\nmake run_win\n\n# Startup MongoDb instance\nmake mongo\n# Run on Linux\nSTORE=mongo make run\n# Run on Mac OSX\nSTORE=mongo make run_osx\n# Run on Windows\nSTORE=mongo make run_win\n```\n\n### Running as Docker container\n\n```\nmake build\nmake start\n```\n\n### Running development\n\n```\n# Run with BadgerDb\nmake dev\n\n# Run with MongoDb\nmake mongo\nSTORE=mongo make dev\n```\n\n### Running tests\n\n```\nmake test\n```\n\n### Admin Single Page Application (SPA)\n\nThe default API key in [config.yaml](config.yaml) is `shorty`. The web app is built with [Vue.js](https://github.com/vuejs/vue). The source is\nfound in the [web-client](web-client) directory.\n\n```\nGET /admin\n```\n\n\u003e See notes [web-client/README.md](web-client/README.md) for instructions on running and building the web app.\n\n### API\n\nThe API is pretty simple.\n\n```\nAuthentication required - uri?key=:authKey\n\nPOST    /shorten                    body{ url:String }\nGET     /links?l=:limit\u0026s=:skip     (Mongo works, Badger in progress)\nGET     /links/:code\nDELETE  /links/:code\n\nNo Authentication required\n\nGET     /admin          Admin SPA\nGET     /               Landing page\nGET     /:code          Redirect to long url\nGET     /*              404 page\n```\n\n### Config and Env variables\n\nShorty uses [Viper](https://github.com/spf13/viper) to handle configuration. The `config.yaml` contains all the \nconfigurable variables and default values. You can also override any variables as environment variables. You will see examples of this\nin the `docker-compose.yml`. You can also set the variables from the command line.\n\n```\nENV=prod STORE=mongo ./bin/shorty\n```\n\nFeel free to fork it, hack it and use it any way you please.\n\n**MIT License**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froboncode%2Fshorty-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froboncode%2Fshorty-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froboncode%2Fshorty-go/lists"}