{"id":16352235,"url":"https://github.com/bugthesystem/reducio","last_synced_at":"2025-10-14T06:31:06.359Z","repository":{"id":27064526,"uuid":"112337244","full_name":"bugthesystem/reducio","owner":"bugthesystem","description":"❱  🐇  URL shortener service is written in Scala using Akka-Http and Redis ❰","archived":false,"fork":false,"pushed_at":"2024-07-30T12:18:23.000Z","size":110,"stargazers_count":68,"open_issues_count":85,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-28T01:47:42.690Z","etag":null,"topics":["akka-http","redis","scala","url-shortener"],"latest_commit_sha":null,"homepage":"","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bugthesystem.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":"2017-11-28T13:12:59.000Z","updated_at":"2024-11-22T21:48:28.000Z","dependencies_parsed_at":"2024-01-14T17:05:03.541Z","dependency_job_id":"700694eb-ec5a-41ab-8cb3-22b59b269be0","html_url":"https://github.com/bugthesystem/reducio","commit_stats":null,"previous_names":["bugthesystem/reducio","ziyasal/reducio"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bugthesystem%2Freducio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bugthesystem%2Freducio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bugthesystem%2Freducio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bugthesystem%2Freducio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bugthesystem","download_url":"https://codeload.github.com/bugthesystem/reducio/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":236451558,"owners_count":19150890,"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":["akka-http","redis","scala","url-shortener"],"created_at":"2024-10-11T01:25:26.421Z","updated_at":"2025-10-14T06:31:01.068Z","avatar_url":"https://github.com/bugthesystem.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ❱ reduc.io ❰\r\n\r\n\u003e URL shortener service `http://reduc.io/wuXaq`\r\n\r\n[![Build Status](https://travis-ci.org/ziyasal/reducio.svg?branch=master)](https://travis-ci.org/ziyasal/reducio) [![Coverage Status](https://coveralls.io/repos/github/ziyasal/reducio/badge.svg?branch=master)](https://coveralls.io/github/ziyasal/reducio?branch=master)\r\n\r\n## Tech stack\r\n\r\n- [Scala](https://www.scala-lang.org/)\r\n- [Akka Http](https://github.com/akka/akka-http)\r\n- [Circe](https://github.com/circe/circe)\r\n- [Redis](https://github.com/antirez/redis)\r\n- [ScalaTest](http://www.scalatest.org/)\r\n- [Specs2](https://github.com/etorreborre/specs2)\r\n- [Mockito](https://github.com/mockito/mockito)\r\n- [Gatling](https://gatling.io/)\r\n\r\n## Alternative solutions\r\n\r\nWe could use following short code gen also:\r\n```\r\nsubstr(base62(md5(url)), 6) = 62 ^ 6 //unique short urls\r\n```\r\n\r\n## Commands\r\n\r\n### Run\r\n\r\nRun `docker-compose`, it will start `api`, `redis` and will expose api port to host.\r\n\r\n```sh\r\ndocker-compose up\r\n```\r\n\r\n## Sample usage\r\n\r\n```sh\r\n# Shorten\r\ncurl -i http://localhost:9001 -F \"url=https://www.amazon.com/Star-Wars-Battlefront-II-Digital/dp/B072JZZ4XD\"\r\n\r\n# Call shortened url\r\nfor ((i=1;i\u003c=100;i++)); do curl -i \"http://localhost:9001/SEwuXHhBQw\"; done\r\n\r\n# Get Stats\r\ncurl -i \"http://localhost:9001/stats/?url=https://www.amazon.com/Star-Wars-Battlefront-II-Digital/dp/B072JZZ4XD\"\r\n\r\n# returns: {\"callCount\":100}\r\n```\r\n\r\n### Create executable\r\n\r\n```sh\r\nsbt packageBin\r\n```\r\n\r\n### Test\r\n\r\n```sh\r\nsbt test\r\n```\r\n\r\n#### Gatling Simulation\r\n\r\nSimulation users count can be set in `application.conf` in test resources.\r\n\r\n```sh\r\n# terminal 1\r\nsbt run\r\n\r\n# Run simulation in terminal 2\r\nsbt gatling:test gatling:latestReport\r\n```\r\n\r\n### Coverage with Report\r\n\r\n```sh\r\nsbt clean coverage test coverageReport\r\n```\r\n\r\n## Improvements\r\n- Seperate read and write API's\r\n- Move statistics to different data store and API\r\n- Add DB support by having write master/replicas and have read replicas\r\n- Move hit counts to MapReduce job and generate them from the Web Server logs\r\n- Implement Authentication using JWT authentication protocol with OAuth2 authentication framework\r\n- API Documentation using swagger or similar\r\n- Add Host denyList\r\n- Add Retry policies for `Redis` calls using [Retry](https://github.com/softprops/retry) or similar one\r\n- Add Throttling using [akka-http-contrib](https://github.com/adhoclabs/akka-http-contrib)\r\n- Add Metrics support using [akka-http-metrics](https://github.com/Backline/akka-http-metrics)\r\n\r\n\r\nz i λ a s a l.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbugthesystem%2Freducio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbugthesystem%2Freducio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbugthesystem%2Freducio/lists"}