GithubHelp home page GithubHelp logo

bugthesystem / reducio Goto Github PK

View Code? Open in Web Editor NEW
69.0 2.0 5.0 110 KB

❱ 🐇 URL shortener service is written in Scala using Akka-Http and Redis ❰

License: The Unlicense

Scala 99.53% Dockerfile 0.47%
scala akka-http url-shortener redis

reducio's Introduction

❱ reduc.io ❰

URL shortener service http://reduc.io/wuXaq

Build Status Coverage Status

Tech stack

Alternative solutions

We could use following short code gen also:

substr(base62(md5(url)), 6) = 62 ^ 6 //unique short urls

Commands

Run

Run docker-compose, it will start api, redis and will expose api port to host.

docker-compose up

Sample usage

# Shorten
curl -i http://localhost:9001 -F "url=https://www.amazon.com/Star-Wars-Battlefront-II-Digital/dp/B072JZZ4XD"

# Call shortened url
for ((i=1;i<=100;i++)); do curl -i "http://localhost:9001/SEwuXHhBQw"; done

# Get Stats
curl -i "http://localhost:9001/stats/?url=https://www.amazon.com/Star-Wars-Battlefront-II-Digital/dp/B072JZZ4XD"

# returns: {"callCount":100}

Create executable

sbt packageBin

Test

sbt test

Gatling Simulation

Simulation users count can be set in application.conf in test resources.

# terminal 1
sbt run

# Run simulation in terminal 2
sbt gatling:test gatling:latestReport

Coverage with Report

sbt clean coverage test coverageReport

Improvements

  • Seperate read and write API's
  • Move statistics to different data store and API
  • Add DB support by having write master/replicas and have read replicas
  • Move hit counts to MapReduce job and generate them from the Web Server logs
  • Implement Authentication using JWT authentication protocol with OAuth2 authentication framework
  • API Documentation using swagger or similar
  • Add Host denyList
  • Add Retry policies for Redis calls using Retry or similar one
  • Add Throttling using akka-http-contrib
  • Add Metrics support using akka-http-metrics

z i λ a s a l.

reducio's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

reducio's Issues

Host it on your own

Can you host reduc.io on your own just with ftp and manually creating databases/modifying files? Unfortunately, I'm not able to run commands.

JWT authentication

Can you provide more detailed explanation when it comes to authentication? E.g. which framework? Would you embed the authentication mechanism in the application or use some dedicated server for authentication (e.g. Keycloack) and only perform authorization within the application?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.