/tinyurl

Spring Boot application integrated with Redis, MongoDB, and Cassandra for shortening URLs (tinyurl/bitly style)

Primary LanguageJavaMIT LicenseMIT

Tinyurl

Spring Boot application exposing API to shorten URLs, tinyurl/bitly style.

Swagger UI (may return 500 on first try, just refresh the page) running on runmydocker.com.

The project utilizes:

  • Redis for quick fetching of the original URL - The shortened URL maps to the original URL.
  • MongoDB for saving users, and "high-level" statistics of shortened URLs usage for each user, such as how many total clicks, and clicks distribution per month:
  • Cassandra for precise tracking of all clicks for all users (exact time of each click):

To get a shortened URL, open Swagger UI. Under app-controller open the /tiny POST request, add the URL and a username (user will be created if not exists yet), and click "Try it out!". The shortened URL will be under the Response Body:

image


Swagger UI available for:

  • Adding a user.
  • Shortening a URL.
  • Getting/setting the original URL with the shortened version ("tiny").
  • Getting information about a user's shortened URLs: all-time clicks (on all of the user's shortened URLs), and how many clicks were on each shortened URL in each month. See above (first image).
  • Getting information about each click on all of the user's shortened URLs. See above (second image).
  • Redirect (for accessing the original URL with the shortened URL).



To run it on your machine, run docker-compose.yml to have Redis, MongoDB, and Cassandra running on containers on your machine, and execute the code in init-cassandra.cql in the Cassandra container (via UI or CLI). Then, run the project (via IntelliJ, etc.). The Swagger UI will be available at localhost:8080/swagger-ui.html