Giter Site home page Giter Site logo

luismateoh / altair Goto Github PK

View Code? Open in Web Editor NEW

This project forked from luishincapiebf/altair

0.0 0.0 0.0 538 KB

URL shortener service that allows users to shorten long URLs into short and unique aliases. The service also provides a QR code for the short URL

JavaScript 33.36% Java 65.57% CSS 0.34% Dockerfile 0.73%

altair's Introduction

Altair - URL Shortener

Altair is a URL shortener service that allows users to shorten long URLs into short and unique aliases. The service also provides a QR code for the short URL.

How does a URL shortener work?

At a high level, the URL shortener executes the following operations:

the server generates a unique short URL for each long URL the server encodes the short URL for readability the server persists the short URL in the data store the server redirects the client to the original long URL against the short URL

What is a URL shortening service

A URL shortening service is a website that substantially shortens a Uniform Resource Locator (URL). The short URL redirects the client to the URL of the original website. Some popular public-facing URL shortening services are tinyurl.com and bitly.com.

The reasons to shorten a URL are the following:

  • Track clicks for analytics
  • Beautify a URL
  • Disguise the underlying URL for affiliates
  • Some instant messaging services limit the count of characters on the URL

Functional requirements

  • Given a long URL, the service should generate a shorter and unique alias for it.
  • When the user hits a short link, the service should redirect to the original link.
  • The short URL should support analytics (not real-time) such as the number of redirections from the shortened URL
  • The short URL should be non-predictable
  • Multiple users entering the same long URL must receive the same short URL (1-to-1 mapping)
  • URL expires after 30 days of not being use
  • Optional custom alias
  • QR generation

Things to do

  • Basic shortener algorithm
  • Front end integration
  • Redis for cache
  • Authentication for statistics
  • Dockerized and deployment configuration
  • Testing :)
  • Cors configuration
  • Documentation
  • Testing again
  • Cloud

API

Shorten URL

POST /?longUrl={:url}
Parameter Type Description
url string Required. The long URL to be shortened

Response

{
  "id": 10000,
  "shortUrl": "http://localhost:8080/jO5Wi3",
  "longUrl": "https://github.com/",
  "createdAt": "2/13/24, 1:35 PM",
  "expiresAt": "2024-03-13",
  "accessCount": 0,
  "qrCode": "iVBORw0KGgoAAAANSUhEUgAAAPoAAAD6AQAAAACgl2eQAAABU0lEQVR4Xu2XMRLCMAwExVBQ8gSekqeFp/kpeQJlCibm7uTMEBeUzHD4GsXKprAky0rUzyrRezoNIDWA1ABSA0h9DViDOtPMWF0Xra92AJ+3s9YBs0y70wzAzgE8bmU+cTXdERVboMJEXOofAFzbAlVVzXQLn3anF8Asc+cIwEajtR3QtMatiHvzOQF6o3Rj8eThpfMQKAegPnCjnvgmggZutio7gNrgxOGlIX6MgwWAZzSnDEB94tQWQoYA6jg4DaJH8WLNodAQCMVhYXEzAHdFxQ3Icr6wR+UZnrt0ewC8UVHOkDiadvF4ATi8bUxScWM2PLRiD6BJWc8e3FW1B6Cd808U4WjJ724cD4DPG39hprr3KEtg4Z9acopJTku2QOFsj/u1hcMS0OyLGOAMo0c5ApVVvXJakkwBbj4EsDkp3fmVFfBBA0gNIDWA1ABSvwG8AHdpNb7LjVzhAAAAAElFTkSuQmCC"
}

Redirect URL

GET /{:shortUrl}
Parameter Type Description
shortUrl string Required. The short URL to be redirected

Response: Redirects to the original URL

Tech Stack

Backend

  • Java 17
  • Spring Boot
  • H2 Database
  • JPA
  • Lombok
  • QRGen
  • Swagger
  • JUnit
  • Mockito
  • Docker
  • Docker Compose

Frontend

  • React
  • Tailwind CSS
  • SWR
  • Next.js

How to run

docker-compose up

How to use

DB Schema

ER-Diagram.png

References

altair's People

Contributors

luishincapiebf avatar

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.